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

View File

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

View File

@ -4,8 +4,7 @@
imports = [ imports = [
<nixpkgs/nixos/modules/profiles/minimal.nix> <nixpkgs/nixos/modules/profiles/minimal.nix>
../../../../lib/hq.nix ../../../../lib/hq.nix
../../../../lib/yggdrasil.nix ../../../../lib/yggdrasil-service.nix
./yggdrasil-prefix.nix
]; ];
networking.interfaces.eth0 = { 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; users.motd = builtins.readFile ./motd;
} }

View File

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