3 { nixpkgs ? { outPath = cleanSource ./..; revCount = 130979; shortRev = "gfedcba"; }
5 , supportedSystems ? [ "x86_64-linux" "aarch64-linux" ]
9 with import ../pkgs/top-level/release-lib.nix { inherit supportedSystems; };
13 version = fileContents ../.version;
15 (if stableBranch then "." else "pre") + "${toString nixpkgs.revCount}.${nixpkgs.shortRev}";
17 # Run the tests for each platform. You can run a test by doing
18 # e.g. ‘nix-build release.nix -A tests.login.x86_64-linux’,
19 # or equivalently, ‘nix-build tests/login.nix’.
20 # See also nixosTests in pkgs/top-level/all-packages.nix
21 allTestsForSystem = system:
22 import ./tests/all-tests.nix {
24 pkgs = import ./.. { inherit system; };
26 ${system} = hydraJob config.test;
29 # for typechecking of the scripts and evaluation of
30 # the nodes, without running VMs.
32 import ./tests/all-tests.nix {
34 pkgs = import ./.. { inherit system; };
36 ${system} = hydraJob config.driver;
42 foldAttrs recursiveUpdate {} (map allTestsForSystem supportedSystems);
44 pkgs = import ./.. { system = "x86_64-linux"; };
47 versionModule = { config, ... }: {
48 system.nixos.versionSuffix = versionSuffix;
49 system.nixos.revision = nixpkgs.rev or nixpkgs.shortRev;
51 # At creation time we do not have state yet, so just default to latest.
52 system.stateVersion = config.system.nixos.release;
55 makeModules = module: rest: [ configuration versionModule module rest ];
58 { module, type, system, ... }:
60 with import ./.. { inherit system; };
62 hydraJob ((import lib/eval-config.nix {
64 modules = makeModules module {
65 isoImage.isoBaseName = "nixos-${type}";
67 }).config.system.build.isoImage);
71 { module, system, ... }:
73 with import ./.. { inherit system; };
75 hydraJob ((import lib/eval-config.nix {
77 modules = makeModules module {};
78 }).config.system.build.sdImage);
82 { module, maintainers ? ["viric"], system }:
84 with import ./.. { inherit system; };
88 config = (import lib/eval-config.nix {
90 modules = makeModules module {};
93 tarball = config.system.build.tarball;
98 description = "NixOS system tarball for ${system} - ${stdenv.hostPlatform.linux-kernel.name}";
99 maintainers = map (x: lib.maintainers.${x}) maintainers;
105 makeClosure = module: buildFromConfig module (config: config.system.build.toplevel);
108 buildFromConfig = module: sel: forAllSystems (system: hydraJob (sel (import ./lib/eval-config.nix {
110 modules = makeModules module
112 { fileSystems."/".device = mkDefault "/dev/sda1";
113 boot.loader.grub.device = mkDefault "/dev/sda";
117 makeNetboot = { module, system, ... }:
119 configEvaled = import lib/eval-config.nix {
121 modules = makeModules module {};
123 build = configEvaled.config.system.build;
124 kernelTarget = configEvaled.pkgs.stdenv.hostPlatform.linux-kernel.target;
126 configEvaled.pkgs.symlinkJoin {
131 build.netbootIpxeScript
134 mkdir -p $out/nix-support
135 echo "file ${kernelTarget} ${build.kernel}/${kernelTarget}" >> $out/nix-support/hydra-build-products
136 echo "file initrd ${build.netbootRamdisk}/initrd" >> $out/nix-support/hydra-build-products
137 echo "file ipxe ${build.netbootIpxeScript}/netboot.ipxe" >> $out/nix-support/hydra-build-products
139 preferLocalBuild = true;
144 channel = import lib/make-channel.nix { inherit pkgs nixpkgs version versionSuffix; };
146 manualHTML = buildFromConfig ({ ... }: { }) (config: config.system.build.manual.manualHTML);
147 manual = manualHTML; # TODO(@oxij): remove eventually
148 manualEpub = (buildFromConfig ({ ... }: { }) (config: config.system.build.manual.manualEpub));
149 nixos-configuration-reference-manpage = buildFromConfig ({ ... }: { }) (config: config.system.build.manual.nixos-configuration-reference-manpage);
150 options = (buildFromConfig ({ ... }: { }) (config: config.system.build.manual.optionsJSON)).x86_64-linux;
153 # Build the initial ramdisk so Hydra can keep track of its size over time.
154 initialRamdisk = buildFromConfig ({ ... }: { }) (config: config.system.build.initialRamdisk);
156 kexec = forMatchingSystems supportedSystems (system: (import lib/eval-config.nix {
159 ./modules/installer/netboot/netboot-minimal.nix
161 }).config.system.build.kexecTree);
163 netboot = forMatchingSystems supportedSystems (system: makeNetboot {
164 module = ./modules/installer/netboot/netboot-minimal.nix;
168 iso_minimal = forAllSystems (system: makeIso {
169 module = ./modules/installer/cd-dvd/installation-cd-minimal.nix;
174 iso_plasma5 = forMatchingSystems supportedSystems (system: makeIso {
175 module = ./modules/installer/cd-dvd/installation-cd-graphical-calamares-plasma5.nix;
180 iso_plasma6 = forMatchingSystems supportedSystems (system: makeIso {
181 module = ./modules/installer/cd-dvd/installation-cd-graphical-calamares-plasma6.nix;
186 iso_gnome = forMatchingSystems supportedSystems (system: makeIso {
187 module = ./modules/installer/cd-dvd/installation-cd-graphical-calamares-gnome.nix;
192 # A variant with a more recent (but possibly less stable) kernel that might support more hardware.
193 # This variant keeps zfs support enabled, hoping it will build and work.
194 iso_minimal_new_kernel = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system: makeIso {
195 module = ./modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix;
196 type = "minimal-new-kernel";
200 # A variant with a more recent (but possibly less stable) kernel that might support more hardware.
201 # ZFS support disabled since it is unlikely to support the latest kernel.
202 iso_minimal_new_kernel_no_zfs = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system: makeIso {
203 module = ./modules/installer/cd-dvd/installation-cd-minimal-new-kernel-no-zfs.nix;
204 type = "minimal-new-kernel-no-zfs";
208 sd_image = forMatchingSystems [ "armv6l-linux" "armv7l-linux" "aarch64-linux" ] (system: makeSdImage {
210 armv6l-linux = ./modules/installer/sd-card/sd-image-raspberrypi-installer.nix;
211 armv7l-linux = ./modules/installer/sd-card/sd-image-armv7l-multiplatform-installer.nix;
212 aarch64-linux = ./modules/installer/sd-card/sd-image-aarch64-installer.nix;
217 sd_image_new_kernel = forMatchingSystems [ "aarch64-linux" ] (system: makeSdImage {
219 aarch64-linux = ./modules/installer/sd-card/sd-image-aarch64-new-kernel-installer.nix;
221 type = "minimal-new-kernel";
225 sd_image_new_kernel_no_zfs = forMatchingSystems [ "aarch64-linux" ] (system: makeSdImage {
227 aarch64-linux = ./modules/installer/sd-card/sd-image-aarch64-new-kernel-no-zfs-installer.nix;
229 type = "minimal-new-kernel-no-zfs";
233 # A bootable VirtualBox virtual appliance as an OVA file (i.e. packaged OVF).
234 ova = forMatchingSystems [ "x86_64-linux" ] (system:
236 with import ./.. { inherit system; };
238 hydraJob ((import lib/eval-config.nix {
242 ./modules/installer/virtualbox-demo.nix
244 }).config.system.build.virtualBoxOVA)
248 # KVM image for proxmox in VMA format
249 proxmoxImage = forMatchingSystems [ "x86_64-linux" ] (system:
250 with import ./.. { inherit system; };
252 hydraJob ((import lib/eval-config.nix {
255 ./modules/virtualisation/proxmox-image.nix
257 }).config.system.build.VMA)
260 # LXC tarball for proxmox
261 proxmoxLXC = forMatchingSystems [ "x86_64-linux" ] (system:
262 with import ./.. { inherit system; };
264 hydraJob ((import lib/eval-config.nix {
267 ./modules/virtualisation/proxmox-lxc.nix
269 }).config.system.build.tarball)
272 # A disk image that can be imported to Amazon EC2 and registered as an AMI
273 amazonImage = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
275 with import ./.. { inherit system; };
277 hydraJob ((import lib/eval-config.nix {
282 ./maintainers/scripts/ec2/amazon-image.nix
284 }).config.system.build.amazonImage)
287 amazonImageZfs = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
289 with import ./.. { inherit system; };
291 hydraJob ((import lib/eval-config.nix {
296 ./maintainers/scripts/ec2/amazon-image-zfs.nix
298 }).config.system.build.amazonImage)
303 # Test job for https://github.com/NixOS/nixpkgs/issues/121354 to test
304 # automatic sizing without blocking the channel.
305 amazonImageAutomaticSize = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
307 with import ./.. { inherit system; };
309 hydraJob ((import lib/eval-config.nix {
314 ./maintainers/scripts/ec2/amazon-image.nix
315 ({ ... }: { amazonImage.sizeMB = "auto"; })
317 }).config.system.build.amazonImage)
321 # An image that can be imported into incus and used for container creation
322 incusContainerImage =
330 with import ./.. { inherit system; };
333 (import lib/eval-config.nix {
338 ./maintainers/scripts/incus/incus-container-image.nix
340 }).config.system.build.squashfs
344 # Metadata for the incus image
354 with import ./.. { inherit system; };
357 (import lib/eval-config.nix {
362 ./maintainers/scripts/incus/incus-container-image.nix
364 }).config.system.build.metadata
368 # An image that can be imported into incus and used for container creation
369 incusVirtualMachineImage =
378 with import ./.. { inherit system; };
381 (import lib/eval-config.nix {
386 ./maintainers/scripts/incus/incus-virtual-machine-image.nix
388 }).config.system.build.qemuImage
392 # Metadata for the incus image
393 incusVirtualMachineImageMeta =
402 with import ./.. { inherit system; };
405 (import lib/eval-config.nix {
410 ./maintainers/scripts/incus/incus-virtual-machine-image.nix
412 }).config.system.build.metadata
416 # An image that can be imported into lxd and used for container creation
417 lxdContainerImage = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
419 with import ./.. { inherit system; };
421 hydraJob ((import lib/eval-config.nix {
426 ./maintainers/scripts/lxd/lxd-container-image.nix
428 }).config.system.build.tarball)
432 lxdContainerImageSquashfs = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
434 with import ./.. { inherit system; };
436 hydraJob ((import lib/eval-config.nix {
441 ./maintainers/scripts/lxd/lxd-container-image.nix
443 }).config.system.build.squashfs)
447 # Metadata for the lxd image
448 lxdContainerMeta = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
450 with import ./.. { inherit system; };
452 hydraJob ((import lib/eval-config.nix {
457 ./maintainers/scripts/lxd/lxd-container-image.nix
459 }).config.system.build.metadata)
463 # An image that can be imported into lxd and used for container creation
464 lxdVirtualMachineImage = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
466 with import ./.. { inherit system; };
468 hydraJob ((import lib/eval-config.nix {
473 ./maintainers/scripts/lxd/lxd-virtual-machine-image.nix
475 }).config.system.build.qemuImage)
479 # Metadata for the lxd image
480 lxdVirtualMachineImageMeta = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
482 with import ./.. { inherit system; };
484 hydraJob ((import lib/eval-config.nix {
489 ./maintainers/scripts/lxd/lxd-virtual-machine-image.nix
491 }).config.system.build.metadata)
495 # Ensure that all packages used by the minimal NixOS config end up in the channel.
496 dummy = forAllSystems (system: pkgs.runCommand "dummy"
497 { toplevel = (import lib/eval-config.nix {
499 modules = singleton ({ ... }:
500 { fileSystems."/".device = mkDefault "/dev/sda1";
501 boot.loader.grub.device = mkDefault "/dev/sda";
502 system.stateVersion = mkDefault lib.trivial.release;
504 }).config.system.build.toplevel;
505 preferLocalBuild = true;
507 "mkdir $out; ln -s $toplevel $out/dummy");
510 # Provide container tarball for lxc, libvirt-lxc, docker-lxc, ...
511 containerTarball = forAllSystems (system: makeSystemTarball {
512 module = ./modules/virtualisation/lxc-container.nix;
518 /* Build a bunch of typical closures so that Hydra can keep track of
519 the evolution of closure sizes. */
523 smallContainer = makeClosure ({ ... }:
524 { boot.isContainer = true;
525 services.openssh.enable = true;
528 tinyContainer = makeClosure ({ ... }:
529 { boot.isContainer = true;
530 imports = [ modules/profiles/minimal.nix ];
533 ec2 = makeClosure ({ ... }:
534 { imports = [ modules/virtualisation/amazon-image.nix ];
537 kde = makeClosure ({ ... }:
538 { services.xserver.enable = true;
539 services.displayManager.sddm.enable = true;
540 services.xserver.desktopManager.plasma5.enable = true;
543 xfce = makeClosure ({ ... }:
544 { services.xserver.enable = true;
545 services.xserver.desktopManager.xfce.enable = true;
548 gnome = makeClosure ({ ... }:
549 { services.xserver.enable = true;
550 services.xserver.displayManager.gdm.enable = true;
551 services.xserver.desktopManager.gnome.enable = true;
554 pantheon = makeClosure ({ ... }:
555 { services.xserver.enable = true;
556 services.xserver.desktopManager.pantheon.enable = true;
559 deepin = makeClosure ({ ... }:
560 { services.xserver.enable = true;
561 services.xserver.displayManager.lightdm.enable = true;
562 services.xserver.desktopManager.deepin.enable = true;
565 # Linux/Apache/PostgreSQL/PHP stack.
566 lapp = makeClosure ({ pkgs, ... }:
567 { services.httpd.enable = true;
568 services.httpd.adminAddr = "foo@example.org";
569 services.httpd.enablePHP = true;
570 services.postgresql.enable = true;
571 services.postgresql.package = pkgs.postgresql;