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"; };
48 { system.nixos.versionSuffix = versionSuffix;
49 system.nixos.revision = nixpkgs.rev or nixpkgs.shortRev;
52 makeModules = module: rest: [ configuration versionModule module rest ];
55 { module, type, system, ... }:
57 with import ./.. { inherit system; };
59 hydraJob ((import lib/eval-config.nix {
61 modules = makeModules module {
62 isoImage.isoBaseName = "nixos-${type}";
64 }).config.system.build.isoImage);
68 { module, system, ... }:
70 with import ./.. { inherit system; };
72 hydraJob ((import lib/eval-config.nix {
74 modules = makeModules module {};
75 }).config.system.build.sdImage);
79 { module, maintainers ? ["viric"], system }:
81 with import ./.. { inherit system; };
85 config = (import lib/eval-config.nix {
87 modules = makeModules module {};
90 tarball = config.system.build.tarball;
95 description = "NixOS system tarball for ${system} - ${stdenv.hostPlatform.linux-kernel.name}";
96 maintainers = map (x: lib.maintainers.${x}) maintainers;
102 makeClosure = module: buildFromConfig module (config: config.system.build.toplevel);
105 buildFromConfig = module: sel: forAllSystems (system: hydraJob (sel (import ./lib/eval-config.nix {
107 modules = makeModules module
109 { fileSystems."/".device = mkDefault "/dev/sda1";
110 boot.loader.grub.device = mkDefault "/dev/sda";
114 makeNetboot = { module, system, ... }:
116 configEvaled = import lib/eval-config.nix {
118 modules = makeModules module {};
120 build = configEvaled.config.system.build;
121 kernelTarget = configEvaled.pkgs.stdenv.hostPlatform.linux-kernel.target;
128 build.netbootIpxeScript
131 mkdir -p $out/nix-support
132 echo "file ${kernelTarget} ${build.kernel}/${kernelTarget}" >> $out/nix-support/hydra-build-products
133 echo "file initrd ${build.netbootRamdisk}/initrd" >> $out/nix-support/hydra-build-products
134 echo "file ipxe ${build.netbootIpxeScript}/netboot.ipxe" >> $out/nix-support/hydra-build-products
136 preferLocalBuild = true;
141 channel = import lib/make-channel.nix { inherit pkgs nixpkgs version versionSuffix; };
143 manualHTML = buildFromConfig ({ ... }: { }) (config: config.system.build.manual.manualHTML);
144 manual = manualHTML; # TODO(@oxij): remove eventually
145 manualEpub = (buildFromConfig ({ ... }: { }) (config: config.system.build.manual.manualEpub));
146 manpages = buildFromConfig ({ ... }: { }) (config: config.system.build.manual.manpages);
147 manualGeneratedSources = buildFromConfig ({ ... }: { }) (config: config.system.build.manual.generatedSources);
148 options = (buildFromConfig ({ ... }: { }) (config: config.system.build.manual.optionsJSON)).x86_64-linux;
151 # Build the initial ramdisk so Hydra can keep track of its size over time.
152 initialRamdisk = buildFromConfig ({ ... }: { }) (config: config.system.build.initialRamdisk);
154 kexec = forMatchingSystems supportedSystems (system: (import lib/eval-config.nix {
157 ./modules/installer/netboot/netboot-minimal.nix
159 }).config.system.build.kexecTree);
161 netboot = forMatchingSystems supportedSystems (system: makeNetboot {
162 module = ./modules/installer/netboot/netboot-minimal.nix;
166 iso_minimal = forAllSystems (system: makeIso {
167 module = ./modules/installer/cd-dvd/installation-cd-minimal.nix;
172 iso_plasma5 = forMatchingSystems supportedSystems (system: makeIso {
173 module = ./modules/installer/cd-dvd/installation-cd-graphical-calamares-plasma5.nix;
178 iso_gnome = forMatchingSystems supportedSystems (system: makeIso {
179 module = ./modules/installer/cd-dvd/installation-cd-graphical-calamares-gnome.nix;
184 # A variant with a more recent (but possibly less stable) kernel
185 # that might support more hardware.
186 iso_minimal_new_kernel = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system: makeIso {
187 module = ./modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix;
188 type = "minimal-new-kernel";
192 sd_image = forMatchingSystems [ "armv6l-linux" "armv7l-linux" "aarch64-linux" ] (system: makeSdImage {
194 armv6l-linux = ./modules/installer/sd-card/sd-image-raspberrypi-installer.nix;
195 armv7l-linux = ./modules/installer/sd-card/sd-image-armv7l-multiplatform-installer.nix;
196 aarch64-linux = ./modules/installer/sd-card/sd-image-aarch64-installer.nix;
201 sd_image_new_kernel = forMatchingSystems [ "aarch64-linux" ] (system: makeSdImage {
203 aarch64-linux = ./modules/installer/sd-card/sd-image-aarch64-new-kernel-installer.nix;
205 type = "minimal-new-kernel";
209 # A bootable VirtualBox virtual appliance as an OVA file (i.e. packaged OVF).
210 ova = forMatchingSystems [ "x86_64-linux" ] (system:
212 with import ./.. { inherit system; };
214 hydraJob ((import lib/eval-config.nix {
218 ./modules/installer/virtualbox-demo.nix
220 }).config.system.build.virtualBoxOVA)
224 # KVM image for proxmox in VMA format
225 proxmoxImage = forMatchingSystems [ "x86_64-linux" ] (system:
226 with import ./.. { inherit system; };
228 hydraJob ((import lib/eval-config.nix {
231 ./modules/virtualisation/proxmox-image.nix
233 }).config.system.build.VMA)
236 # LXC tarball for proxmox
237 proxmoxLXC = forMatchingSystems [ "x86_64-linux" ] (system:
238 with import ./.. { inherit system; };
240 hydraJob ((import lib/eval-config.nix {
243 ./modules/virtualisation/proxmox-lxc.nix
245 }).config.system.build.tarball)
248 # A disk image that can be imported to Amazon EC2 and registered as an AMI
249 amazonImage = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
251 with import ./.. { inherit system; };
253 hydraJob ((import lib/eval-config.nix {
258 ./maintainers/scripts/ec2/amazon-image.nix
260 }).config.system.build.amazonImage)
263 amazonImageZfs = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
265 with import ./.. { inherit system; };
267 hydraJob ((import lib/eval-config.nix {
272 ./maintainers/scripts/ec2/amazon-image-zfs.nix
274 }).config.system.build.amazonImage)
279 # Test job for https://github.com/NixOS/nixpkgs/issues/121354 to test
280 # automatic sizing without blocking the channel.
281 amazonImageAutomaticSize = 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.nix
291 ({ ... }: { amazonImage.sizeMB = "auto"; })
293 }).config.system.build.amazonImage)
297 # An image that can be imported into lxd and used for container creation
298 lxdImage = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
300 with import ./.. { inherit system; };
302 hydraJob ((import lib/eval-config.nix {
307 ./maintainers/scripts/lxd/lxd-image.nix
309 }).config.system.build.tarball)
313 # Metadata for the lxd image
314 lxdMeta = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system:
316 with import ./.. { inherit system; };
318 hydraJob ((import lib/eval-config.nix {
323 ./maintainers/scripts/lxd/lxd-image.nix
325 }).config.system.build.metadata)
329 # Ensure that all packages used by the minimal NixOS config end up in the channel.
330 dummy = forAllSystems (system: pkgs.runCommand "dummy"
331 { toplevel = (import lib/eval-config.nix {
333 modules = singleton ({ ... }:
334 { fileSystems."/".device = mkDefault "/dev/sda1";
335 boot.loader.grub.device = mkDefault "/dev/sda";
336 system.stateVersion = mkDefault "18.03";
338 }).config.system.build.toplevel;
339 preferLocalBuild = true;
341 "mkdir $out; ln -s $toplevel $out/dummy");
344 # Provide container tarball for lxc, libvirt-lxc, docker-lxc, ...
345 containerTarball = forAllSystems (system: makeSystemTarball {
346 module = ./modules/virtualisation/lxc-container.nix;
352 /* Build a bunch of typical closures so that Hydra can keep track of
353 the evolution of closure sizes. */
357 smallContainer = makeClosure ({ ... }:
358 { boot.isContainer = true;
359 services.openssh.enable = true;
362 tinyContainer = makeClosure ({ ... }:
363 { boot.isContainer = true;
364 imports = [ modules/profiles/minimal.nix ];
367 ec2 = makeClosure ({ ... }:
368 { imports = [ modules/virtualisation/amazon-image.nix ];
371 kde = makeClosure ({ ... }:
372 { services.xserver.enable = true;
373 services.xserver.displayManager.sddm.enable = true;
374 services.xserver.desktopManager.plasma5.enable = true;
377 xfce = makeClosure ({ ... }:
378 { services.xserver.enable = true;
379 services.xserver.desktopManager.xfce.enable = true;
382 gnome = makeClosure ({ ... }:
383 { services.xserver.enable = true;
384 services.xserver.displayManager.gdm.enable = true;
385 services.xserver.desktopManager.gnome.enable = true;
388 pantheon = makeClosure ({ ... }:
389 { services.xserver.enable = true;
390 services.xserver.desktopManager.pantheon.enable = true;
393 # Linux/Apache/PostgreSQL/PHP stack.
394 lapp = makeClosure ({ pkgs, ... }:
395 { services.httpd.enable = true;
396 services.httpd.adminAddr = "foo@example.org";
397 services.httpd.enablePHP = true;
398 services.postgresql.enable = true;
399 services.postgresql.package = pkgs.postgresql;