How to use unstable nixpkgs in imports with flake?

You could add unstable to specialArgs like so

    nixosConfigurations.someHost =  nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs = { inherit unstable; };
      modules = [ ./configuration.nix ];
    };

and then use it in your modules

{ unstable, ... }:
{
   environment.systemPackages = [ unstable.somePackage ];
}
2 Likes