Skip to content

Commit

Permalink
pkgs/top-level: add subpackage exclusion from hydra
Browse files Browse the repository at this point in the history
  • Loading branch information
RossComputerGuy committed Dec 22, 2024
1 parent b5bf6f9 commit d260e3b
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 11 deletions.
2 changes: 2 additions & 0 deletions ci/eval/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ let
chunkSize,
checkMeta ? true,
includeBroken ? true,
includeSubpackages ? evalSystem != "aarch64-darwin" && evalSystem != "x86_64-darwin",
# Whether to just evaluate a single chunk for quick testing
quickTest ? false,
}:
Expand Down Expand Up @@ -100,6 +101,7 @@ let
--arg systems "[ \"$system\" ]" \
--arg checkMeta ${lib.boolToString checkMeta} \
--arg includeBroken ${lib.boolToString includeBroken} \
--arg includeSubpackages ${lib.boolToString includeSubpackages} \
-I ${nixpkgs} \
-I ${attrpathFile} \
> "$outputDir/result/$myChunk"
Expand Down
1 change: 1 addition & 0 deletions pkgs/stdenv/generic/check-meta.nix
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ let
broken = isMarkedBroken attrs;
unsupported = hasUnsupportedPlatform attrs;
insecure = isMarkedInsecure attrs;
hydraPlatforms = if config.allowHydra then attrs.hydraPlatforms or [] else [];

available = validity.valid != "no"
&& (if config.checkMetaRecursively or false
Expand Down
18 changes: 18 additions & 0 deletions pkgs/top-level/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,24 @@ let
'';
};

allowHydra = mkOption {
type = types.bool;
default = true;
defaultText = literalExpression ''true'';
description = ''
Whether to enable Hydra building of all packages.
'';
};

allowHydraSubpackages = mkOption {
type = types.bool;
default = false;
defaultText = literalExpression ''false'';
description = ''
Whether to enable Hydra building of all sub-nixpkgs instances.
'';
};

allowUnfree = mkOption {
type = types.bool;
default = false;
Expand Down
8 changes: 7 additions & 1 deletion pkgs/top-level/release-attrpaths-parallel.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
myChunk,
checkMeta,
includeBroken,
includeSubpackages,
systems,
}:

Expand All @@ -18,7 +19,12 @@ let

unfiltered = import ./release-outpaths.nix {
inherit path;
inherit checkMeta includeBroken systems;
inherit
checkMeta
includeBroken
includeSubpackages
systems
;
};

# Turns the unfiltered recursive attribute set into one that is limited to myAttrpaths
Expand Down
2 changes: 2 additions & 0 deletions pkgs/top-level/release-outpaths.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
{
checkMeta,
includeBroken ? true, # set this to false to exclude meta.broken packages from the output
includeSubpackages ? true, # set this to false to exclude "pkgs*"
path ? ./../..,

# used by pkgs/top-level/release-attrnames-superset.nix
Expand All @@ -28,6 +29,7 @@ let
allowAliases = false;
allowBroken = includeBroken;
allowUnfree = false;
allowHydraSubpackages = includeSubpackages;
allowInsecurePredicate = x: true;
checkMeta = checkMeta;

Expand Down
24 changes: 14 additions & 10 deletions pkgs/top-level/stage.nix
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ let
lib.optionalAttrs allowCustomOverrides
((config.packageOverrides or (super: {})) super);

nixpkgsFunSub = attrs: nixpkgsFun (attrs // {
allowHydra = config.allowHydraSubpackages;
});

# Convenience attributes for instantitating package sets. Each of
# these will instantiate a new version of allPackages. Currently the
# following package sets are provided:
Expand All @@ -192,7 +196,7 @@ let
nixpkgsFun { inherit crossSystem; })
lib.systems.examples;

pkgsLLVM = if stdenv.hostPlatform.isDarwin then self else nixpkgsFun {
pkgsLLVM = if stdenv.hostPlatform.isDarwin then self else nixpkgsFunSub {
overlays = [
(self': super': {
pkgsLLVM = super';
Expand All @@ -207,7 +211,7 @@ let
};
};

pkgsArocc = nixpkgsFun {
pkgsArocc = nixpkgsFunSub {
overlays = [
(self': super': {
pkgsArocc = super';
Expand All @@ -222,7 +226,7 @@ let
};
};

pkgsZig = nixpkgsFun {
pkgsZig = nixpkgsFunSub {
overlays = [
(self': super': {
pkgsZig = super';
Expand All @@ -240,7 +244,7 @@ let
# All packages built with the Musl libc. This will override the
# default GNU libc on Linux systems. Non-Linux systems are not
# supported. 32-bit is also not supported.
pkgsMusl = if stdenv.hostPlatform.isLinux && stdenv.buildPlatform.is64bit then nixpkgsFun {
pkgsMusl = if stdenv.hostPlatform.isLinux && stdenv.buildPlatform.is64bit then nixpkgsFunSub {
overlays = [ (self': super': {
pkgsMusl = super';
})] ++ overlays;
Expand All @@ -252,7 +256,7 @@ let

# All packages built for i686 Linux.
# Used by wine, firefox with debugging version of Flash, ...
pkgsi686Linux = if stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86 then nixpkgsFun {
pkgsi686Linux = if stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86 then nixpkgsFunSub {
overlays = [ (self': super': {
pkgsi686Linux = super';
})] ++ overlays;
Expand All @@ -265,7 +269,7 @@ let
} else throw "i686 Linux package set can only be used with the x86 family.";

# x86_64-darwin packages for aarch64-darwin users to use with Rosetta for incompatible packages
pkgsx86_64Darwin = if stdenv.hostPlatform.isDarwin then nixpkgsFun {
pkgsx86_64Darwin = if stdenv.hostPlatform.isDarwin then nixpkgsFunSub {
overlays = [ (self': super': {
pkgsx86_64Darwin = super';
})] ++ overlays;
Expand All @@ -282,7 +286,7 @@ let
pkgsLinux =
if stdenv.hostPlatform.isLinux
then self
else nixpkgsFun {
else nixpkgsFunSub {
localSystem = lib.systems.elaborate "${stdenv.hostPlatform.parsed.cpu.name}-linux";
};

Expand All @@ -292,7 +296,7 @@ let
appendOverlays = extraOverlays:
if extraOverlays == []
then self
else nixpkgsFun { overlays = args.overlays ++ extraOverlays; };
else nixpkgsFunSub { overlays = args.overlays ++ extraOverlays; };

# NOTE: each call to extend causes a full nixpkgs rebuild, adding ~130MB
# of allocations. DO NOT USE THIS IN NIXPKGS.
Expand All @@ -305,7 +309,7 @@ let

# Fully static packages.
# Currently uses Musl on Linux (couldn’t get static glibc to work).
pkgsStatic = nixpkgsFun ({
pkgsStatic = nixpkgsFunSub ({
overlays = [ (self': super': {
pkgsStatic = super';
})] ++ overlays;
Expand All @@ -321,7 +325,7 @@ let
};
});

pkgsExtraHardening = nixpkgsFun {
pkgsExtraHardening = nixpkgsFunSub {
overlays = [
(self': super': {
pkgsExtraHardening = super';
Expand Down

0 comments on commit d260e3b

Please sign in to comment.