fix: eval error
This commit is contained in:
parent
2a1262df2f
commit
f761ede7ff
1 changed files with 31 additions and 34 deletions
|
|
@ -11,22 +11,20 @@
|
|||
mkEnableOption
|
||||
mkIf
|
||||
mapAttrsToList
|
||||
attrNames
|
||||
map
|
||||
concatLines
|
||||
mkOption
|
||||
types
|
||||
;
|
||||
cfg = config.our.buildMachines;
|
||||
|
||||
others = filterAttrs (n: _v: n != config.networking.hostName) self.nixosConfigurations;
|
||||
builders = filterAttrs (_n: v: v.config.our.buildMachines.enable) self.nixosConfigurations;
|
||||
others = filterAttrs (n: _v: n != config.networking.hostName) builders;
|
||||
|
||||
mkBuilder = hostName: attrs: let
|
||||
config' = attrs.config;
|
||||
cfg' = config'.our.buildMachines;
|
||||
pkgs' = attrs.pkgs;
|
||||
in
|
||||
mkIf cfg'.enable {
|
||||
in {
|
||||
# NOTE: https://github.com/NixOS/nix/issues/3177
|
||||
hostName =
|
||||
if hostName == config.networking.hostName
|
||||
|
|
@ -52,7 +50,7 @@
|
|||
mandatoryFeatures = [];
|
||||
};
|
||||
|
||||
buildMachines = mapAttrsToList mkBuilder self.nixosConfigurations;
|
||||
buildMachines = mapAttrsToList mkBuilder builders;
|
||||
|
||||
remotebuildKeys =
|
||||
mapAttrsToList (
|
||||
|
|
@ -60,12 +58,11 @@
|
|||
)
|
||||
others;
|
||||
|
||||
mkMatch = host: ''
|
||||
Match User remotebuild Host ${host}
|
||||
mkMatch = hostName: _v: ''
|
||||
Match User remotebuild Host ${hostName}
|
||||
IdentityFile ${config.clan.core.vars.generators.remotebuild.files."ssh.id_ed25519".path}
|
||||
'';
|
||||
othersName = attrNames others;
|
||||
sshConfig = concatLines (map mkMatch othersName);
|
||||
sshConfig = concatLines (mapAttrsToList mkMatch others);
|
||||
in {
|
||||
options.our.buildMachines = {
|
||||
enable = mkEnableOption "Use this machine as a remoteBuilder for others and vice versa.";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue