From 05cac3cb937f7ef5ee8bbcca1bae830fd2fccd9e Mon Sep 17 00:00:00 2001 From: Daniel Olsen Date: Thu, 19 Oct 2023 18:32:04 +0200 Subject: [PATCH] make packages for each system derivation Makes it easier to test build each machine also makes nom go brr --- README.MD | 8 +++++++- flake.nix | 24 +++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/README.MD b/README.MD index 23ea7a6..de61b67 100644 --- a/README.MD +++ b/README.MD @@ -10,7 +10,13 @@ Etter å ha klonet prosjektet ned og gjort endringer kan du evaluere configene m før du bygger en maskin med: -`nix build .#nixosConfigurations..config.system.build.toplevel` +`nix build .#` + +hvis du vil være ekstra sikker på at alt bygger så kan du kjøre: + +`nix build .` for å bygge alle de viktige maskinene. + +NB: Dette kan ta opp til 15 minutter avhengig av hva som ligger i caches Husk å hvertfall stage nye filer om du har laget dem! diff --git a/flake.nix b/flake.nix index 0ae4f35..ed131af 100644 --- a/flake.nix +++ b/flake.nix @@ -21,12 +21,21 @@ outputs = { self, nixpkgs, matrix-next, pvv-calendar-bot, unstable, sops-nix, ... }@inputs: let + nixlib = nixpkgs.lib; systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ]; - forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system); + forAllSystems = f: nixlib.genAttrs systems (system: f system); + allMachines = nixlib.mapAttrsToList (name: _: name) self.nixosConfigurations; + importantMachines = [ + "bekkalokk" + "bicep" + "brzeczyszczykiewicz" + "georg" + "ildkule" + ]; in { nixosConfigurations = let nixosConfig = nixpkgs: name: config: nixpkgs.lib.nixosSystem (nixpkgs.lib.recursiveUpdate @@ -95,5 +104,18 @@ devShells = forAllSystems (system: { default = nixpkgs.legacyPackages.${system}.callPackage ./shell.nix { }; }); + + packages = { + "x86_64-linux" = let + pkgs = nixpkgs.legacyPackages."x86_64-linux"; + in rec { + default = important-machines; + important-machines = pkgs.linkFarm "important-machines" + (nixlib.getAttrs importantMachines self.packages.x86_64-linux); + all-machines = pkgs.linkFarm "all-machines" + (nixlib.getAttrs allMachines self.packages.x86_64-linux); + } // nixlib.genAttrs allMachines + (machine: self.nixosConfigurations.${machine}.config.system.build.toplevel); + }; }; }