From dd5f75eec332a774bcebad727eba5d20abace42d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 18 Sep 2024 17:28:56 +0200 Subject: [PATCH] add boot tests for iso --- flake.nix | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/flake.nix b/flake.nix index 26f729f..4be9c83 100644 --- a/flake.nix +++ b/flake.nix @@ -58,27 +58,31 @@ packages = forAllSystems (system: nixos-unstable.lib.mapAttrs' (n: nixos-unstable.lib.nameValuePair "package-${n}") self.packages.${system}); checks = let - pkgs = nixos-unstable.legacyPackages.x86_64-linux; + pkgsUnstable = nixos-unstable.legacyPackages.x86_64-linux; + pkgsStable = nixos-stable.legacyPackages.x86_64-linux; + + bootTests = pkgs: channel: suffix: pkgs.lib.mapAttrs' (name: pkgs.lib.nameValuePair "${name}${suffix}") (pkgs.callPackages ./nix/image-installer/tests.nix { + nixpkgs = channel; + nixosModules = self.nixosModules; + }); in { - kexec-installer-unstable = pkgs.callPackage ./nix/kexec-installer/test.nix { + kexec-installer-unstable = pkgsUnstable.callPackage ./nix/kexec-installer/test.nix { kexecTarball = self.packages.x86_64-linux.kexec-installer-nixos-unstable-noninteractive; }; - inherit (pkgs.callPackages ./nix/image-installer/tests.nix { - nixpkgs = nixos-unstable; - nixosModules = self.nixosModules; - }) uefi-cdrom uefi-usb bios-cdrom bios-usb; + kexec-installer-stable = nixos-stable.legacyPackages.x86_64-linux.callPackage ./nix/kexec-installer/test.nix { kexecTarball = self.packages.x86_64-linux.kexec-installer-nixos-stable-noninteractive; }; - shellcheck = pkgs.runCommand "shellcheck" + shellcheck = pkgsUnstable.runCommand "shellcheck" { - nativeBuildInputs = [ pkgs.shellcheck ]; + nativeBuildInputs = [ pkgsUnstable.shellcheck ]; } '' - shellcheck ${(pkgs.nixos [self.nixosModules.kexec-installer]).config.system.build.kexecRun} + shellcheck ${(pkgsUnstable.nixos [self.nixosModules.kexec-installer]).config.system.build.kexecRun} touch $out ''; - }; + } // (bootTests pkgsUnstable nixos-unstable "-nixos-unstable") + // (bootTests pkgsStable nixos-stable "-nixos-stable"); in nixos-unstable.lib.recursiveUpdate packages { x86_64-linux = checks; }; };