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 "beta") + "${toString (nixpkgs.revCount - 551362)}.${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.version;
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_gnome = forMatchingSystems supportedSystems (system: makeIso {
181 module = ./modules/installer/cd-dvd/installation-cd-graphical-calamares-gnome.nix;
186 # A variant with a more recent (but possibly less stable) kernel that might support more hardware.
187 # This variant keeps zfs support enabled, hoping it will build and work.
188 iso_minimal_new_kernel = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system: makeIso {
189 module = ./modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix;
190 type = "minimal-new-kernel";
194 # A variant with a more recent (but possibly less stable) kernel that might support more hardware.
195 # ZFS support disabled since it is unlikely to support the latest kernel.
196 iso_minimal_new_kernel_no_zfs = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system: makeIso {
197 module = ./modules/installer/cd-dvd/installation-cd-minimal-new-kernel-no-zfs.nix;
198 type = "minimal-new-kernel-no-zfs";
202 sd_image = forMatchingSystems [ "armv6l-linux" "armv7l-linux" "aarch64-linux" ] (system: makeSdImage {
204 armv6l-linux = ./modules/installer/sd-card/sd-image-raspberrypi-installer.nix;
205 armv7l-linux = ./modules/installer/sd-card/sd-image-armv7l-multiplatform-installer.nix;
206 aarch64-linux = ./modules/installer/sd-card/sd-image-aarch64-installer.nix;
211 sd_image_new_kernel = forMatchingSystems [ "aarch64-linux" ] (system: makeSdImage {
213 aarch64-linux = ./modules/installer/sd-card/sd-image-aarch64-new-kernel-installer.nix;
215 type = "minimal-new-kernel";
219 sd_image_new_kernel_no_zfs = forMatchingSystems [ "aarch64-linux" ] (system: makeSdImage {
221 aarch64-linux = ./modules/installer/sd-card/sd-image-aarch64-new-kernel-no-zfs-installer.nix;
223 type = "minimal-new-kernel-no-zfs";
227 # A bootable VirtualBox virtual appliance as an OVA file (i.e. packaged OVF).
228 ova = forMatchingSystems [ "x86_64-linux" ] (system:
230 with import ./.. { inherit system; };
232 hydraJob ((import lib/eval-config.nix {
236 ./modules/installer/virtualbox-demo.nix
238 }).config.system.build.virtualBoxOVA)
242 # KVM image for proxmox in VMA format
243 proxmoxImage = forMatchingSystems [ "x86_64-linux" ] (system:
244 with import ./.. { inherit system; };
246 hydraJob ((import lib/eval-config.nix {
249 ./modules/virtualisation/proxmox-image.nix
251 }).config.system.build.VMA)
254 # LXC tarball for proxmox
255 proxmoxLXC = forMatchingSystems [ "x86_64-linux" ] (system:
256 with import ./.. { inherit system; };
258 hydraJob ((import lib/eval-config.nix {
261 ./modules/virtualisation/proxmox-lxc.nix
263 }).config.system.build.tarball)
266 # A disk image that can be imported to Amazon EC2 and registered as an AMI
267 amazonImage = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
269 with import ./.. { inherit system; };
271 hydraJob ((import lib/eval-config.nix {
276 ./maintainers/scripts/ec2/amazon-image.nix
278 }).config.system.build.amazonImage)
281 amazonImageZfs = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
283 with import ./.. { inherit system; };
285 hydraJob ((import lib/eval-config.nix {
290 ./maintainers/scripts/ec2/amazon-image-zfs.nix
292 }).config.system.build.amazonImage)
297 # Test job for https://github.com/NixOS/nixpkgs/issues/121354 to test
298 # automatic sizing without blocking the channel.
299 amazonImageAutomaticSize = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
301 with import ./.. { inherit system; };
303 hydraJob ((import lib/eval-config.nix {
308 ./maintainers/scripts/ec2/amazon-image.nix
309 ({ ... }: { amazonImage.sizeMB = "auto"; })
311 }).config.system.build.amazonImage)
315 # An image that can be imported into lxd and used for container creation
316 lxdContainerImage = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
318 with import ./.. { inherit system; };
320 hydraJob ((import lib/eval-config.nix {
325 ./maintainers/scripts/lxd/lxd-container-image.nix
327 }).config.system.build.tarball)
331 lxdContainerImageSquashfs = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
333 with import ./.. { inherit system; };
335 hydraJob ((import lib/eval-config.nix {
340 ./maintainers/scripts/lxd/lxd-container-image.nix
342 }).config.system.build.squashfs)
346 # Metadata for the lxd image
347 lxdContainerMeta = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
349 with import ./.. { inherit system; };
351 hydraJob ((import lib/eval-config.nix {
356 ./maintainers/scripts/lxd/lxd-container-image.nix
358 }).config.system.build.metadata)
362 # An image that can be imported into lxd and used for container creation
363 lxdVirtualMachineImage = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
365 with import ./.. { inherit system; };
367 hydraJob ((import lib/eval-config.nix {
372 ./maintainers/scripts/lxd/lxd-virtual-machine-image.nix
374 }).config.system.build.qemuImage)
378 # Metadata for the lxd image
379 lxdVirtualMachineImageMeta = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
381 with import ./.. { inherit system; };
383 hydraJob ((import lib/eval-config.nix {
388 ./maintainers/scripts/lxd/lxd-virtual-machine-image.nix
390 }).config.system.build.metadata)
394 # Ensure that all packages used by the minimal NixOS config end up in the channel.
395 dummy = forAllSystems (system: pkgs.runCommand "dummy"
396 { toplevel = (import lib/eval-config.nix {
398 modules = singleton ({ ... }:
399 { fileSystems."/".device = mkDefault "/dev/sda1";
400 boot.loader.grub.device = mkDefault "/dev/sda";
401 system.stateVersion = mkDefault lib.trivial.release;
403 }).config.system.build.toplevel;
404 preferLocalBuild = true;
406 "mkdir $out; ln -s $toplevel $out/dummy");
409 # Provide container tarball for lxc, libvirt-lxc, docker-lxc, ...
410 containerTarball = forAllSystems (system: makeSystemTarball {
411 module = ./modules/virtualisation/lxc-container.nix;
417 /* Build a bunch of typical closures so that Hydra can keep track of
418 the evolution of closure sizes. */
422 smallContainer = makeClosure ({ ... }:
423 { boot.isContainer = true;
424 services.openssh.enable = true;
427 tinyContainer = makeClosure ({ ... }:
428 { boot.isContainer = true;
429 imports = [ modules/profiles/minimal.nix ];
432 ec2 = makeClosure ({ ... }:
433 { imports = [ modules/virtualisation/amazon-image.nix ];
436 kde = makeClosure ({ ... }:
437 { services.xserver.enable = true;
438 services.xserver.displayManager.sddm.enable = true;
439 services.xserver.desktopManager.plasma5.enable = true;
442 xfce = makeClosure ({ ... }:
443 { services.xserver.enable = true;
444 services.xserver.desktopManager.xfce.enable = true;
447 gnome = makeClosure ({ ... }:
448 { services.xserver.enable = true;
449 services.xserver.displayManager.gdm.enable = true;
450 services.xserver.desktopManager.gnome.enable = true;
453 pantheon = makeClosure ({ ... }:
454 { services.xserver.enable = true;
455 services.xserver.desktopManager.pantheon.enable = true;
458 deepin = makeClosure ({ ... }:
459 { services.xserver.enable = true;
460 services.xserver.displayManager.lightdm.enable = true;
461 services.xserver.desktopManager.deepin.enable = true;
464 # Linux/Apache/PostgreSQL/PHP stack.
465 lapp = makeClosure ({ pkgs, ... }:
466 { services.httpd.enable = true;
467 services.httpd.adminAddr = "foo@example.org";
468 services.httpd.enablePHP = true;
469 services.postgresql.enable = true;
470 services.postgresql.package = pkgs.postgresql;