flake: optimize nixpkgs importing

`nixpkgs.legacyPackages.${system}` allows reusing a single pkgs instance
that is shared among all flakes with the same `nixpkgs` input.
This is relevant when a user overrides the `nixpkgs` input of our flake
or exports our `nixpkgs` input to other flakes.
`import nixpkgs` would create a new pkgs instance instead.
This commit is contained in:
Erik Arvstedt 2022-02-03 20:46:25 +01:00
parent 16e2d4c8b7
commit 6f8b4d9ebe
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -18,8 +18,8 @@
lib = {
mkNbPkgs = {
system
, pkgs ? import nixpkgs { inherit system; }
, pkgsUnstable ? import nixpkgsUnstable { inherit system; }
, pkgs ? nixpkgs.legacyPackages.${system}
, pkgsUnstable ? nixpkgsUnstable.legacyPackages.${system}
}:
import ./pkgs { inherit pkgs pkgsUnstable; };
};
@ -65,7 +65,7 @@
} // (flake-utils.lib.eachSystem supportedSystems (system:
let
pkgs = import nixpkgs { inherit system; };
pkgs = nixpkgs.legacyPackages.${system};
nbPkgs = self.lib.mkNbPkgs { inherit system pkgs; };