build: init mimas
Martin Weinelt committed
Oct 23, 2024 at 17:28 UTC
023c104d3cb6265256d4065d4c90b2ab1845ddea
11 files changed
+187
-2
build/flake.nix
+9
@@ -88,6 +88,15 @@
88
];
89
};
90
91
+ nixosConfigurations.mimas = nixpkgs.lib.nixosSystem {
92
+ system = "x86_64-linux";
93
+
94
+ modules = [
95
+ flakesModule
96
+ ./mimas
97
+ ];
98
+ };
99
+
100
colmena =
101
{
102
meta = {
build/mimas/boot.nix
new
+29
@@ -0,0 +1,29 @@
1
+{
2
+ boot = {
3
+ initrd.availableKernelModules = [
4
+ "ahci"
5
+ "xhci_pci"
6
+ "nvme"
7
+ "usbhid"
8
+ ];
9
+ supportedFilesystems.zfs = true;
10
+ loader = {
11
+ efi.canTouchEfiVariables = false;
12
+ grub = {
13
+ enable = true;
14
+ efiSupport = true;
15
+ efiInstallAsRemovable = true;
16
+ mirroredBoots = [
17
+ {
18
+ devices = [ "nodev" ];
19
+ path = "/efi/a";
20
+ }
21
+ {
22
+ devices = [ "nodev" ];
23
+ path = "/efi/b";
24
+ }
25
+ ];
26
+ };
27
+ };
28
+ };
29
+}
build/mimas/default.nix
new
+17
@@ -0,0 +1,17 @@
1
+{
2
+ imports = [
3
+ ../common.nix
4
+ ./boot.nix
5
+ ./network.nix
6
+ ];
7
+
8
+ disko.devices = import ./disko.nix;
9
+
10
+ networking = {
11
+ hostName = "mimas";
12
+ domain = "nixos.org";
13
+ hostId = "aba92093";
14
+ };
15
+
16
+ system.stateVersion = "24.11";
17
+}
build/mimas/disko.nix
new
+81
@@ -0,0 +1,81 @@
1
+let
2
+ layout = id: {
3
+ type = "gpt";
4
+ partitions = {
5
+ esp = {
6
+ type = "EF00";
7
+ size = "512M";
8
+ content = {
9
+ type = "filesystem";
10
+ format = "vfat";
11
+ mountpoint = "/efi/${id}";
12
+ };
13
+ };
14
+ zfs = {
15
+ size = "100%";
16
+ content = {
17
+ type = "zfs";
18
+ pool = "zroot";
19
+ };
20
+ };
21
+ };
22
+ };
23
+in
24
+{
25
+ disk = {
26
+ nvme0n1 = {
27
+ type = "disk";
28
+ device = "/dev/disk/by-id/nvme-SAMSUNG_MZQL21T9HCJR-00A07_S64GNNFX604905";
29
+ content = layout "a";
30
+ };
31
+ nvme1n1 = {
32
+ type = "disk";
33
+ device = "/dev/disk/by-id/nvme-SAMSUNG_MZQL21T9HCJR-00A07_S64GNNFX604919";
34
+ content = layout "b";
35
+ };
36
+ };
37
+
38
+ zpool.zroot = {
39
+ type = "zpool";
40
+ mode = "mirror";
41
+ options.ashift = "12";
42
+
43
+ rootFsOptions = {
44
+ acltype = "posixacl";
45
+ atime = "off";
46
+ compression = "on";
47
+ mountpoint = "none";
48
+ xattr = "sa";
49
+ };
50
+
51
+ datasets = {
52
+ "root" = {
53
+ type = "zfs_fs";
54
+ mountpoint = "/";
55
+ };
56
+ "nix/store" = {
57
+ type = "zfs_fs";
58
+ mountpoint = "/nix";
59
+ };
60
+ "nix/db" = {
61
+ type = "zfs_fs";
62
+ mountpoint = "/nix/var/nix/db";
63
+ };
64
+ "hydra/cache" = {
65
+ type = "zfs_fs";
66
+ mountpoint = "/var/cache/hydra";
67
+ };
68
+ "hydra/state" = {
69
+ type = "zfs_fs";
70
+ mountpoint = "/var/lib/hydra";
71
+ };
72
+ "reserved" = {
73
+ type = "zfs_fs";
74
+ options = {
75
+ canmount = "off";
76
+ refreservation = "16G"; # roughly one system closure
77
+ };
78
+ };
79
+ };
80
+ };
81
+}
build/mimas/network.nix
new
+25
@@ -0,0 +1,25 @@
1
+{
2
+ networking.useDHCP = false;
3
+
4
+ systemd.network = {
5
+ enable = true;
6
+ networks = {
7
+ "30-enp5s0" = {
8
+ matchConfig = {
9
+ MACAddress = "9c:6b:00:70:d1:f8";
10
+ Type = "ether";
11
+ };
12
+ linkConfig.RequiredForOnline = true;
13
+ networkConfig.Description = "WAN";
14
+ address = [
15
+ "157.90.104.34/26"
16
+ "2a01:4f8:2220:11c8::1/64"
17
+ ];
18
+ routes = [
19
+ { Gateway = "157.90.104.1"; }
20
+ { Gateway = "fe80::1"; }
21
+ ];
22
+ };
23
+ };
24
+ };
25
+}
build/pluto/prometheus/exporters/nixos.nix
+4
-1
@@ -5,7 +5,10 @@
5
static_configs = [
6
{
7
labels.role = "hydra";
8
- targets = [ "rhea:9300" ];
8
+ targets = [
9
+ "rhea:9300"
10
+ "mimas.nixos.org:9300"
11
+ ];
12
}
13
{
14
labels.role = "monitoring";
build/pluto/prometheus/exporters/node.nix
+4
-1
@@ -8,7 +8,10 @@
8
static_configs = [
9
{
10
labels.role = "hydra";
11
- targets = [ "rhea:9100" ];
11
+ targets = [
12
+ "rhea:9100"
13
+ "mimas.nixos.org:9100"
14
+ ];
15
}
16
{
17
labels.role = "database";
build/pluto/prometheus/exporters/zfs.nix
+1
@@ -9,6 +9,7 @@
9
"rhea:9134"
10
"haumea:9134"
11
"pluto:9134"
12
+ "mimas.nixos.org:9134"
13
];
14
}
15
];
modules/wireguard-hosts.toml
+6
@@ -22,6 +22,12 @@ network = 16
22
# tombstone: 10.254.2.8 mac8 (host/guest)
23
# tombstone: 10.254.2.9 mac9 (host/guest)
24
25
+[hosts.mimas]
26
+endpoint = "157.90.104.34"
27
+ip = "10.254.1.1"
28
+port = 51820
29
+publicKey = "h54X0ACbziEspzsYV2/5nSdg5ptdCrIRgpe9KJxNlyY="
30
+
31
[hosts.rhea]
32
endpoint = "5.9.122.43"
33
ip = "10.254.1.5"
ssh-keys.nix
+1
@@ -33,5 +33,6 @@ rec {
33
haumea = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBamzRwZmoLjBFoNruGSVJEahk02Ku7NrBOmqcRWxcPm";
34
pluto = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPzc6B1S4mp3T3oWZnqQDkDVWFBIzLtkgkdgstfYZ5d/";
35
rhea = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHpWGtAp/AUzKPsCgcoxupr7vnganHKwxe6MVXd0Abs6";
36
+ mimas = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICzfTNppOS5b5IvZl1wqjGTUZE0D/o/MY8d7uKPWDvIp";
37
};
38
}
terraform/dns.tf
+10
@@ -86,6 +86,16 @@ locals {
86
type = "AAAA"
87
value = "2a01:4f8:162:71eb::"
88
},
89
+ {
90
+ hostname = "mimas.nixos.org"
91
+ type = "AAAA"
92
+ value = "2a01:4f8:2220:11c8::1"
93
+ },
94
+ {
95
+ hostname = "mimas.nixos.org"
96
+ type = "A"
97
+ value = "157.90.104.34"
98
+ },
99
{
100
hostname = "reproducible.nixos.org"
101
type = "CNAME"