This repository has no description
1.3 kB
45 lines
1{ self }:
2let
3 lib = self.inputs.nixpkgs.lib;
4 hashlib = self.inputs.nix-hashlib.lib;
5
6 # Generate IPv6 suffix from hostname (16 hex chars = 64 bits)
7 ipv6SuffixFun = hashlib.makeHashFun {
8 type = "hash";
9 dictionary = lib.stringToCharacters "0123456789abcdef";
10 length = 16;
11 };
12
13 formatIPv6Suffix = hash:
14 "${builtins.substring 0 4 hash}:${builtins.substring 4 4 hash}:${builtins.substring 8 4 hash}:${builtins.substring 12 4 hash}";
15
16 machineName = "virtulus";
17 ipv6Suffix = formatIPv6Suffix (ipv6SuffixFun machineName);
18 ipv6Address = "fd00:c700::${ipv6Suffix}";
19in
20{
21 privateNetwork = true;
22 hostBridge = "ctr0";
23
24 specialArgs = { inherit self; };
25
26 config = {
27 imports = [
28 self.inputs.clan-core.nixosModules.clanCore
29 ./config.nix
30 ];
31 clan.core.settings.directory = self;
32 clan.core.settings.machine.name = machineName;
33
34 # Configure IPv6 inside the container (on eth0 interface)
35 systemd.network.networks."10-container" = {
36 matchConfig.Name = "eth0";
37 address = [ "${ipv6Address}/64" ];
38 gateway = [ "fd00:c700::1" ];
39 networkConfig.ConfigureWithoutCarrier = true;
40 };
41
42 # Use host's local DNS64 resolver
43 networking.nameservers = [ "fd00:c700::1" ];
44 };
45}