mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-30 22:57:55 +00:00
flake-parts/setups: refactor
This commit is contained in:
parent
8a9e20b5f4
commit
d2993a367b
@ -251,18 +251,17 @@ in
|
||||
)
|
||||
metadata.systems);
|
||||
in
|
||||
lib.mapAttrs
|
||||
(hostname: metadata:
|
||||
generatePureConfigs hostname metadata)
|
||||
cfg.configs;
|
||||
lib.mapAttrs generatePureConfigs cfg.configs;
|
||||
in
|
||||
{
|
||||
homeConfigurations =
|
||||
let
|
||||
renameSystems = name: system: config:
|
||||
lib.nameValuePair "${name}-${system}" config;
|
||||
in
|
||||
lib.concatMapAttrs
|
||||
(name: configs:
|
||||
lib.mapAttrs'
|
||||
(system: config: lib.nameValuePair "${name}-${system}" config)
|
||||
configs)
|
||||
lib.mapAttrs' (renameSystems name) configs)
|
||||
pureHomeManagerConfigs;
|
||||
|
||||
deploy.nodes =
|
||||
@ -271,25 +270,25 @@ in
|
||||
lib.filterAttrs
|
||||
(name: _: cfg.configs.${name}.deploy != null)
|
||||
pureHomeManagerConfigs;
|
||||
|
||||
generateDeployNode = name: system: config:
|
||||
lib.nameValuePair "home-manager-${name}-${system}" (
|
||||
let
|
||||
deployConfig = cfg.configs.${name}.deploy;
|
||||
deployConfig' = lib.attrsets.removeAttrs deployConfig [ "profiles" ];
|
||||
in
|
||||
deployConfig'
|
||||
// {
|
||||
profiles =
|
||||
cfg.configs.${name}.deploy.profiles {
|
||||
inherit name config system;
|
||||
};
|
||||
}
|
||||
);
|
||||
in
|
||||
lib.concatMapAttrs
|
||||
(name: configs:
|
||||
lib.mapAttrs'
|
||||
(system: config: lib.nameValuePair "home-manager-${name}-${system}"
|
||||
(
|
||||
let
|
||||
deployConfig = cfg.configs.${name}.deploy;
|
||||
deployConfig' = lib.attrsets.removeAttrs deployConfig [ "profiles" ];
|
||||
in
|
||||
deployConfig'
|
||||
// {
|
||||
profiles =
|
||||
cfg.configs.${name}.deploy.profiles {
|
||||
inherit name config system;
|
||||
};
|
||||
}
|
||||
))
|
||||
configs)
|
||||
lib.mapAttrs' (generateDeployNode name) configs)
|
||||
validConfigs;
|
||||
};
|
||||
};
|
||||
|
@ -330,18 +330,17 @@ in
|
||||
)
|
||||
metadata.systems);
|
||||
in
|
||||
lib.mapAttrs
|
||||
(hostname: metadata:
|
||||
generatePureConfigs hostname metadata)
|
||||
validConfigs;
|
||||
lib.mapAttrs generatePureConfigs validConfigs;
|
||||
in
|
||||
{
|
||||
nixosConfigurations =
|
||||
let
|
||||
renameSystems = name: system: config:
|
||||
lib.nameValuePair "${name}-${system}" config;
|
||||
in
|
||||
lib.concatMapAttrs
|
||||
(name: configs:
|
||||
lib.mapAttrs'
|
||||
(system: config: lib.nameValuePair "${name}-${system}" config)
|
||||
configs)
|
||||
lib.mapAttrs' (renameSystems name) configs)
|
||||
pureNixosConfigs;
|
||||
|
||||
deploy.nodes =
|
||||
@ -350,25 +349,26 @@ in
|
||||
lib.filterAttrs
|
||||
(name: _: cfg.configs.${name}.deploy != null)
|
||||
pureNixosConfigs;
|
||||
|
||||
generateDeployNode = name: system: config:
|
||||
lib.nameValuePair "nixos-${name}-${system}"
|
||||
(
|
||||
let
|
||||
deployConfig = cfg.configs.${name}.deploy;
|
||||
deployConfig' = lib.attrsets.removeAttrs deployConfig [ "profiles" ];
|
||||
in
|
||||
deployConfig'
|
||||
// {
|
||||
profiles =
|
||||
cfg.configs.${name}.deploy.profiles {
|
||||
inherit name config system;
|
||||
};
|
||||
}
|
||||
);
|
||||
in
|
||||
lib.concatMapAttrs
|
||||
(name: configs:
|
||||
lib.mapAttrs'
|
||||
(system: config: lib.nameValuePair "nixos-${name}-${system}"
|
||||
(
|
||||
let
|
||||
deployConfig = cfg.configs.${name}.deploy;
|
||||
deployConfig' = lib.attrsets.removeAttrs deployConfig [ "profiles" ];
|
||||
in
|
||||
deployConfig'
|
||||
// {
|
||||
profiles =
|
||||
cfg.configs.${name}.deploy.profiles {
|
||||
inherit name config system;
|
||||
};
|
||||
}
|
||||
))
|
||||
configs)
|
||||
lib.mapAttrs' (generateDeployNode name) configs)
|
||||
validConfigs;
|
||||
};
|
||||
|
||||
@ -382,23 +382,21 @@ in
|
||||
|
||||
generateImages = name: metadata:
|
||||
let
|
||||
buildImage = format:
|
||||
lib.nameValuePair
|
||||
"${name}-${format}"
|
||||
(mkImage {
|
||||
inherit (metadata) nixpkgsBranch;
|
||||
inherit system format;
|
||||
extraModules = cfg.sharedModules ++ metadata.modules;
|
||||
});
|
||||
|
||||
images =
|
||||
builtins.map
|
||||
(format:
|
||||
lib.nameValuePair
|
||||
"${name}-${format}"
|
||||
(mkImage {
|
||||
inherit (metadata) nixpkgsBranch;
|
||||
inherit system format;
|
||||
extraModules = cfg.sharedModules ++ metadata.modules;
|
||||
}))
|
||||
metadata.formats;
|
||||
builtins.map buildImage metadata.formats;
|
||||
in
|
||||
lib.listToAttrs images;
|
||||
in
|
||||
lib.concatMapAttrs
|
||||
(name: metadata: generateImages name metadata)
|
||||
validImages;
|
||||
lib.concatMapAttrs generateImages validImages;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user