flake: automatically define nixosConfigurations from dir
This commit is contained in:
parent
ad73e7870c
commit
7e57d5443a
40
flake.nix
40
flake.nix
|
@ -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 {
|
||||
|
|
|
@ -46,5 +46,6 @@
|
|||
extraConfig = lib.mkForce "HandlePowerKey=lock";
|
||||
};
|
||||
|
||||
nixpkgs.hostPlatform = "aarch64-linux";
|
||||
system.stateVersion = "21.11";
|
||||
}
|
||||
|
|
|
@ -89,5 +89,6 @@
|
|||
|
||||
networking.domain = "manehattan.artem.ist";
|
||||
networking.hostName = "rainbowdash";
|
||||
nixpkgs.hostPlatform = "x86_64-linux";
|
||||
system.stateVersion = "20.03";
|
||||
}
|
||||
|
|
|
@ -137,5 +137,6 @@
|
|||
# oh god
|
||||
system.includeBuildDependencies = true;
|
||||
# NixOS
|
||||
nixpkgs.hostPlatform = "x86_64-linux";
|
||||
system.stateVersion = "21.11";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue