mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 14:01:34 +01:00
Auto import all hosts
This commit is contained in:
parent
ad7ae417b9
commit
8559359248
5 changed files with 26 additions and 33 deletions
|
|
@ -57,7 +57,7 @@
|
|||
systems = [ "x86_64-linux" ];
|
||||
|
||||
imports = [
|
||||
./flake/nixosConfigurations.nix
|
||||
./flake/hosts.nix
|
||||
./flake/devShells.nix
|
||||
./flake/formatter.nix
|
||||
];
|
||||
|
|
|
|||
25
flake/hosts.nix
Normal file
25
flake/hosts.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
self,
|
||||
inputs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
subdirsOf =
|
||||
dir: builtins.attrNames (lib.filterAttrs (_: v: v == "directory") (builtins.readDir dir));
|
||||
in
|
||||
{
|
||||
flake.nixosConfigurations = lib.genAttrs (subdirsOf "${self}/hosts") (
|
||||
name:
|
||||
inputs.nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {
|
||||
inherit self inputs;
|
||||
};
|
||||
modules = [
|
||||
"${self}/hosts/${name}"
|
||||
"${self}/users/seb/@${name}"
|
||||
{ networking.hostName = name; }
|
||||
];
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
{
|
||||
nixpkgs,
|
||||
self,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
flake = {
|
||||
nixosConfigurations = {
|
||||
north = inputs.nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {
|
||||
inherit self inputs;
|
||||
};
|
||||
modules = [
|
||||
"${self}/hosts/north"
|
||||
"${self}/users/seb/@north"
|
||||
];
|
||||
};
|
||||
inspiron = inputs.nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {
|
||||
inherit self inputs;
|
||||
};
|
||||
modules = [
|
||||
"${self}/hosts/inspiron"
|
||||
"${self}/users/seb/@inspiron"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -5,7 +5,6 @@
|
|||
./hardware.nix
|
||||
];
|
||||
|
||||
networking.hostName = "inspiron";
|
||||
system.stateVersion = "23.11";
|
||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
./hardware.nix
|
||||
];
|
||||
|
||||
networking.hostName = "north";
|
||||
system.stateVersion = "23.11";
|
||||
boot.kernelPackages = pkgs.linuxPackages_6_8;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue