Install a set of packages in a profile with a flake (advice on current solution)

Greetings Nix Friends,

I am working on a flake.nix file which will allow my team to install a number of packages in their default profile. This is as an alternative to HomeBrew. My current work can be seen at ops-tool-belt/flake.nix at 48ad9c5c606077426259246bd907d08947fd47f2 · pusherofbrooms/ops-tool-belt · GitHub (early stages). This works as I intend. I can run nix profile install . and all of the packages appear in the path. I’m wondering if I’m doing it the “right” way. I am suspicious of my use of buildEnv as a container for a list of packages. The name “buildEnv” suggests that I might be misusing the construct. Is there a more idiomatic way to do this? Am I on the right path overall with this flake?

I am brand new to Nix, so your patience is appreciated.

1 Like

I think buildEnv (nixpkgs/default.nix at e945c27a1778654533b649fd9d8e87a39da4d340 · NixOS/nixpkgs · GitHub) is how the unrelated packages are meant to be combined and distributed. The only other options I am aware of would be (a lot less flexible) symlinkJoin (nixpkgs/trivial-builders.nix at ec1e3b40e656676dcec2cb640ec8e3b7fb983e53 · NixOS/nixpkgs · GitHub) or a container. I have a similar setup - an environment for data scientists consisting of hundreds Python, R packages, command line tools, etc. My project started in pre-flakes era. It is basically a collection of overlays over (pinned) nixpkgs and the result is a hierarchy of buildEnv “packages” grouped together in different subsets depending on the target audience. We export/copy them as closures to other machines and install using nix-env -i to either the default profile or custom profiles. The users just have paths to those profiles in their ~/.bashrc, they don’t even know about nix.

I am too interested if flakes provide a more elegant way to deal with all that (aside from the standard way to pin the inputs which is an obvious but not too compelling reason to switch).