flake: automatically define nixosConfigurations from dir

This commit is contained in:
Artemis Tosini 2023-12-25 04:33:08 +00:00
parent ad73e7870c
commit 7e57d5443a
Signed by: artemist
GPG key ID: ADFFE553DCBB831E
4 changed files with 11 additions and 32 deletions

View file

@ -49,44 +49,20 @@
outputs = { self, nixpkgs, home-manager, utils, nixvim, ... }@inputs:
let
makeSystem = conf:
nixpkgs.lib.nixosSystem (nixpkgs.lib.recursiveUpdate conf rec {
baseDir = ./system;
lib = nixpkgs.lib;
makeSystem = module:
lib.nixosSystem (rec {
specialArgs = { inherit inputs; };
modules = [
home-manager.nixosModules.home-manager
{ home-manager.extraSpecialArgs = specialArgs; }
] ++ (conf.modules or [ ]);
] ++ [ module ];
});
in {
nixosConfigurations.starlight = makeSystem {
system = "x86_64-linux";
modules = [ ./system/starlight ];
};
nixosConfigurations.rainbowdash = makeSystem {
system = "x86_64-linux";
modules = [ ./system/rainbowdash ];
};
nixosConfigurations.spike = makeSystem {
system = "x86_64-linux";
modules = [ ./system/spike ];
};
nixosConfigurations.gallus = makeSystem {
system = "x86_64-linux";
modules = [ ./system/gallus ];
};
nixosConfigurations.mistmane = makeSystem {
system = "aarch64-linux";
modules = [ ./system/mistmane ];
};
nixosConfigurations.smolder = makeSystem {
system = "aarch64-linux";
modules = [ ./system/smolder ];
};
nixosConfigurations =
lib.mapAttrs (name: _: makeSystem (baseDir + "/${name}"))
(builtins.readDir baseDir);
} // utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system; };
in {

View file

@ -46,5 +46,6 @@
extraConfig = lib.mkForce "HandlePowerKey=lock";
};
nixpkgs.hostPlatform = "aarch64-linux";
system.stateVersion = "21.11";
}

View file

@ -89,5 +89,6 @@
networking.domain = "manehattan.artem.ist";
networking.hostName = "rainbowdash";
nixpkgs.hostPlatform = "x86_64-linux";
system.stateVersion = "20.03";
}

View file

@ -137,5 +137,6 @@
# oh god
system.includeBuildDependencies = true;
# NixOS
nixpkgs.hostPlatform = "x86_64-linux";
system.stateVersion = "21.11";
}