Nix flake does not support the full nix language

I have a flake defining my nixOS. After a flake update failed to build, I learned that nixpkgs and home manager have to have their branches synced (meaning if nixpkgs is 22.11, home manger also need to be 22.11). Therefore I wanted to use this as a variable for the inputs used for the system flake like this

  inputs =
    let
      nixpkgs_release_version = "22.11";
    in
    {
      nixpkgs.url = "github:nixos/nixpkgs/nixos-${nixpkgs_release_version}";
      nixpkgs-unstable.url = "nixpkgs/nixos-unstable";
      home-manager.url = "github:nix-community/home-manager/release-${nixpkgs_release_version}";
      home-manager.inputs.nixpkgs.follows = "nixpkgs";
    };

but this fails with this error:

error: expected a set but got a thunk at /nix/store/ag6h0m8q6d7cdpsbmcv4ig167c54830j-source/flake.nix:4:3

As I currently understand it, this does not work because the flake schema does not use the full nix language in this case. I.e. only a raw attribute set is allowed as the inputs parameter and not something that evaluates to an attribute set. Is my understanding correct and if so, why is this the current behavior? Does allowing this kind of use case lead to unwanted behavior in other cases?

2 Likes

I think this is:

1 Like