summary refs log tree commit diff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix38
1 files changed, 23 insertions, 15 deletions
diff --git a/flake.nix b/flake.nix
index c0adac4..3b0b980 100644
--- a/flake.nix
+++ b/flake.nix
@@ -19,43 +19,51 @@
 
   outputs = inputs @ { self, nixpkgs, nixpkgs-unstable, home-manager, ... }:
   let
-    system = "x86_64-linux";
+    systems = {
+      x86 = "x86_64-linux";
+      arm = "aarch64-linux";
+    };
 
-    machines = [
-      "corsac"
+    machines = with systems; [
+      { name = "corsac"; system = x86; }
+      { name = "lapin"; system = arm; }
+      { name = "renard"; system = x86; }
     ];
     
-    packageSets = let
+    packageSetsForSystem = system: let
       pkgsInputs = { inherit system; config = import ./config.nix; };
     in rec {
       pkgs = import nixpkgs pkgsInputs;
       unstablePkgs = import nixpkgs-unstable pkgsInputs;
-      auxiliaryPkgs = import ./pkgs { inherit pkgs unstablePkgs; };
+      auxiliaryPkgs = import ./pkgs { inherit system pkgs unstablePkgs; };
     };
 
+    inherit (nixpkgs) lib;
   in {
-    nixosConfigurations = nixpkgs.lib.genAttrs machines
-      (machine: nixpkgs.lib.nixosSystem {
-        inherit system;
+    nixosConfigurations = lib.mergeAttrsList (map (machine: {
+      ${machine.name} = nixpkgs.lib.nixosSystem {
+        inherit (machine) system;
 
-        specialArgs = inputs // packageSets // {
-          me = machine;
+        specialArgs = inputs // (packageSetsForSystem machine.system) // {
+          me = machine.name;
           security = import ./security.nix;
+          util = import ./util.nix { inherit lib; };
         };
 
         modules = [
-          ./machines/${machine}
+          ./machines/${machine.name}
         
           home-manager.nixosModules.home-manager {
             home-manager.useGlobalPkgs = true;
             home-manager.useUserPackages = true;
-            home-manager.users.mel = import ./machines/${machine}/home.nix;
+            home-manager.users.mel = import ./machines/${machine.name}/home.nix;
           }
         ];
-      }
-    );
+      };
+    }) machines);
 
     # compatibility wrapper for nixos-option
-    legacyPackages.${system} = with packageSets; pkgs.recurseIntoAttrs pkgs;
+    legacyPackages = lib.genAttrs (lib.attrValues systems) 
+      (system: with packageSetsForSystem system; pkgs.recurseIntoAttrs pkgs);
   };
 }