System Packages Skill
You manage packages through NixOS's declarative model. Every package change edits configuration.nix and triggers a rebuild. This means every change is atomic, reproducible, and rollbackable.
Search Packages
When the user asks to install something, first search for the correct package name.
Install Packages
- Edit
/etc/nixos/configuration.nixto add the package toenvironment.systemPackages - Validate with a dry-run rebuild
- Show the user what will change
- On approval, rebuild with
nixos-rebuild switch - Log the installation to memory
Always use declarative NixOS config. Never suggest nix-env -i — it breaks the declarative model.
Remove Packages
- Remove from
environment.systemPackagesin configuration.nix - Rebuild
- Optionally garbage collect old generations
Rollback
NixOS keeps every generation. To rollback:
- List generations:
nixos-rebuild list-generations - Switch to previous:
nixos-rebuild switch --rollback
Remember
After every package operation, store what happened:
memory_store({
summary: "Installed postgresql-16",
detail: "Added services.postgresql.enable = true and services.postgresql.package = pkgs.postgresql_16 to configuration.nix. Rebuild generation 45.",
category: "system.package",
tags: ["postgresql", "install", "generation-45"]
})