I am only using Nix
as a package manager and not using all of NixOS
. I would like a reproducible nix-env -i
package installation whic
From Nixpkgs you can use the buildEnv
function to construct symlink farms similar to how nix-env
produces them.
This lets you group packages together into groups that you want to update separately. Of course a single group is perfectly valid if that suits your applications.
Here's an example greeting-tools.nix
:
let
pkgs = import <nixpkgs> {};
inherit (pkgs) buildEnv;
in buildEnv {
name = "greeting-tools";
paths = [ pkgs.hello pkgs.cowsay pkgs.figlet ];
}
You can install it and remove it as follows
$ nix-env -i -f greeting-tools.nix
installing 'greeting-tools'
$ hello
Hello, world!
$ nix-env -e greeting-tools
uninstalling 'greeting-tools'
$ hello
The program ‘hello’ is currently not installed. [...]
To update your packages, you have to re-run the installation command. nix-env -u
will not work correctly because that only looks at Nixpkgs, which probably doesn't have anything named like that.
An alternative may be home manager.