1.6 KiB
# fenix repl (default)
nix repl --expr "import <nixpkgs>{}" pkgs
# fenix repl --nopkgs
nix repl
# fenix src FUNC (maybe a different name then src?)
nix repl <<< ":e $FUNC"
# fenix clean
nix-store --gc # aka nixos-collect-garbage
# Combine all prefetch utilities
# fenix prefetch URI
nix-prefetch-git
nix-prefetch-url
# etc
# This command is EXTREMELY powerful
nix derivation show --recursive /run/current-system
# The goal would be to have something like:
# fenix sys why-depends
# To show which package caused another to be installed
Notes
Useful Tricks
The path /nix/var/nix/profiles/per-user/root/channels/ seems to be where
Nix clones the git repos for chosen channels. Could be useful instead
of querying search.nixos.org.
"Alias" Commands
The tool nix-collect-garbage (as per man nix-collect garbage):
...is mostly an alias of nix-store --gc ⟨../command-ref/nix-store/gc.md⟩. That is, it deletes all unreachable store objects ⟨../store/store-object.md⟩ in the Nix store to clean up your system.
However, it provides two additional options, --delete-old ⟨#opt-delete-old⟩ and --delete-older-than ⟨#opt-delete-older-than⟩, which also delete old profiles ⟨../command-ref/files/profiles.md⟩, allowing potentially more store objects ⟨../store/store-object.md⟩ to be deleted because profiles are also garbage collection roots.
These options are the equivalent of running nix-env --delete-generations ⟨../command-ref/nix-env/delete-generations.md⟩ with various augments on multiple profiles, prior to running nix-collect-garbage (or just nix-store --gc) without any flags.