Hosts file for VPN
This commit is contained in:
parent
e68e1fe843
commit
3008a49eee
2 changed files with 13 additions and 2 deletions
|
@ -8,11 +8,12 @@
|
||||||
options.fleet = {
|
options.fleet = {
|
||||||
hosts = lib.mkOption {
|
hosts = lib.mkOption {
|
||||||
description = "Host configuration";
|
description = "Host configuration";
|
||||||
type = lib.types.attrsOf (lib.types.submodule {
|
type = lib.types.attrsOf (lib.types.submodule ({name, ...}: {
|
||||||
options = {
|
options = {
|
||||||
name = lib.mkOption {
|
name = lib.mkOption {
|
||||||
description = "Host name";
|
description = "Host name";
|
||||||
type = lib.types.strMatching "^$|^[[:alnum:]]([[:alnum:]_-]{0,61}[[:alnum:]])?$";
|
type = lib.types.strMatching "^$|^[[:alnum:]]([[:alnum:]_-]{0,61}[[:alnum:]])?$";
|
||||||
|
default = name;
|
||||||
};
|
};
|
||||||
system = lib.mkOption {
|
system = lib.mkOption {
|
||||||
description = "NixOS architecture (a.k.a. system)";
|
description = "NixOS architecture (a.k.a. system)";
|
||||||
|
@ -75,7 +76,7 @@
|
||||||
default = "ccr";
|
default = "ccr";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
}));
|
||||||
default = {};
|
default = {};
|
||||||
};
|
};
|
||||||
_mkNixosConfiguration = lib.mkOption {
|
_mkNixosConfiguration = lib.mkOption {
|
||||||
|
@ -90,6 +91,12 @@
|
||||||
({lib, ...}: {
|
({lib, ...}: {
|
||||||
networking.hostName = lib.mkForce hostname;
|
networking.hostName = lib.mkForce hostname;
|
||||||
nixpkgs.overlays = config.overlays;
|
nixpkgs.overlays = config.overlays;
|
||||||
|
networking.hosts =
|
||||||
|
lib.mapAttrs' (hostname: ip: {
|
||||||
|
name = ip;
|
||||||
|
value = ["${hostname}.fleet"];
|
||||||
|
})
|
||||||
|
(import "${self}/lib").ips;
|
||||||
})
|
})
|
||||||
"${self.outPath}/hosts/${hostname}"
|
"${self.outPath}/hosts/${hostname}"
|
||||||
]
|
]
|
||||||
|
|
|
@ -9,4 +9,8 @@
|
||||||
mothership = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFlepPWHE9GvQIBcAQBQPd80oiePSPxGDnMdqpdEqx6I";
|
mothership = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFlepPWHE9GvQIBcAQBQPd80oiePSPxGDnMdqpdEqx6I";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
ips = {
|
||||||
|
mothership = "10.100.0.1";
|
||||||
|
thinkpad = "10.100.0.2";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue