at 18.09-beta 20 kB view raw
1{ nixpkgs ? { outPath = (import ../lib).cleanSource ./..; revCount = 130979; shortRev = "gfedcba"; } 2, stableBranch ? false 3, supportedSystems ? [ "x86_64-linux" "aarch64-linux" ] 4}: 5 6with import ../pkgs/top-level/release-lib.nix { inherit supportedSystems; }; 7with import ../lib; 8 9let 10 11 version = fileContents ../.version; 12 versionSuffix = 13 (if stableBranch then "." else "pre") + "${toString nixpkgs.revCount}.${nixpkgs.shortRev}"; 14 15 importTest = fn: args: system: import fn ({ 16 inherit system; 17 } // args); 18 19 # Note: only supportedSystems are considered. 20 callTestOnMatchingSystems = systems: fn: args: 21 forMatchingSystems 22 (intersectLists supportedSystems systems) 23 (system: hydraJob (importTest fn args system)); 24 callTest = callTestOnMatchingSystems supportedSystems; 25 26 callSubTests = callSubTestsOnMatchingSystems supportedSystems; 27 callSubTestsOnMatchingSystems = systems: fn: args: let 28 discover = attrs: let 29 subTests = filterAttrs (const (hasAttr "test")) attrs; 30 in mapAttrs (const (t: hydraJob t.test)) subTests; 31 32 discoverForSystem = system: mapAttrs (_: test: { 33 ${system} = test; 34 }) (discover (importTest fn args system)); 35 36 in foldAttrs mergeAttrs {} (map discoverForSystem (intersectLists systems supportedSystems)); 37 38 pkgs = import nixpkgs { system = "x86_64-linux"; }; 39 40 41 versionModule = 42 { system.nixos.versionSuffix = versionSuffix; 43 system.nixos.revision = nixpkgs.rev or nixpkgs.shortRev; 44 }; 45 46 47 makeIso = 48 { module, type, system, ... }: 49 50 with import nixpkgs { inherit system; }; 51 52 hydraJob ((import lib/eval-config.nix { 53 inherit system; 54 modules = [ module versionModule { isoImage.isoBaseName = "nixos-${type}"; } ]; 55 }).config.system.build.isoImage); 56 57 58 makeSdImage = 59 { module, system, ... }: 60 61 with import nixpkgs { inherit system; }; 62 63 hydraJob ((import lib/eval-config.nix { 64 inherit system; 65 modules = [ module versionModule ]; 66 }).config.system.build.sdImage); 67 68 69 makeSystemTarball = 70 { module, maintainers ? ["viric"], system }: 71 72 with import nixpkgs { inherit system; }; 73 74 let 75 76 config = (import lib/eval-config.nix { 77 inherit system; 78 modules = [ module versionModule ]; 79 }).config; 80 81 tarball = config.system.build.tarball; 82 83 in 84 tarball // 85 { meta = { 86 description = "NixOS system tarball for ${system} - ${stdenv.hostPlatform.platform.name}"; 87 maintainers = map (x: lib.maintainers.${x}) maintainers; 88 }; 89 inherit config; 90 }; 91 92 93 makeClosure = module: buildFromConfig module (config: config.system.build.toplevel); 94 95 96 buildFromConfig = module: sel: forAllSystems (system: hydraJob (sel (import ./lib/eval-config.nix { 97 inherit system; 98 modules = [ module versionModule ] ++ singleton 99 ({ ... }: 100 { fileSystems."/".device = mkDefault "/dev/sda1"; 101 boot.loader.grub.device = mkDefault "/dev/sda"; 102 }); 103 }).config)); 104 105 makeNetboot = config: 106 let 107 configEvaled = import lib/eval-config.nix config; 108 build = configEvaled.config.system.build; 109 kernelTarget = configEvaled.pkgs.stdenv.hostPlatform.platform.kernelTarget; 110 in 111 pkgs.symlinkJoin { 112 name = "netboot"; 113 paths = [ 114 build.netbootRamdisk 115 build.kernel 116 build.netbootIpxeScript 117 ]; 118 postBuild = '' 119 mkdir -p $out/nix-support 120 echo "file ${kernelTarget} ${build.kernel}/${kernelTarget}" >> $out/nix-support/hydra-build-products 121 echo "file initrd ${build.netbootRamdisk}/initrd" >> $out/nix-support/hydra-build-products 122 echo "file ipxe ${build.netbootIpxeScript}/netboot.ipxe" >> $out/nix-support/hydra-build-products 123 ''; 124 preferLocalBuild = true; 125 }; 126 127in rec { 128 129 channel = import lib/make-channel.nix { inherit pkgs nixpkgs version versionSuffix; }; 130 131 manual = buildFromConfig ({ ... }: { }) (config: config.system.build.manual.manual); 132 manualEpub = (buildFromConfig ({ ... }: { }) (config: config.system.build.manual.manualEpub)); 133 manpages = buildFromConfig ({ ... }: { }) (config: config.system.build.manual.manpages); 134 manualGeneratedSources = buildFromConfig ({ ... }: { }) (config: config.system.build.manual.generatedSources); 135 options = (buildFromConfig ({ ... }: { }) (config: config.system.build.manual.optionsJSON)).x86_64-linux; 136 137 138 # Build the initial ramdisk so Hydra can keep track of its size over time. 139 initialRamdisk = buildFromConfig ({ ... }: { }) (config: config.system.build.initialRamdisk); 140 141 netboot = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system: makeNetboot { 142 inherit system; 143 modules = [ 144 ./modules/installer/netboot/netboot-minimal.nix 145 versionModule 146 ]; 147 }); 148 149 iso_minimal = forAllSystems (system: makeIso { 150 module = ./modules/installer/cd-dvd/installation-cd-minimal.nix; 151 type = "minimal"; 152 inherit system; 153 }); 154 155 iso_graphical = forMatchingSystems [ "x86_64-linux" ] (system: makeIso { 156 module = ./modules/installer/cd-dvd/installation-cd-graphical-kde.nix; 157 type = "graphical"; 158 inherit system; 159 }); 160 161 # A variant with a more recent (but possibly less stable) kernel 162 # that might support more hardware. 163 iso_minimal_new_kernel = forMatchingSystems [ "x86_64-linux" ] (system: makeIso { 164 module = ./modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix; 165 type = "minimal-new-kernel"; 166 inherit system; 167 }); 168 169 sd_image = forMatchingSystems [ "armv6l-linux" "armv7l-linux" "aarch64-linux" ] (system: makeSdImage { 170 module = { 171 armv6l-linux = ./modules/installer/cd-dvd/sd-image-raspberrypi.nix; 172 armv7l-linux = ./modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix; 173 aarch64-linux = ./modules/installer/cd-dvd/sd-image-aarch64.nix; 174 }.${system}; 175 inherit system; 176 }); 177 178 # A bootable VirtualBox virtual appliance as an OVA file (i.e. packaged OVF). 179 ova = forMatchingSystems [ "x86_64-linux" ] (system: 180 181 with import nixpkgs { inherit system; }; 182 183 hydraJob ((import lib/eval-config.nix { 184 inherit system; 185 modules = 186 [ versionModule 187 ./modules/installer/virtualbox-demo.nix 188 ]; 189 }).config.system.build.virtualBoxOVA) 190 191 ); 192 193 194 # Ensure that all packages used by the minimal NixOS config end up in the channel. 195 dummy = forAllSystems (system: pkgs.runCommand "dummy" 196 { toplevel = (import lib/eval-config.nix { 197 inherit system; 198 modules = singleton ({ ... }: 199 { fileSystems."/".device = mkDefault "/dev/sda1"; 200 boot.loader.grub.device = mkDefault "/dev/sda"; 201 system.stateVersion = mkDefault "18.03"; 202 }); 203 }).config.system.build.toplevel; 204 preferLocalBuild = true; 205 } 206 "mkdir $out; ln -s $toplevel $out/dummy"); 207 208 209 # Provide a tarball that can be unpacked into an SD card, and easily 210 # boot that system from uboot (like for the sheevaplug). 211 # The pc variant helps preparing the expression for the system tarball 212 # in a machine faster than the sheevpalug 213 /* 214 system_tarball_pc = forAllSystems (system: makeSystemTarball { 215 module = ./modules/installer/cd-dvd/system-tarball-pc.nix; 216 inherit system; 217 }); 218 */ 219 220 # Provide container tarball for lxc, libvirt-lxc, docker-lxc, ... 221 containerTarball = forAllSystems (system: makeSystemTarball { 222 module = ./modules/virtualisation/lxc-container.nix; 223 inherit system; 224 }); 225 226 /* 227 system_tarball_fuloong2f = 228 assert builtins.currentSystem == "mips64-linux"; 229 makeSystemTarball { 230 module = ./modules/installer/cd-dvd/system-tarball-fuloong2f.nix; 231 system = "mips64-linux"; 232 }; 233 234 system_tarball_sheevaplug = 235 assert builtins.currentSystem == "armv5tel-linux"; 236 makeSystemTarball { 237 module = ./modules/installer/cd-dvd/system-tarball-sheevaplug.nix; 238 system = "armv5tel-linux"; 239 }; 240 */ 241 242 243 # Run the tests for each platform. You can run a test by doing 244 # e.g. ‘nix-build -A tests.login.x86_64-linux’, or equivalently, 245 # ‘nix-build tests/login.nix -A result’. 246 tests.atd = callTest tests/atd.nix {}; 247 tests.acme = callTest tests/acme.nix {}; 248 tests.avahi = callTest tests/avahi.nix {}; 249 tests.beegfs = callTest tests/beegfs.nix {}; 250 tests.bittorrent = callTest tests/bittorrent.nix {}; 251 tests.bind = callTest tests/bind.nix {}; 252 #tests.blivet = callTest tests/blivet.nix {}; # broken since 2017-07024 253 tests.boot = callSubTests tests/boot.nix {}; 254 tests.boot-stage1 = callTest tests/boot-stage1.nix {}; 255 tests.borgbackup = callTest tests/borgbackup.nix {}; 256 tests.buildbot = callTest tests/buildbot.nix {}; 257 tests.cadvisor = callTestOnMatchingSystems ["x86_64-linux"] tests/cadvisor.nix {}; 258 tests.ceph = callTestOnMatchingSystems ["x86_64-linux"] tests/ceph.nix {}; 259 tests.certmgr = callSubTests tests/certmgr.nix {}; 260 tests.cfssl = callTestOnMatchingSystems ["x86_64-linux"] tests/cfssl.nix {}; 261 tests.chromium = (callSubTestsOnMatchingSystems ["x86_64-linux"] tests/chromium.nix {}).stable or {}; 262 tests.cjdns = callTest tests/cjdns.nix {}; 263 tests.cloud-init = callTest tests/cloud-init.nix {}; 264 tests.containers-ipv4 = callTest tests/containers-ipv4.nix {}; 265 tests.containers-ipv6 = callTest tests/containers-ipv6.nix {}; 266 tests.containers-bridge = callTest tests/containers-bridge.nix {}; 267 tests.containers-imperative = callTest tests/containers-imperative.nix {}; 268 tests.containers-extra_veth = callTest tests/containers-extra_veth.nix {}; 269 tests.containers-physical_interfaces = callTest tests/containers-physical_interfaces.nix {}; 270 tests.containers-restart_networking = callTest tests/containers-restart_networking.nix {}; 271 tests.containers-tmpfs = callTest tests/containers-tmpfs.nix {}; 272 tests.containers-hosts = callTest tests/containers-hosts.nix {}; 273 tests.containers-macvlans = callTest tests/containers-macvlans.nix {}; 274 tests.couchdb = callTest tests/couchdb.nix {}; 275 tests.deluge = callTest tests/deluge.nix {}; 276 tests.dhparams = callTest tests/dhparams.nix {}; 277 tests.docker = callTestOnMatchingSystems ["x86_64-linux"] tests/docker.nix {}; 278 tests.docker-tools = callTestOnMatchingSystems ["x86_64-linux"] tests/docker-tools.nix {}; 279 tests.docker-tools-overlay = callTestOnMatchingSystems ["x86_64-linux"] tests/docker-tools-overlay.nix {}; 280 tests.docker-edge = callTestOnMatchingSystems ["x86_64-linux"] tests/docker-edge.nix {}; 281 tests.docker-registry = callTest tests/docker-registry.nix {}; 282 tests.dovecot = callTest tests/dovecot.nix {}; 283 tests.dnscrypt-proxy = callTestOnMatchingSystems ["x86_64-linux"] tests/dnscrypt-proxy.nix {}; 284 tests.ecryptfs = callTest tests/ecryptfs.nix {}; 285 tests.etcd = callTestOnMatchingSystems ["x86_64-linux"] tests/etcd.nix {}; 286 tests.ec2-nixops = (callSubTestsOnMatchingSystems ["x86_64-linux"] tests/ec2.nix {}).boot-ec2-nixops or {}; 287 tests.ec2-config = (callSubTestsOnMatchingSystems ["x86_64-linux"] tests/ec2.nix {}).boot-ec2-config or {}; 288 tests.elk = callSubTestsOnMatchingSystems ["x86_64-linux"] tests/elk.nix {}; 289 tests.env = callTest tests/env.nix {}; 290 tests.ferm = callTest tests/ferm.nix {}; 291 tests.firefox = callTest tests/firefox.nix {}; 292 tests.flatpak = callTest tests/flatpak.nix {}; 293 tests.firewall = callTest tests/firewall.nix {}; 294 tests.fsck = callTest tests/fsck.nix {}; 295 tests.fwupd = callTest tests/fwupd.nix {}; 296 tests.gdk-pixbuf = callTest tests/gdk-pixbuf.nix {}; 297 #tests.gitlab = callTest tests/gitlab.nix {}; 298 tests.gitolite = callTest tests/gitolite.nix {}; 299 tests.gjs = callTest tests/gjs.nix {}; 300 tests.gocd-agent = callTest tests/gocd-agent.nix {}; 301 tests.gocd-server = callTest tests/gocd-server.nix {}; 302 tests.gnome3 = callTest tests/gnome3.nix {}; 303 tests.gnome3-gdm = callTest tests/gnome3-gdm.nix {}; 304 tests.grafana = callTest tests/grafana.nix {}; 305 tests.graphite = callTest tests/graphite.nix {}; 306 tests.hadoop.hdfs = callTestOnMatchingSystems [ "x86_64-linux" ] tests/hadoop/hdfs.nix {}; 307 tests.hadoop.yarn = callTestOnMatchingSystems [ "x86_64-linux" ] tests/hadoop/yarn.nix {}; 308 tests.hardened = callTest tests/hardened.nix { }; 309 tests.haproxy = callTest tests/haproxy.nix {}; 310 tests.hibernate = callTest tests/hibernate.nix {}; 311 tests.hitch = callTest tests/hitch {}; 312 tests.home-assistant = callTest tests/home-assistant.nix { }; 313 tests.hound = callTest tests/hound.nix {}; 314 tests.hocker-fetchdocker = callTest tests/hocker-fetchdocker {}; 315 tests.hydra = callTest tests/hydra {}; 316 tests.i3wm = callTest tests/i3wm.nix {}; 317 tests.iftop = callTest tests/iftop.nix {}; 318 tests.initrd-network-ssh = callTest tests/initrd-network-ssh {}; 319 tests.installer = callSubTests tests/installer.nix {}; 320 tests.influxdb = callTest tests/influxdb.nix {}; 321 tests.ipv6 = callTest tests/ipv6.nix {}; 322 tests.jenkins = callTest tests/jenkins.nix {}; 323 tests.ostree = callTest tests/ostree.nix {}; 324 tests.osquery = callTest tests/osquery.nix {}; 325 tests.plasma5 = callTest tests/plasma5.nix {}; 326 tests.plotinus = callTest tests/plotinus.nix {}; 327 tests.keymap = callSubTests tests/keymap.nix {}; 328 tests.initrdNetwork = callTest tests/initrd-network.nix {}; 329 tests.kafka = callSubTests tests/kafka.nix {}; 330 tests.kernel-copperhead = callTest tests/kernel-copperhead.nix {}; 331 tests.kernel-latest = callTest tests/kernel-latest.nix {}; 332 tests.kernel-lts = callTest tests/kernel-lts.nix {}; 333 tests.kubernetes.dns = callSubTestsOnMatchingSystems ["x86_64-linux"] tests/kubernetes/dns.nix {}; 334 ## kubernetes.e2e should eventually replace kubernetes.rbac when it works 335 #tests.kubernetes.e2e = callSubTestsOnMatchingSystems ["x86_64-linux"] tests/kubernetes/e2e.nix {}; 336 tests.kubernetes.rbac = callSubTestsOnMatchingSystems ["x86_64-linux"] tests/kubernetes/rbac.nix {}; 337 tests.latestKernel.login = callTest tests/login.nix { latestKernel = true; }; 338 tests.ldap = callTest tests/ldap.nix {}; 339 #tests.lightdm = callTest tests/lightdm.nix {}; 340 tests.login = callTest tests/login.nix {}; 341 #tests.logstash = callTest tests/logstash.nix {}; 342 tests.mathics = callTest tests/mathics.nix {}; 343 tests.matrix-synapse = callTest tests/matrix-synapse.nix {}; 344 tests.memcached = callTest tests/memcached.nix {}; 345 tests.mesos = callTest tests/mesos.nix {}; 346 tests.misc = callTest tests/misc.nix {}; 347 tests.mongodb = callTest tests/mongodb.nix {}; 348 tests.mpd = callTest tests/mpd.nix {}; 349 tests.mumble = callTest tests/mumble.nix {}; 350 tests.munin = callTest tests/munin.nix {}; 351 tests.mutableUsers = callTest tests/mutable-users.nix {}; 352 tests.mysql = callTest tests/mysql.nix {}; 353 tests.mysqlBackup = callTest tests/mysql-backup.nix {}; 354 tests.mysqlReplication = callTest tests/mysql-replication.nix {}; 355 tests.nat.firewall = callTest tests/nat.nix { withFirewall = true; }; 356 tests.nat.firewall-conntrack = callTest tests/nat.nix { withFirewall = true; withConntrackHelpers = true; }; 357 tests.nat.standalone = callTest tests/nat.nix { withFirewall = false; }; 358 tests.netdata = callTest tests/netdata.nix { }; 359 tests.networking.networkd = callSubTests tests/networking.nix { networkd = true; }; 360 tests.networking.scripted = callSubTests tests/networking.nix { networkd = false; }; 361 # TODO: put in networking.nix after the test becomes more complete 362 tests.networkingProxy = callTest tests/networking-proxy.nix {}; 363 tests.nexus = callTest tests/nexus.nix { }; 364 tests.nfs3 = callTest tests/nfs.nix { version = 3; }; 365 tests.nfs4 = callTest tests/nfs.nix { version = 4; }; 366 tests.nginx = callTest tests/nginx.nix { }; 367 tests.nghttpx = callTest tests/nghttpx.nix { }; 368 tests.nix-ssh-serve = callTest tests/nix-ssh-serve.nix { }; 369 tests.novacomd = callTestOnMatchingSystems ["x86_64-linux"] tests/novacomd.nix { }; 370 tests.leaps = callTest tests/leaps.nix { }; 371 tests.nsd = callTest tests/nsd.nix {}; 372 tests.openssh = callTest tests/openssh.nix {}; 373 tests.openldap = callTest tests/openldap.nix {}; 374 tests.opensmtpd = callTest tests/opensmtpd.nix {}; 375 tests.owncloud = callTest tests/owncloud.nix {}; 376 tests.pam-oath-login = callTest tests/pam-oath-login.nix {}; 377 tests.peerflix = callTest tests/peerflix.nix {}; 378 tests.php-pcre = callTest tests/php-pcre.nix {}; 379 tests.postgresql = callSubTests tests/postgresql.nix {}; 380 tests.pgmanage = callTest tests/pgmanage.nix {}; 381 tests.postgis = callTest tests/postgis.nix {}; 382 tests.powerdns = callTest tests/powerdns.nix {}; 383 #tests.pgjwt = callTest tests/pgjwt.nix {}; 384 tests.predictable-interface-names = callSubTests tests/predictable-interface-names.nix {}; 385 tests.printing = callTest tests/printing.nix {}; 386 tests.prometheus = callTest tests/prometheus.nix {}; 387 tests.prosody = callTest tests/prosody.nix {}; 388 tests.proxy = callTest tests/proxy.nix {}; 389 tests.quagga = callTest tests/quagga.nix {}; 390 tests.quake3 = callTest tests/quake3.nix {}; 391 tests.rabbitmq = callTest tests/rabbitmq.nix {}; 392 tests.radicale = callTest tests/radicale.nix {}; 393 tests.rspamd = callSubTests tests/rspamd.nix {}; 394 tests.runInMachine = callTest tests/run-in-machine.nix {}; 395 tests.rxe = callTest tests/rxe.nix {}; 396 tests.samba = callTest tests/samba.nix {}; 397 tests.sddm = callSubTests tests/sddm.nix {}; 398 tests.simple = callTest tests/simple.nix {}; 399 tests.slim = callTest tests/slim.nix {}; 400 tests.slurm = callTest tests/slurm.nix {}; 401 tests.smokeping = callTest tests/smokeping.nix {}; 402 tests.snapper = callTest tests/snapper.nix {}; 403 tests.statsd = callTest tests/statsd.nix {}; 404 tests.strongswan-swanctl = callTest tests/strongswan-swanctl.nix {}; 405 tests.sudo = callTest tests/sudo.nix {}; 406 tests.systemd = callTest tests/systemd.nix {}; 407 tests.switchTest = callTest tests/switch-test.nix {}; 408 tests.taskserver = callTest tests/taskserver.nix {}; 409 tests.tomcat = callTest tests/tomcat.nix {}; 410 tests.tor = callTest tests/tor.nix {}; 411 tests.transmission = callTest tests/transmission.nix {}; 412 tests.udisks2 = callTest tests/udisks2.nix {}; 413 tests.vault = callTest tests/vault.nix {}; 414 tests.virtualbox = callSubTestsOnMatchingSystems ["x86_64-linux"] tests/virtualbox.nix {}; 415 tests.wordpress = callTest tests/wordpress.nix {}; 416 tests.xautolock = callTest tests/xautolock.nix {}; 417 tests.xdg-desktop-portal = callTest tests/xdg-desktop-portal.nix {}; 418 tests.xfce = callTest tests/xfce.nix {}; 419 tests.xmonad = callTest tests/xmonad.nix {}; 420 tests.xrdp = callTest tests/xrdp.nix {}; 421 tests.xss-lock = callTest tests/xss-lock.nix {}; 422 tests.yabar = callTest tests/yabar.nix {}; 423 tests.zookeeper = callTest tests/zookeeper.nix {}; 424 tests.morty = callTest tests/morty.nix { }; 425 tests.bcachefs = callTest tests/bcachefs.nix { }; 426 427 /* Build a bunch of typical closures so that Hydra can keep track of 428 the evolution of closure sizes. */ 429 430 closures = { 431 432 smallContainer = makeClosure ({ ... }: 433 { boot.isContainer = true; 434 services.openssh.enable = true; 435 }); 436 437 tinyContainer = makeClosure ({ ... }: 438 { boot.isContainer = true; 439 imports = [ modules/profiles/minimal.nix ]; 440 }); 441 442 ec2 = makeClosure ({ ... }: 443 { imports = [ modules/virtualisation/amazon-image.nix ]; 444 }); 445 446 kde = makeClosure ({ ... }: 447 { services.xserver.enable = true; 448 services.xserver.displayManager.sddm.enable = true; 449 services.xserver.desktopManager.plasma5.enable = true; 450 }); 451 452 xfce = makeClosure ({ ... }: 453 { services.xserver.enable = true; 454 services.xserver.desktopManager.xfce.enable = true; 455 }); 456 457 # Linux/Apache/PostgreSQL/PHP stack. 458 lapp = makeClosure ({ pkgs, ... }: 459 { services.httpd.enable = true; 460 services.httpd.adminAddr = "foo@example.org"; 461 services.postgresql.enable = true; 462 services.postgresql.package = pkgs.postgresql93; 463 environment.systemPackages = [ pkgs.php ]; 464 }); 465 }; 466}