From 40854dd628e5b31e535218a1d2f602f6b5e2637e Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Thu, 28 Nov 2024 13:47:17 +0700 Subject: [PATCH] =?UTF-8?q?:hammer:=20add=20addSys=20from=20=CB=88t=CD=A1s?= =?UTF-8?q?=C9=9B=CB=90za=C9=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nix/buildAllNixosConfigurations.nix | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 nix/buildAllNixosConfigurations.nix diff --git a/nix/buildAllNixosConfigurations.nix b/nix/buildAllNixosConfigurations.nix new file mode 100644 index 0000000..f6d891a --- /dev/null +++ b/nix/buildAllNixosConfigurations.nix @@ -0,0 +1,30 @@ +# buid all system locally is part of `nix flake check` with this flake parrt. +# todo make this an application : `nix run .#buildAllNixosConfigurations` +{ inputs, self, ... }: +{ + perSystem = + { + pkgs, + system, + lib, + ... + }: + with lib; + { + checks = + let + all = attrNames self.nixosConfigurations; + linkFor = sys: "ln -s ${self.nixosConfigurations.${sys}.config.system.build.toplevel} $out/${sys}"; + links = filt: builtins.concatStringsSep "\n" (map linkFor (filter (name: filt name) all)); + toplevels = + filt: + pkgs.runCommandLocal "toplevels" { } '' + mkdir $out + ${links filt} + ''; + in + { + buildAllNixosConfigurations = toplevels (_: true); + }; + }; +}