From 3b7b5998f11a8c388a49d3af45849cacc7bf6f90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 22 Dec 2023 12:47:54 +0100 Subject: [PATCH] export packages as checks --- flake.nix | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/flake.nix b/flake.nix index 2909642..81e1ce2 100644 --- a/flake.nix +++ b/flake.nix @@ -51,24 +51,30 @@ # TODO: also add a test here once we have https://github.com/NixOS/nixpkgs/pull/228346 merged netboot-installer = ./nix/netboot-installer/module.nix; }; - checks.x86_64-linux = + checks = let - pkgs = nixos-unstable.legacyPackages.x86_64-linux; - in - { - kexec-installer-unstable = pkgs.callPackage ./nix/kexec-installer/test.nix { - kexecTarball = self.packages.x86_64-linux.kexec-installer-nixos-unstable-noninteractive; - }; - shellcheck = pkgs.runCommand "shellcheck" + # re-export the packages as checks + 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; + in { - nativeBuildInputs = [ pkgs.shellcheck ]; - } '' - shellcheck ${(pkgs.nixos [self.nixosModules.kexec-installer]).config.system.build.kexecRun} - touch $out - ''; - kexec-installer-2311 = nixos-2311.legacyPackages.x86_64-linux.callPackage ./nix/kexec-installer/test.nix { - kexecTarball = self.packages.x86_64-linux.kexec-installer-nixos-2311-noninteractive; - }; - }; + kexec-installer-unstable = pkgs.callPackage ./nix/kexec-installer/test.nix { + kexecTarball = self.packages.x86_64-linux.kexec-installer-nixos-unstable-noninteractive; + }; + shellcheck = pkgs.runCommand "shellcheck" + { + nativeBuildInputs = [ pkgs.shellcheck ]; + } '' + shellcheck ${(pkgs.nixos [self.nixosModules.kexec-installer]).config.system.build.kexecRun} + touch $out + ''; + kexec-installer-2311 = nixos-2311.legacyPackages.x86_64-linux.callPackage ./nix/kexec-installer/test.nix { + kexecTarball = self.packages.x86_64-linux.kexec-installer-nixos-2311-noninteractive; + }; + }; + in + nixos-unstable.lib.recursiveUpdate packages { x86_64-linux = checks; }; }; }