fixup
This commit is contained in:
parent
e0c0fe1902
commit
dce1a251ce
|
@ -1,16 +1,16 @@
|
||||||
{ config, lib }:
|
{ config, lib, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.hq.yggdrasil;
|
cfg = config.hq.yggdrasil;
|
||||||
hostNameHash = hashString "sha256" networking.hostName;
|
hostNameHash = hashString "sha256" config.networking.hostName;
|
||||||
hextets = map (i: substring (4 * i) (4 * (i + 1)) hostNameHash) [0 1 2 3];
|
hextets = map (i: substring (4 * i) (4 * (i + 1)) hostNameHash) [ 0 1 2 3 ];
|
||||||
hostAddr = concatStringsSep ":" hextets;
|
hostAddr = concatStringsSep ":" hextets;
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options = with types; {
|
options = with types; {
|
||||||
hq.yggdrasil = {
|
hq.yggdrasil = {
|
||||||
enable = mkEnableOption "Configure Yggdrasil access via the Yggdrasil router";
|
enable =
|
||||||
|
mkEnableOption "Configure Yggdrasil access via the Yggdrasil router";
|
||||||
|
|
||||||
interface = mkOption {
|
interface = mkOption {
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
|
@ -20,14 +20,19 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.interfaces = optionalAttrs cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
"${cfg.interface}.ipv6" = {
|
networking.interfaces = {
|
||||||
addresses = [
|
"${cfg.interface}.ipv6" = {
|
||||||
{ address = "310:5217:69c0:9afc:${hostAddr}"; prefixLength = 64; }
|
addresses = [{
|
||||||
];
|
address = "310:5217:69c0:9afc:${hostAddr}";
|
||||||
routes = [
|
prefixLength = 64;
|
||||||
{ address = "200::"; prefixLength = 7; via = "310:5217:69c0:9afc::1"; }
|
}];
|
||||||
];
|
routes = [{
|
||||||
|
address = "200::";
|
||||||
|
prefixLength = 7;
|
||||||
|
via = "310:5217:69c0:9afc::1";
|
||||||
|
}];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue