refactor(configurations): Configurations -> configurationFiles

Also out `system`, `host` and `configurationFiles` in an attrset
This commit is contained in:
reo101 2024-07-21 15:18:18 +03:00
parent 2b167c5406
commit b48f29dab4
Signed by: reo101
GPG key ID: 675AA7EF13964ACB

View file

@ -121,14 +121,14 @@ let
(builtins.mapAttrs (builtins.mapAttrs
(system: hosts: (system: hosts:
lib.concatMapAttrs lib.concatMapAttrs
(host: configuration: (host: configurationFiles:
lib.optionalAttrs lib.optionalAttrs
(and [ (and [
(host != "__template__") (host != "__template__")
(pred system host configuration) (pred { inherit system host configurationFiles; })
]) ])
{ {
${host} = mkHost system host configuration; ${host} = mkHost { inherit system host configurationFiles; };
}) })
hosts) hosts)
machines)); machines));
@ -138,37 +138,37 @@ in
# Configurations # Configurations
nixosConfigurations = nixosConfigurations =
createConfigurations createConfigurations
(system: host: configuration: ({ system, host, configurationFiles, ... }:
and and
[ [
(hasFiles (hasFiles
[ "configuration.nix" ] [ "configuration.nix" ]
configuration) configurationFiles)
# (hasDirectories # (hasDirectories
# [ "home" ] # [ "home" ]
# config) # config)
]) ])
(system: host: configuration: ({ system, host, configurationFiles, ... }:
mkNixosHost { mkNixosHost {
root = ../machines/nixos/${system}/${host}; root = ../machines/nixos/${system}/${host};
inherit system; inherit system;
hostname = host; hostname = host;
users = (builtins.map users = (builtins.map
(lib.strings.removeSuffix ".nix") (lib.strings.removeSuffix ".nix")
(builtins.attrNames (configuration."home" or { }))); (builtins.attrNames (configurationFiles."home" or { })));
}) })
config.flake.nixosMachines; config.flake.nixosMachines;
nixOnDroidConfigurations = nixOnDroidConfigurations =
createConfigurations createConfigurations
(system: host: configuration: ({ system, host, configurationFiles, ... }:
and and
[ [
(hasFiles (hasFiles
[ "configuration.nix" "home.nix" ] [ "configuration.nix" "home.nix" ]
configuration) configurationFiles)
]) ])
(system: host: configuration: ({ system, host, configurationFiles, ... }:
mkNixOnDroidHost { mkNixOnDroidHost {
root = ../machines/nix-on-droid/${system}/${host}; root = ../machines/nix-on-droid/${system}/${host};
inherit system; inherit system;
@ -178,37 +178,37 @@ in
darwinConfigurations = darwinConfigurations =
createConfigurations createConfigurations
(system: host: configuration: ({ system, host, configurationFiles, ... }:
and and
[ [
(hasFiles (hasFiles
[ "configuration.nix" ] [ "configuration.nix" ]
configuration) configurationFiles)
(hasDirectories (hasDirectories
[ "home" ] [ "home" ]
configuration) configurationFiles)
]) ])
(system: host: configuration: ({ system, host, configurationFiles, ... }:
mkNixDarwinHost { mkNixDarwinHost {
root = ../machines/nix-darwin/${system}/${host}; root = ../machines/nix-darwin/${system}/${host};
inherit system; inherit system;
hostname = host; hostname = host;
users = (builtins.map users = (builtins.map
(lib.strings.removeSuffix ".nix") (lib.strings.removeSuffix ".nix")
(builtins.attrNames (configuration."home" or { }))); (builtins.attrNames (configurationFiles."home" or { })));
}) })
config.flake.nixDarwinMachines; config.flake.nixDarwinMachines;
homeConfigurations = homeConfigurations =
createConfigurations createConfigurations
(system: host: configuration: ({ system, host, configurationFiles, ... }:
and and
[ [
(hasFiles (hasFiles
[ "home.nix" ] [ "home.nix" ]
configuration) configurationFiles)
]) ])
(system: host: configuration: ({ system, host, configurationFiles, ... }:
mkHomeManagerHost { mkHomeManagerHost {
root = ../machines/home-manager/${system}/${host}; root = ../machines/home-manager/${system}/${host};
inherit system; inherit system;