fenix/COMMANDS.md

38 lines
1.3 KiB
Markdown
Raw Normal View History

```bash
# fenix repl (default)
nix repl --expr "import <nixpkgs>{}" pkgs
# fenix repl --nopkgs
nix repl
# fenix src FUNC (maybe a different name then src?)
fenix repl <<< ":e $FUNC"
# fenix clean
nix-store --gc # aka nixos-collect-garbage
```
### 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.