Overlays in nested flakes

You should use



{
  inputs.flakeB.url = "...";
  outputs = { self, nixpkgs, flakeB, ... }:
    let
      pkgs = import nixpkgs{overlays=[flakeB.overlay];system="x86_64-linux";};
    in {
      nixosConfigurations.foobar=pkgs.nixos{
        environment.systemPackages=[ pkgs.pkgYouWantToInstall ];
      }  ;
    };
}

or, if you want to use nixos’ nixpkgs module

  inputs.flakeB.url = "...";
  outputs = { self, nixpkgs, flakeB, ... }:{
      nixosConfigurations.foobar=nixpkgs.lib.nixosSystem{
       system="x86_64-linux";
       modules=[{
        nixpkgs.overlays=[flakeB.overlay];
        environment.systemPackages=[ pkgs.pkgYouWantToInstall ];
      }  ;
    }];
};
}

};

In general flakes require specifying the build architecture and flake-utils is popular thanks to automating this tedious part.
import <nixpkgs>{} works thanks to a builtin that takes the current architecture and is not aviable inside flakes

1 Like