yggdrasil-hq: fix, enable for server7

This commit is contained in:
Astro 2019-11-29 21:51:20 +01:00
parent dce1a251ce
commit 45c65cbac5
5 changed files with 24 additions and 15 deletions

View File

@ -7,7 +7,6 @@
../../lib/emery.nix
./containers
./hardware-configuration.nix
./yggdrasil-prefix.nix
./hydra.nix
./nix-serve.nix
];
@ -50,6 +49,10 @@
enp2s0f1.useDHCP = false;
};
};
hq.yggdrasil = {
enable = true;
interface = "br0";
};
environment.systemPackages = with pkgs; [ tmux htop vim gitMinimal nixfmt ];

View File

@ -2,7 +2,7 @@
{
imports = [
../../../../lib/yggdrasil-hq.nix
../../../../lib/hq.nix
];
services.uhub = {

View File

@ -4,8 +4,7 @@
imports = [
<nixpkgs/nixos/modules/profiles/minimal.nix>
../../../../lib/hq.nix
../../../../lib/yggdrasil.nix
./yggdrasil-prefix.nix
../../../../lib/yggdrasil-service.nix
];
networking.interfaces.eth0 = {

View File

@ -18,5 +18,10 @@ in {
];
};
# Please import only things that are configurable and OFF BY DEFAULT!
imports = [
./yggdrasil-hq.nix
];
users.motd = builtins.readFile ./motd;
}

View File

@ -3,7 +3,7 @@ with lib;
let
cfg = config.hq.yggdrasil;
hostNameHash = hashString "sha256" config.networking.hostName;
hostNameHash = builtins.hashString "sha256" config.networking.hostName;
hextets = map (i: substring (4 * i) (4 * (i + 1)) hostNameHash) [ 0 1 2 3 ];
hostAddr = concatStringsSep ":" hextets;
in {
@ -22,16 +22,18 @@ in {
config = mkIf cfg.enable {
networking.interfaces = {
"${cfg.interface}.ipv6" = {
addresses = [{
address = "310:5217:69c0:9afc:${hostAddr}";
prefixLength = 64;
}];
routes = [{
address = "200::";
prefixLength = 7;
via = "310:5217:69c0:9afc::1";
}];
"${cfg.interface}" = {
"ipv6" = {
addresses = [{
address = "310:5217:69c0:9afc:${hostAddr}";
prefixLength = 64;
}];
routes = [{
address = "200::";
prefixLength = 7;
via = "310:5217:69c0:9afc::1";
}];
};
};
};
};