nixos-config
My NixOS configuration files for my laptop and the server running this site.
Cheatsheet
Task | Command |
---|---|
Run program | nix run nixpkgs#hello (needs -- if passing args) |
Run program from another nixpkgs repo | nix run github:Toby222/nixpkgs#space-station-14-launcher |
Clean Nix store | sudo nix-collect-garbage and nix store optimise |
Get size of Nix store | sqlite 'file:/nix/var/nix/db/db.sqlite?readonly=true&immutable=true' 'SELECT SUM(narSize) FROM ValidPaths' |
Get largest packages | sqlite 'file:/nix/var/nix/db/db.sqlite?readonly=true&immutable=true' 'SELECT * FROM ValidPaths ORDER BY narSize DESC LIMIT 50' |
Check if anything depends on path | nix-store --query --referrers /nix/store/blah |
List system generations | nixos-rebuild list-generations |
Switch to generation | sudo nix-env --switch-generation 12345 -p /nix/var/nix/profiles/system and sudo /nix/var/nix/profiles/system/bin/switch-to-configuration switch |
Run Nix file | nix eval -f main.nix |
Build VM from config | nixos-rebuild build-vm |
Deploy using signing key | LOCAL_KEY=key deploy -s . |