From b48f29dab4779a05e7485715f45aad6094ce2f9f Mon Sep 17 00:00:00 2001 From: reo101 Date: Sun, 21 Jul 2024 15:18:18 +0300 Subject: [PATCH] refactor(configurations): `Configurations` -> `configurationFiles` Also out `system`, `host` and `configurationFiles` in an attrset --- nix/configurations.nix | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/nix/configurations.nix b/nix/configurations.nix index c0114ed..3353bd4 100644 --- a/nix/configurations.nix +++ b/nix/configurations.nix @@ -121,14 +121,14 @@ let (builtins.mapAttrs (system: hosts: lib.concatMapAttrs - (host: configuration: + (host: configurationFiles: lib.optionalAttrs (and [ (host != "__template__") - (pred system host configuration) + (pred { inherit system host configurationFiles; }) ]) { - ${host} = mkHost system host configuration; + ${host} = mkHost { inherit system host configurationFiles; }; }) hosts) machines)); @@ -138,37 +138,37 @@ in # Configurations nixosConfigurations = createConfigurations - (system: host: configuration: + ({ system, host, configurationFiles, ... }: and [ (hasFiles [ "configuration.nix" ] - configuration) + configurationFiles) # (hasDirectories # [ "home" ] # config) ]) - (system: host: configuration: + ({ system, host, configurationFiles, ... }: mkNixosHost { root = ../machines/nixos/${system}/${host}; inherit system; hostname = host; users = (builtins.map (lib.strings.removeSuffix ".nix") - (builtins.attrNames (configuration."home" or { }))); + (builtins.attrNames (configurationFiles."home" or { }))); }) config.flake.nixosMachines; nixOnDroidConfigurations = createConfigurations - (system: host: configuration: + ({ system, host, configurationFiles, ... }: and [ (hasFiles [ "configuration.nix" "home.nix" ] - configuration) + configurationFiles) ]) - (system: host: configuration: + ({ system, host, configurationFiles, ... }: mkNixOnDroidHost { root = ../machines/nix-on-droid/${system}/${host}; inherit system; @@ -178,37 +178,37 @@ in darwinConfigurations = createConfigurations - (system: host: configuration: + ({ system, host, configurationFiles, ... }: and [ (hasFiles [ "configuration.nix" ] - configuration) + configurationFiles) (hasDirectories [ "home" ] - configuration) + configurationFiles) ]) - (system: host: configuration: + ({ system, host, configurationFiles, ... }: mkNixDarwinHost { root = ../machines/nix-darwin/${system}/${host}; inherit system; hostname = host; users = (builtins.map (lib.strings.removeSuffix ".nix") - (builtins.attrNames (configuration."home" or { }))); + (builtins.attrNames (configurationFiles."home" or { }))); }) config.flake.nixDarwinMachines; homeConfigurations = createConfigurations - (system: host: configuration: + ({ system, host, configurationFiles, ... }: and [ (hasFiles [ "home.nix" ] - configuration) + configurationFiles) ]) - (system: host: configuration: + ({ system, host, configurationFiles, ... }: mkHomeManagerHost { root = ../machines/home-manager/${system}/${host}; inherit system;