Loading...
Loading...
Runs packages temporarily, creates isolated shell environments, and evaluates Nix expressions. Use when executing tools without installing, debugging derivations, or working with nixpkgs.
npx skill4agent add knoopx/pi nix# Run a package once
nix run nixpkgs#hello
# Create a shell with multiple packages
nix shell nixpkgs#git nixpkgs#vim --command git --versionnixpkgs# Run a package with specific arguments
nix run nixpkgs#cowsay -- "Hello from Nix!"
# Run long-running applications: `tmux new -d 'nix run nixpkgs#some-server'`# Format current flake
nix fmt
# Check formatting
nix fmt -- --checknix hash to-srito-base16# Convert a nix32 hash to SRI (sha256)
nix hash convert --hash-algo sha256 --from nix32 --to sri 1b8m03r63zqhnjf7l5wnldhh7c134ap5vpj0850ymkq1iyzicy5s
# Convert to nix32 explicitly
nix hash convert --hash-algo sha256 --to nix32 sha256-ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0=# Fetch a tarball and print its nix32 hash
nix-prefetch-url --unpack https://example.com/source.tar.gz
# Convert the nix32 hash to SRI for fetchFromGitHub/fetchurl
nix hash convert --hash-algo sha256 --from nix32 --to sri <nix32-hash>nix eval# Evaluate a simple expression
nix eval --expr '1 + 2'
# Inspect an attribute from nixpkgs
nix eval nixpkgs#hello.name
# Evaluate a local nix file
nix eval --file ./default.nix
# List keys in a set (useful for exploration)
nix eval --expr 'builtins.attrNames (import <nixpkgs> {})'# Search for a package by name or description
nix search nixpkgs python3# Let binding
let
name = "Nix";
in
"Hello ${name}"
# Function definition
let
multiply = x: y: x * y;
in
multiply 2 3{
a = 1;
b = "foo";
}#!/usr/bin/env nix
#! nix shell nixpkgs#bash nixpkgs#curl --command bash
curl -s https://example.com#!/usr/bin/env nix
#! nix shell nixpkgs#python3 --command python3
print("Hello from Nix!")nix lognix-store -q --references $(which program)--no-substitutenix why-depends nixpkgs#hello nixpkgs#glibc