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: outputs = { self, nixpkgs, home-manager, utils, nixvim, ... }@inputs:
let let
makeSystem = conf: baseDir = ./system;
nixpkgs.lib.nixosSystem (nixpkgs.lib.recursiveUpdate conf rec { lib = nixpkgs.lib;
makeSystem = module:
lib.nixosSystem (rec {
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
modules = [ modules = [
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ home-manager.extraSpecialArgs = specialArgs; } { home-manager.extraSpecialArgs = specialArgs; }
] ++ (conf.modules or [ ]); ] ++ [ module ];
}); });
in { in {
nixosConfigurations.starlight = makeSystem { nixosConfigurations =
system = "x86_64-linux"; lib.mapAttrs (name: _: makeSystem (baseDir + "/${name}"))
modules = [ ./system/starlight ]; (builtins.readDir baseDir);
};
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 ];
};
} // utils.lib.eachDefaultSystem (system: } // utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system; }; let pkgs = import nixpkgs { inherit system; };
in { in {

View file

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

View file

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

View file

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