Merge pull request #317772 from ExpidusOS/fix/flake-check

Make NixOS/nixpkgs Flake pure
This commit is contained in:
Silvan Mosberger 2024-06-11 03:58:46 +02:00 committed by GitHub
commit f0feb1b84c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 12 deletions

View File

@ -5,14 +5,15 @@
outputs = { self }:
let
jobs = import ./pkgs/top-level/release.nix {
nixpkgs = self;
};
libVersionInfoOverlay = import ./lib/flake-version-info.nix self;
lib = (import ./lib).extend libVersionInfoOverlay;
forAllSystems = lib.genAttrs lib.systems.flakeExposed;
jobs = forAllSystems (system: import ./pkgs/top-level/release.nix {
nixpkgs = self;
inherit system;
});
in
{
lib = lib.extend (final: prev: {
@ -43,12 +44,14 @@
);
});
checks.x86_64-linux = {
tarball = jobs.tarball;
checks = forAllSystems (system: {
tarball = jobs.${system}.tarball;
} // lib.optionalAttrs (self.legacyPackages.${system}.stdenv.isLinux) {
# Test that ensures that the nixosSystem function can accept a lib argument
# Note: prefer not to extend or modify `lib`, especially if you want to share reusable modules
# alternatives include: `import` a file, or put a custom library in an option or in `_module.args.<libname>`
nixosSystemAcceptsLib = (self.lib.nixosSystem {
pkgs = self.legacyPackages.${system};
lib = self.lib.extend (final: prev: {
ifThisFunctionIsMissingTheTestFails = final.id;
});
@ -64,13 +67,13 @@
})
];
}).config.system.build.toplevel;
};
});
htmlDocs = {
nixpkgsManual = jobs.manual;
nixpkgsManual = builtins.mapAttrs (_: jobSet: jobSet.manual) jobs;
nixosManual = (import ./nixos/release-small.nix {
nixpkgs = self;
}).nixos.manual.x86_64-linux;
}).nixos.manual;
};
# The "legacy" in `legacyPackages` doesn't imply that the packages exposed

View File

@ -24,7 +24,9 @@ in
#
# https://github.com/NixOS/nixpkgs/issues/272591
#
[(import ../../pkgs/test/release {})]
[(import ../../pkgs/test/release {
inherit pkgs lib nix;
})]
;
}

View File

@ -1,4 +1,5 @@
{ supportedSystems
, system ? builtins.currentSystem
, packageSet ? (import ../..)
, scrubJobs ? true
, # Attributes passed to nixpkgs. Don't build packages marked as unfree.
@ -33,7 +34,7 @@ let
systems
;
pkgs = packageSet (recursiveUpdate { system = "x86_64-linux"; config.allowUnsupportedSystem = true; } nixpkgsArgs);
pkgs = packageSet (recursiveUpdate { inherit system; config.allowUnsupportedSystem = true; } nixpkgsArgs);
hydraJob' = if scrubJobs then hydraJob else id;

View File

@ -9,6 +9,7 @@
$ nix-build pkgs/top-level/release.nix -A coreutils.x86_64-linux
*/
{ nixpkgs ? { outPath = (import ../../lib).cleanSource ../..; revCount = 1234; shortRev = "abcdef"; revision = "0000000000000000000000000000000000000000"; }
, system ? builtins.currentSystem
, officialRelease ? false
# The platform doubles for which we build Nixpkgs.
, supportedSystems ? [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]
@ -54,7 +55,7 @@
let
release-lib = import ./release-lib.nix {
inherit supportedSystems scrubJobs nixpkgsArgs;
inherit supportedSystems scrubJobs nixpkgsArgs system;
};
inherit (release-lib) mapTestOn pkgs;