Reorganize host confs by system type

This commit is contained in:
Vili Sinervä 2025-07-12 03:52:35 +03:00
parent 3e17f6abb5
commit b82457b8f5
Signed by: Vili Sinervä
SSH key fingerprint: SHA256:FladqYjaE4scJY3Hi+gnShZ6ygnTJgixy0I6BAoHyos
14 changed files with 44 additions and 71 deletions

View file

@ -30,69 +30,42 @@
}: }:
{ {
nixosConfigurations = nixosConfigurations =
( let
let hosts =
x86_64-hosts = with builtins;
with builtins; nixpkgs.lib.lists.flatten (
(map (file: nixpkgs.lib.removeSuffix ".nix" file) ( map (
filter (file: file != "aarch64-linux" && file != "installer") (attrNames (readDir ./hosts)) system:
)); map (host: {
in system = system;
builtins.listToAttrs ( name = nixpkgs.lib.strings.removeSuffix ".nix" host;
map ( }) (attrNames (readDir ./hosts/${system}))
host: ) (attrNames (readDir ./hosts))
nixpkgs.lib.nameValuePair host ( );
nixpkgs.lib.nixosSystem { in
specialArgs = { builtins.listToAttrs (
nixpkgs-flake = nixpkgs; map (
inherit nixvim; host:
inherit disko; nixpkgs.lib.nameValuePair host.name (
}; nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; specialArgs = {
modules = [ nixpkgs-flake = nixpkgs;
{ networking.hostName = host; } inherit nixvim;
./default.nix inherit disko;
./hosts/${host}.nix };
system = host.system;
modules = [
{ networking.hostName = host.name; }
./default.nix
./hosts/${host.system}/${host.name}.nix
disko.nixosModules.disko disko.nixosModules.disko
impermanence.nixosModules.impermanence impermanence.nixosModules.impermanence
sops-nix.nixosModules.sops sops-nix.nixosModules.sops
]; ];
} }
) )
) x86_64-hosts ) hosts
)
)
// (
let
aarch64-linux-hosts =
with builtins;
(map (file: nixpkgs.lib.removeSuffix ".nix" file) (attrNames (readDir ./hosts/aarch64-linux)));
in
builtins.listToAttrs (
map (
host:
nixpkgs.lib.nameValuePair host (
nixpkgs.lib.nixosSystem {
specialArgs = {
nixpkgs-flake = nixpkgs;
inherit nixvim;
inherit disko;
};
system = "aarch64-linux";
modules = [
{ networking.hostName = host; }
./default.nix
./hosts/aarch64-linux/${host}.nix
disko.nixosModules.disko
impermanence.nixosModules.impermanence
sops-nix.nixosModules.sops
];
}
)
) aarch64-linux-hosts
)
); );
hydraJobs.hosts = builtins.mapAttrs ( hydraJobs.hosts = builtins.mapAttrs (
_: host: host.config.system.build.toplevel _: host: host.config.system.build.toplevel

View file

@ -1,6 +1,6 @@
{ ... }: { ... }:
{ {
imports = [ ../disko/zfs-impermanence.nix ]; imports = [ ../../disko/zfs-impermanence.nix ];
custom = { custom = {
platform = { platform = {

View file

@ -1,6 +1,6 @@
{ ... }: { ... }:
{ {
imports = [ ../disko/zfs-impermanence.nix ]; imports = [ ../../disko/zfs-impermanence.nix ];
custom = { custom = {
platform = { platform = {

View file

@ -1,6 +1,6 @@
{ ... }: { ... }:
{ {
imports = [ ../disko/zfs-impermanence.nix ]; imports = [ ../../disko/zfs-impermanence.nix ];
custom = { custom = {
platform = { platform = {

View file

@ -1,6 +1,6 @@
{ ... }: { ... }:
{ {
imports = [ ../disko/zfs-impermanence.nix ]; imports = [ ../../disko/zfs-impermanence.nix ];
custom = { custom = {
platform = { platform = {

View file

@ -1,6 +1,6 @@
{ ... }: { ... }:
{ {
imports = [ ../disko/zfs-impermanence.nix ]; imports = [ ../../disko/zfs-impermanence.nix ];
custom = { custom = {
platform = { platform = {

View file

@ -1,6 +1,6 @@
{ ... }: { ... }:
{ {
imports = [ ../disko/zfs-impermanence.nix ]; imports = [ ../../disko/zfs-impermanence.nix ];
custom = { custom = {
platform = { platform = {

View file

@ -1,6 +1,6 @@
{ ... }: { ... }:
{ {
imports = [ ../disko/hetzner-zfs-impermanence.nix ]; imports = [ ../../disko/hetzner-zfs-impermanence.nix ];
custom = { custom = {
platform = { platform = {

View file

@ -1,6 +1,6 @@
{ ... }: { ... }:
{ {
imports = [ ../disko/zfs-impermanence.nix ]; imports = [ ../../disko/zfs-impermanence.nix ];
custom = { custom = {
platform = { platform = {

View file

@ -1,6 +1,6 @@
{ ... }: { ... }:
{ {
imports = [ ../disko/zfs-impermanence-backup.nix ]; imports = [ ../../disko/zfs-impermanence-backup.nix ];
custom = { custom = {
platform = { platform = {