Merge pull request #33749 from dezgeg/release-refactor-1
nixos/release.nix: Refactoring for better multi-system support
This commit is contained in:
commit
4dff3ee959
@ -3,6 +3,7 @@
|
|||||||
, supportedSystems ? [ "x86_64-linux" "aarch64-linux" ]
|
, supportedSystems ? [ "x86_64-linux" "aarch64-linux" ]
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
with import ../pkgs/top-level/release-lib.nix { inherit supportedSystems; };
|
||||||
with import ../lib;
|
with import ../lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
@ -11,8 +12,6 @@ let
|
|||||||
versionSuffix =
|
versionSuffix =
|
||||||
(if stableBranch then "." else "pre") + "${toString nixpkgs.revCount}.${nixpkgs.shortRev}";
|
(if stableBranch then "." else "pre") + "${toString nixpkgs.revCount}.${nixpkgs.shortRev}";
|
||||||
|
|
||||||
forAllSystems = genAttrs supportedSystems;
|
|
||||||
|
|
||||||
importTest = fn: args: system: import fn ({
|
importTest = fn: args: system: import fn ({
|
||||||
inherit system;
|
inherit system;
|
||||||
} // args);
|
} // args);
|
||||||
@ -124,22 +123,13 @@ in rec {
|
|||||||
# Build the initial ramdisk so Hydra can keep track of its size over time.
|
# Build the initial ramdisk so Hydra can keep track of its size over time.
|
||||||
initialRamdisk = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.initialRamdisk);
|
initialRamdisk = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.initialRamdisk);
|
||||||
|
|
||||||
netboot = {
|
netboot = forTheseSystems [ "x86_64-linux" "aarch64-linux" ] (system: makeNetboot {
|
||||||
x86_64-linux = makeNetboot {
|
inherit system;
|
||||||
system = "x86_64-linux";
|
modules = [
|
||||||
modules = [
|
./modules/installer/netboot/netboot-minimal.nix
|
||||||
./modules/installer/netboot/netboot-minimal.nix
|
versionModule
|
||||||
versionModule
|
];
|
||||||
];
|
});
|
||||||
};
|
|
||||||
} // (optionalAttrs (elem "aarch64-linux" supportedSystems) {
|
|
||||||
aarch64-linux = makeNetboot {
|
|
||||||
system = "aarch64-linux";
|
|
||||||
modules = [
|
|
||||||
./modules/installer/netboot/netboot-minimal.nix
|
|
||||||
versionModule
|
|
||||||
];
|
|
||||||
};});
|
|
||||||
|
|
||||||
iso_minimal = forAllSystems (system: makeIso {
|
iso_minimal = forAllSystems (system: makeIso {
|
||||||
module = ./modules/installer/cd-dvd/installation-cd-minimal.nix;
|
module = ./modules/installer/cd-dvd/installation-cd-minimal.nix;
|
||||||
@ -147,7 +137,7 @@ in rec {
|
|||||||
inherit system;
|
inherit system;
|
||||||
});
|
});
|
||||||
|
|
||||||
iso_graphical = genAttrs [ "x86_64-linux" ] (system: makeIso {
|
iso_graphical = forTheseSystems [ "x86_64-linux" ] (system: makeIso {
|
||||||
module = ./modules/installer/cd-dvd/installation-cd-graphical-kde.nix;
|
module = ./modules/installer/cd-dvd/installation-cd-graphical-kde.nix;
|
||||||
type = "graphical";
|
type = "graphical";
|
||||||
inherit system;
|
inherit system;
|
||||||
@ -155,7 +145,7 @@ in rec {
|
|||||||
|
|
||||||
# A variant with a more recent (but possibly less stable) kernel
|
# A variant with a more recent (but possibly less stable) kernel
|
||||||
# that might support more hardware.
|
# that might support more hardware.
|
||||||
iso_minimal_new_kernel = genAttrs [ "x86_64-linux" ] (system: makeIso {
|
iso_minimal_new_kernel = forTheseSystems [ "x86_64-linux" ] (system: makeIso {
|
||||||
module = ./modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix;
|
module = ./modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix;
|
||||||
type = "minimal-new-kernel";
|
type = "minimal-new-kernel";
|
||||||
inherit system;
|
inherit system;
|
||||||
@ -163,7 +153,7 @@ in rec {
|
|||||||
|
|
||||||
|
|
||||||
# A bootable VirtualBox virtual appliance as an OVA file (i.e. packaged OVF).
|
# A bootable VirtualBox virtual appliance as an OVA file (i.e. packaged OVF).
|
||||||
ova = genAttrs [ "x86_64-linux" ] (system:
|
ova = forTheseSystems [ "x86_64-linux" ] (system:
|
||||||
|
|
||||||
with import nixpkgs { inherit system; };
|
with import nixpkgs { inherit system; };
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ in
|
|||||||
f (["buildPackages"] ++ path) { inherit system crossSystem; }
|
f (["buildPackages"] ++ path) { inherit system crossSystem; }
|
||||||
);
|
);
|
||||||
|
|
||||||
testEqual = path: systems: forAllSupportedSystems systems (testEqualOne path);
|
testEqual = path: systems: forTheseSystems systems (testEqualOne path);
|
||||||
|
|
||||||
mapTestEqual = lib.mapAttrsRecursive testEqual;
|
mapTestEqual = lib.mapAttrsRecursive testEqual;
|
||||||
|
|
||||||
|
@ -58,7 +58,8 @@ rec {
|
|||||||
interested in the result of cross building a package. */
|
interested in the result of cross building a package. */
|
||||||
crossMaintainers = [ maintainers.viric ];
|
crossMaintainers = [ maintainers.viric ];
|
||||||
|
|
||||||
forAllSupportedSystems = systems: f:
|
forAllSystems = genAttrs supportedSystems;
|
||||||
|
forTheseSystems = systems: f:
|
||||||
genAttrs (filter (x: elem x supportedSystems) systems) f;
|
genAttrs (filter (x: elem x supportedSystems) systems) f;
|
||||||
|
|
||||||
/* Build a package on the given set of platforms. The function `f'
|
/* Build a package on the given set of platforms. The function `f'
|
||||||
@ -66,14 +67,14 @@ rec {
|
|||||||
platform as an argument . We return an attribute set containing
|
platform as an argument . We return an attribute set containing
|
||||||
a derivation for each supported platform, i.e. ‘{ x86_64-linux =
|
a derivation for each supported platform, i.e. ‘{ x86_64-linux =
|
||||||
f pkgs_x86_64_linux; i686-linux = f pkgs_i686_linux; ... }’. */
|
f pkgs_x86_64_linux; i686-linux = f pkgs_i686_linux; ... }’. */
|
||||||
testOn = systems: f: forAllSupportedSystems systems
|
testOn = systems: f: forTheseSystems systems
|
||||||
(system: hydraJob' (f (pkgsFor system)));
|
(system: hydraJob' (f (pkgsFor system)));
|
||||||
|
|
||||||
|
|
||||||
/* Similar to the testOn function, but with an additional
|
/* Similar to the testOn function, but with an additional
|
||||||
'crossSystem' parameter for allPackages, defining the target
|
'crossSystem' parameter for allPackages, defining the target
|
||||||
platform for cross builds. */
|
platform for cross builds. */
|
||||||
testOnCross = crossSystem: systems: f: forAllSupportedSystems systems
|
testOnCross = crossSystem: systems: f: forTheseSystems systems
|
||||||
(system: hydraJob' (f (allPackages { inherit system crossSystem; })));
|
(system: hydraJob' (f (allPackages { inherit system crossSystem; })));
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user