@cryptotaxi247 / infra-1 / commits / 5dc6c5bd

delft: import nixops-generated configs from eris/haumea

This is to allow evaluating configs both as part of nixopsConfigurations but also as part of standalone per-machine nixosConfigurations. Expected to be transitional until nixops is fully removed, then we can re-integrate that part of the config into more appropriate places.

Pierre Bourdon committed Jan 27, 2024 at 10:45 UTC 5dc6c5bda41a8a0e34ba71ac8076cc651b68f9ef
3 files changed +158
delft/eris-physical.nix new
+85
@@ -0,0 +1,85 @@
1 +# Transitional. This is the auto-generated nixops config for eris, extracted
2 +# into a file that we can check in and import when evaluating outside of
3 +# nixops.
4 +
5 +{ config, lib, pkgs, modulesPath, ... }: {
6 + config = {
7 + boot.kernelModules = [];
8 + networking = {
9 + hostName = "eris";
10 + extraHosts = ''
11 + 138.201.32.77 eris eris-unencrypted
12 + 127.0.0.1 eris-encrypted
13 + 46.4.89.205 haumea haumea-unencrypted
14 + '';
15 + firewall.trustedInterfaces = [];
16 + publicIPv4 = "138.201.32.77";
17 + vpnPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINOF2RnBNdlBPzY9o+b9OdKm10jibJulPJnu0V6tqu+P NixOps VPN key of eris";
18 + };
19 + system.stateVersion = ( lib.mkDefault "18.03" );
20 + };
21 + imports = [
22 + {
23 + config = {
24 + networking = {
25 + defaultGateway = "138.201.32.65";
26 + interfaces.eth0 = {
27 + ipAddress = "138.201.32.77";
28 + prefixLength = 26;
29 + };
30 + localCommands = ''
31 + ip -6 addr add '2a01:4f8:171:33cc::/64' dev 'eth0' || true
32 + ip -4 route change '138.201.32.64/26' via '138.201.32.65' dev 'eth0' || true
33 + ip -6 route add default via 'fe80::1' dev eth0 || true
34 + '';
35 + nameservers = [
36 + "213.133.98.98"
37 + "213.133.99.99"
38 + "213.133.100.100"
39 + "2a01:4f8:0:a0a1::add:1010"
40 + "2a01:4f8:0:a102::add:9999"
41 + "2a01:4f8:0:a111::add:9898"
42 + ];
43 + };
44 + services.udev.extraRules = ''
45 + ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="90:1b:0e:91:c3:67", NAME="eth0"
46 + '';
47 + users.extraUsers.root.openssh.authorizedKeys.keys = [
48 + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIXnddtPlqCgmGK3yE48/eoUke4u2O2SIin6kUp4T1eZ NixOps client key of eris"
49 + ];
50 + };
51 + imports = [
52 + ({
53 + swapDevices = [
54 + { label = "swap1"; }
55 + { label = "swap2"; }
56 + ];
57 + boot.loader.grub.devices = [
58 + "/dev/sda"
59 + "/dev/sdb"
60 + ];
61 + fileSystems = {
62 + "/" = {
63 + fsType = "ext4";
64 + label = "root";
65 + };
66 + };
67 + })
68 + ({ config, lib, pkgs, ... }:
69 +
70 + {
71 + imports =
72 + [ "${modulesPath}/installer/scan/not-detected.nix"
73 + ];
74 +
75 + boot.initrd.availableKernelModules = [ "ahci" "sd_mod" ];
76 + boot.kernelModules = [ "kvm-intel" ];
77 + boot.extraModulePackages = [ ];
78 +
79 + nix.maxJobs = lib.mkDefault 8;
80 + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
81 + })
82 + ];
83 + }
84 + ];
85 +}
delft/flake.nix
+2
@@ -10,6 +10,7 @@
10
11 modules = [
12 ./eris.nix
13 + ./eris-physical.nix
14 flakes.nix-netboot-serve.nixosModules.nix-netboot-serve
15 ];
16 };
@@ -19,6 +20,7 @@
20
21 modules = [
22 ./haumea.nix
23 + ./haumea-physical.nix
24 ];
25 };
26
delft/haumea-physical.nix new
+71
@@ -0,0 +1,71 @@
1 +# Transitional. This is the auto-generated nixops config for haumea, extracted
2 +# into a file that we can check in and import when evaluating outside of
3 +# nixops.
4 +
5 +{ config, lib, pkgs, modulesPath, ... }: {
6 + config = {
7 + boot.kernelModules = [];
8 + networking = {
9 + hostName = "haumea";
10 + extraHosts = ''
11 + 138.201.32.77 eris eris-unencrypted
12 + 46.4.89.205 haumea haumea-unencrypted
13 + 127.0.0.1 haumea-encrypted
14 + '';
15 + firewall.trustedInterfaces = [];
16 + publicIPv4 = "46.4.89.205";
17 + vpnPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIO0sjGPc7jcr3SxIa/pR7scuumNF6G6voDXmtrSBgRN NixOps VPN key of haumea";
18 + };
19 + system.stateVersion = ( lib.mkDefault "19.09" );
20 + };
21 + imports = [
22 + {
23 + config = {
24 + networking = {
25 + defaultGateway = { address = "46.4.89.193"; interface = "eth0"; };
26 + defaultGateway6 = { address = "fe80::1"; interface = "eth0"; };
27 + interfaces.eth0 = {
28 + ipv4.addresses = [
29 + { address = "46.4.89.205"; prefixLength = 27; }
30 + ];
31 + ipv6.addresses = [
32 + { address = "2a01:4f8:173:a02::"; prefixLength = 64; }
33 + ];
34 + };
35 + nameservers = [
36 + "213.133.98.98"
37 + "213.133.99.99"
38 + "213.133.100.100"
39 + "2a01:4f8:0:a0a1::add:1010"
40 + "2a01:4f8:0:a102::add:9999"
41 + "2a01:4f8:0:a111::add:9898"
42 + ];
43 + };
44 + services.udev.extraRules = ''
45 + ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="a8:a1:59:04:71:f5", NAME="eth0"
46 + '';
47 + users.extraUsers.root.openssh.authorizedKeys.keys = [
48 + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN+xcwa7Oj8At7n8gHQu7UXArxCJSQZgMaspfkyLbP1j NixOps client key of haumea"
49 + ];
50 + };
51 + imports = [
52 + ({})
53 + ({ config, lib, pkgs, ... }:
54 +
55 + {
56 + imports =
57 + [ "${modulesPath}/installer/scan/not-detected.nix"
58 + ];
59 +
60 + boot.initrd.availableKernelModules = [ "ahci" "nvme" "usbhid" ];
61 + boot.initrd.kernelModules = [ ];
62 + boot.kernelModules = [ "kvm-amd" ];
63 + boot.extraModulePackages = [ ];
64 +
65 + nix.maxJobs = lib.mkDefault 16;
66 + powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
67 + })
68 + ];
69 + }
70 + ];
71 +}