It’s little known, but you can install packages declaratively even with nix-env. It’s much simpler than setting up home-manager. Here’s how:
- create a
packages.nixfile with
with import <nixpkgs> {};
[
hello
# packages here
]
- run
nix-env -irf packages.nix: packages listed in the file will be installed, all packages not listed will be removed. - change
packages.nix, rerun the command and the changes will be applied.