I’m trying to set up a configuration.nix
which supports two different versions of nixpkgs (21.11 and unstable). The first try was to simply run it, which showed that some configuration options have changed since 21.11. So I moved only the configuration differences into a 21.11.nix
and unstable.nix
, and now I want to import one of these depending on the value of an external NIXPKGS_VERSION
environment variable. How do I do that? Putting (./. + "/${config.environment.variables.NIXPKGS_VERSION}.nix")
in the imports list doesn’t work, because it results in infinite recursion. I also tried setting NIXOS_EXTRA_MODULE_PATH
, but that doesn’t seem to work the way I understood the documentation.
Alternatively, is there some way I can get the nixpkgs version within configuration.nix
, so that I can do something like mkIf config.nixpkgs == "21.11" { environment.systemPackages = [ pkgs.exfat-utils ]; };