First time trying NixOS, random questions

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:

  1. create a packages.nix file with
with import <nixpkgs> {};
[
  hello
  # packages here
]
  1. run nix-env -irf packages.nix: packages listed in the file will be installed, all packages not listed will be removed.
  2. change packages.nix, rerun the command and the changes will be applied.
3 Likes