I have made my first serious foray into flakes. Converting my system configuration was easy. Converting my home-manager configuration into a flake is almost done (though a bit more work due to use of some external package sets and overlays).
Along the way, I bumped into two questions. The following toy flake
{
description = "Test flake";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in {
packages = {
foo.hello = pkgs.hello;
bar.hello = pkgs.hello;
};
}
);
}
Fails flake check
with
flake attribute 'packages.aarch64-linux.foo' is not a derivation
(use '--show-trace' to show detailed location information)
I checked the flake check
source and it seems that the packages
attrset should always have derivations as the values. I know you can rename the attribute from packages
to legacyPackages
and the check passes fine.
On to my first question: does that mean that once we switch to non-legacy packages, flakes can never have derivations nested in another attribute set anymore? I currently have some applications for this, such as bundling Python packages similarly to nixpkgs
and for bundling machine learning models together (e.g. in one repo the attribute sticker2_models.nl-ud-20200824
would represent a Dutch sticker2 model from today).
If so, what replaces this? Should such nested derivations become flakes by themselves? Or will legacyPackages
stick around for such purposes eternally (and if so, why would one use packages
)?
The second question is quite different. I found the valid (according to flake check
) output attributes on the very helpful Wiki page. Now I am wondering where the home-manager configurations for my various machines should go. I don’t want to overload nixosConfigurations
, because I would eventually like to merge my NixOS and home-manager repositories into one flake. Seems like something like homeConfigurations
is missing?