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.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_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 lxd and used for container creation
322 lxdContainerImage = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
324 with import ./.. { inherit system; };
326 hydraJob ((import lib/eval-config.nix {
331 ./maintainers/scripts/lxd/lxd-container-image.nix
333 }).config.system.build.tarball)
337 lxdContainerImageSquashfs = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
339 with import ./.. { inherit system; };
341 hydraJob ((import lib/eval-config.nix {
346 ./maintainers/scripts/lxd/lxd-container-image.nix
348 }).config.system.build.squashfs)
352 # Metadata for the lxd image
353 lxdContainerMeta = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
355 with import ./.. { inherit system; };
357 hydraJob ((import lib/eval-config.nix {
362 ./maintainers/scripts/lxd/lxd-container-image.nix
364 }).config.system.build.metadata)
368 # An image that can be imported into lxd and used for container creation
369 lxdVirtualMachineImage = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
371 with import ./.. { inherit system; };
373 hydraJob ((import lib/eval-config.nix {
378 ./maintainers/scripts/lxd/lxd-virtual-machine-image.nix
380 }).config.system.build.qemuImage)
384 # Metadata for the lxd image
385 lxdVirtualMachineImageMeta = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
387 with import ./.. { inherit system; };
389 hydraJob ((import lib/eval-config.nix {
394 ./maintainers/scripts/lxd/lxd-virtual-machine-image.nix
396 }).config.system.build.metadata)
400 # Ensure that all packages used by the minimal NixOS config end up in the channel.
401 dummy = forAllSystems (system: pkgs.runCommand "dummy"
402 { toplevel = (import lib/eval-config.nix {
404 modules = singleton ({ ... }:
405 { fileSystems."/".device = mkDefault "/dev/sda1";
406 boot.loader.grub.device = mkDefault "/dev/sda";
407 system.stateVersion = mkDefault lib.trivial.release;
409 }).config.system.build.toplevel;
410 preferLocalBuild = true;
412 "mkdir $out; ln -s $toplevel $out/dummy");
415 # Provide container tarball for lxc, libvirt-lxc, docker-lxc, ...
416 containerTarball = forAllSystems (system: makeSystemTarball {
417 module = ./modules/virtualisation/lxc-container.nix;
423 /* Build a bunch of typical closures so that Hydra can keep track of
424 the evolution of closure sizes. */
428 smallContainer = makeClosure ({ ... }:
429 { boot.isContainer = true;
430 services.openssh.enable = true;
433 tinyContainer = makeClosure ({ ... }:
434 { boot.isContainer = true;
435 imports = [ modules/profiles/minimal.nix ];
438 ec2 = makeClosure ({ ... }:
439 { imports = [ modules/virtualisation/amazon-image.nix ];
442 kde = makeClosure ({ ... }:
443 { services.xserver.enable = true;
444 services.displayManager.sddm.enable = true;
445 services.xserver.desktopManager.plasma5.enable = true;
448 xfce = makeClosure ({ ... }:
449 { services.xserver.enable = true;
450 services.xserver.desktopManager.xfce.enable = true;
453 gnome = makeClosure ({ ... }:
454 { services.xserver.enable = true;
455 services.xserver.displayManager.gdm.enable = true;
456 services.xserver.desktopManager.gnome.enable = true;
459 pantheon = makeClosure ({ ... }:
460 { services.xserver.enable = true;
461 services.xserver.desktopManager.pantheon.enable = true;
464 deepin = makeClosure ({ ... }:
465 { services.xserver.enable = true;
466 services.xserver.displayManager.lightdm.enable = true;
467 services.xserver.desktopManager.deepin.enable = true;
470 # Linux/Apache/PostgreSQL/PHP stack.
471 lapp = makeClosure ({ pkgs, ... }:
472 { services.httpd.enable = true;
473 services.httpd.adminAddr = "foo@example.org";
474 services.httpd.enablePHP = true;
475 services.postgresql.enable = true;
476 services.postgresql.package = pkgs.postgresql;