@cryptotaxi247 / infra-1 / commits / 05a245aa

Add macs to network.nix

Graham Christensen committed Apr 25, 2019 at 11:04 UTC 05a245aa769e980ed3e990e6404ee6d1a9c47c29
12 files changed +393 -2
delft/network.nix
+41 -1
@@ -1,4 +1,35 @@
1 -{
1 +let
2 + makeMac = { ip, extra }: {
3 + deployment = {
4 + sshConfigOptionsFile = ../macs/ssh-config;
5 + targetHost = ip;
6 + };
7 + macosGuest = {
8 + enable = true;
9 + network = {
10 + interiorNetworkPrefix = "10.172.170"; #172="n", 170="x"
11 + externalInterface = "enp3s0f0";
12 + };
13 +
14 + guest = {
15 + sockets = 1;
16 + cores = 2;
17 + threads = 2;
18 + memoryInMegs = 6 * 1024;
19 + zvolName = "rpool/mac-hdd-2-initial-setup-startup-script.img";
20 + ovmfCodeFile = ../macs/dist/OVMF_CODE.fd;
21 + ovmfVarsFile = ../macs/dist/OVMF_VARS-1024x768.fd;
22 + cloverImage = ../macs/dist/Clover.qcow2;
23 + guestConfigDir = ../macs/guest;
24 + };
25 + };
26 + imports = [
27 + ../nixos-org-configurations/macs/host
28 + extra
29 + ];
30 + };
31 +
32 +in {
33 hydra = { deployment.targetHost = "hydra.ewi.tudelft.nl"; imports = [ ./build-machines-dell-1950.nix ]; };
34 lucifer = { deployment.targetHost = "lucifer.ewi.tudelft.nl"; imports = [ ./lucifer.nix ]; };
35 wendy = { deployment.targetHost = "wendy.ewi.tudelft.nl"; imports = [ ./wendy.nix ]; };
@@ -7,4 +38,13 @@
38 packet-t2-4 = { deployment.targetHost = "147.75.98.145"; imports = [ ./packet/packet-t2-4.nix ./build-machines-common.nix ]; };
39 chef = import ./chef.nix;
40 eris = import ./eris.nix;
41 +
42 + mac2 = makeMac {
43 + ip = "192.168.2.102";
44 + extra = {
45 + imports = [
46 + ../nixos-org-configurations/macs/nodes/mac2.nix
47 + ];
48 + };
49 + }
50 }
macs/guest/darwin-configuration.nix
+7 -1
@@ -60,7 +60,13 @@ in
60 nix.gc.automatic = true;
61 nix.gc.options = let
62 gbFree = 25;
63 - in "--max-freed $((${toString gbFree} * 1024**3 - 1024 * $(df -P -k /nix/store | tail -n 1 | awk '{ print $4 }')))";
63 + in "--max-freed $((${toString gbFree} * 1024**3 - 1024 * $(df -P -k /nix/store | tail -n 1 | awk '{ print $4 }')))";
64 +
65 + # If we drop below 20GiB during builds, free 20GiB
66 + nix.extraOptions = ''
67 + min-free = ${toString (20*1024*1024*1024)}
68 + max-free = ${toString (40*1024*1024*1024)}
69 + '';
70
71 environment.etc."per-user/root/ssh/authorized_keys".text = concatStringsSep "\n"
72 ([(authorizedNixStoreKey sshKeys.build-farm)
macs/host/default.nix
+23
@@ -4,6 +4,28 @@ let
4 inherit (lib) mkOption types;
5 in {
6 options = {
7 + monitorama = {
8 + enable = mkOption {
9 + default = false;
10 + type = types.bool;
11 + description = ''
12 + Whether to enable a prometheus proxy for prom nodes behind
13 + a NAT.
14 + '';
15 + };
16 +
17 + hosts = mkOption {
18 + type = types.attrsOf types.str;
19 + description = ''
20 + Key, value pairs of name -> ip:port/paths. The name will be
21 + used in a proxy's path.
22 + '';
23 + example = {
24 + "/mac1/host" = "http://192.168.2.101:9100/metrics";
25 + "/mac1/guest" = "http://192.168.2.101:9101/metrics";
26 + };
27 + };
28 + };
29 macosGuest = {
30 enable = mkOption {
31 default = false;
@@ -187,5 +209,6 @@ in {
209 imports = [
210 ./networking.nix
211 ./qemu.nix
212 + ./monitorama.nix
213 ];
214 }
macs/host/monitorama.nix new
+24
@@ -0,0 +1,24 @@
1 +{ lib, config, ... }:
2 +let
3 + inherit (lib) mkIf;
4 +in {
5 + config = mkIf config.monitorama.enable {
6 + networking.firewall.allowedTCPPorts = [ 9111 ];
7 + services.nginx = {
8 + enable = true;
9 + virtualHosts = {
10 + default = {
11 + default = true;
12 + listen = [ { addr = "0.0.0.0"; port = 9111; } ];
13 + locations = builtins.mapAttrs (name: value: { proxyPass = value; }) config.monitorama.hosts;
14 + };
15 + } // (
16 + builtins.mapAttrs (name: value: {
17 + listen = [ { addr = "0.0.0.0"; port = 9111; } ];
18 + locations."/metrics".proxyPass = value;
19 + })
20 + config.monitorama.hosts
21 + );
22 + };
23 + };
24 +}
macs/nodes/mac1.nix new
+37
@@ -0,0 +1,37 @@
1 +{ config, lib, pkgs, ... }:
2 +{
3 +
4 + boot.loader.systemd-boot.enable = true;
5 + boot.loader.efi.canTouchEfiVariables = true;
6 +
7 + services.openssh.enable = true;
8 +
9 + networking.hostId = "e81bb594";
10 + nixpkgs.config.allowUnfree = true;
11 + system.stateVersion = "18.09"; # Did you read the comment?
12 +
13 + boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "firewire_ohci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ];
14 + boot.kernelModules = [ "kvm-intel" ];
15 + boot.kernelPackages = pkgs.linuxPackages_latest;
16 +
17 + # The broadcom_sta is commented and wl, cfg80211 are blacklisted
18 + # to prevent spamming of wl_cfg80211 dmesg errors.
19 + boot.blacklistedKernelModules = [ "wl" "cfg80211" "mac80211" ];
20 + #boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
21 +
22 + fileSystems."/" =
23 + { device = "rpool/root";
24 + fsType = "zfs";
25 + };
26 +
27 + fileSystems."/boot" =
28 + { device = "/dev/disk/by-label/boot";
29 + fsType = "vfat";
30 + };
31 +
32 + swapDevices =
33 + [ { device = "/dev/disk/by-label/swap"; }
34 + ];
35 +
36 + nix.maxJobs = lib.mkDefault 4;
37 +}
macs/nodes/mac2.nix new
+36
@@ -0,0 +1,36 @@
1 +{ lib, config, ... }:
2 +{
3 + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" "sdhci_pci" ];
4 + boot.supportedFilesystems = [ "zfs" ];
5 + boot.kernelModules = [ "kvm-intel" "wl" ];
6 + boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
7 + boot.loader.systemd-boot.enable = true;
8 + boot.loader.efi.canTouchEfiVariables = true;
9 +
10 + fileSystems."/" =
11 + { device = "rpool/root";
12 + fsType = "zfs";
13 + };
14 +
15 + fileSystems."/boot" =
16 + { device = "/dev/disk/by-label/boot";
17 + fsType = "vfat";
18 + };
19 +
20 + swapDevices =
21 + [ { device = "/dev/disk/by-label/swap"; }
22 + ];
23 +
24 + nix.maxJobs = lib.mkDefault 4;
25 +
26 + networking.hostId = "c9e18834";
27 + nixpkgs.config.allowUnfree = true;
28 +
29 + services.openssh.enable = true;
30 + system.stateVersion = "18.09";
31 +
32 + users.extraUsers.root.openssh.authorizedKeys.keys = [
33 + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDI6/qMXX80oWm+NyftRw45D+mRJwJQ6gexkUhp1OgZc3MuW6Zm2RO2IZHEjJLSMUndZebbznPmPPM58VxiyQnRYH2+hn+qCrwSsyCUxA8Gz6PpxeaeUMlpbsuXOPFbvBraDZEqIvx/gIK849nIahGz3EcfaY73lVRP+MrrVHBGyQmaOLoNfzrJp8rZfLqokQQXmG1d3DzjkIi87TZLgrdxQewpk/4eKBKf8FDnEYeV3ood78SPa3syS48al99Q7e8JyAEZJfyCQkUSUxgSizU5+se1A5seDJg2Vsqef1Ah23g/lTtSn93vtjjLvObvMJTSplBO8ttG/3ylIewWYER/"
34 + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDY8wRHQtq9uBzdiAYzpSNmF+nmIHmW+AOeBTDNmdva+CFGIBbB56q7w6GCOhfXs8edrPY4qOcQGaOD0ussIvHnqkVfw8e6CbxnpXKeAuIz7+1V72AhLPzOkif4yPrI6tSYF5nvzq6U4Yk1qFnXiLQjkA1s4EcZH6V0KbHMsu7Mtv3Irspdn8KUI3j2UwZcssFu1EuLHhLNussziRQK9tOg9ixb0U1WXuUJn7Noh9odTAsAt6jLFdr5eN/IINgC9WQqvY/W94Tc2/z5TWR7z382pEkMBR/3sf+nYKA82069tagkyrtJ/YXi00CWU4vjpnMvwPEYcmtCddfCPi8ZIUrn grahamc@Morbo"
35 + ];
36 +}
macs/nodes/mac3.nix new
+45
@@ -0,0 +1,45 @@
1 +{ lib, config, ... }: {
2 + imports =
3 + [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
4 + ];
5 +
6 + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" "sdhci_pci" ];
7 + boot.kernelModules = [ "kvm-intel" "wl" ];
8 + boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
9 +
10 + boot.supportedFilesystems = [ "zfs" ];
11 +
12 + nixpkgs.config.allowUnfree = true;
13 +
14 + fileSystems."/" =
15 + { device = "rpool/root";
16 + fsType = "zfs";
17 + };
18 +
19 + fileSystems."/boot" =
20 + { device = "/dev/disk/by-label/boot";
21 + fsType = "vfat";
22 + };
23 +
24 + swapDevices =
25 + [ { device = "/dev/disk/by-label/swap"; }
26 + ];
27 +
28 + nix.maxJobs = lib.mkDefault 4;
29 + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
30 +
31 + networking.hostId = "03156864";
32 +
33 + boot.loader.systemd-boot.enable = true;
34 + boot.loader.efi.canTouchEfiVariables = true;
35 +
36 + networking.hostName = "mac3";
37 + services.openssh.enable = true;
38 +
39 + system.stateVersion = "18.09"; # Did you read the comment?
40 +
41 + users.extraUsers.root.openssh.authorizedKeys.keys = [
42 + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDI6/qMXX80oWm+NyftRw45D+mRJwJQ6gexkUhp1OgZc3MuW6Zm2RO2IZHEjJLSMUndZebbznPmPPM58VxiyQnRYH2+hn+qCrwSsyCUxA8Gz6PpxeaeUMlpbsuXOPFbvBraDZEqIvx/gIK849nIahGz3EcfaY73lVRP+MrrVHBGyQmaOLoNfzrJp8rZfLqokQQXmG1d3DzjkIi87TZLgrdxQewpk/4eKBKf8FDnEYeV3ood78SPa3syS48al99Q7e8JyAEZJfyCQkUSUxgSizU5+se1A5seDJg2Vsqef1Ah23g/lTtSn93vtjjLvObvMJTSplBO8ttG/3ylIewWYER/"
43 + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDY8wRHQtq9uBzdiAYzpSNmF+nmIHmW+AOeBTDNmdva+CFGIBbB56q7w6GCOhfXs8edrPY4qOcQGaOD0ussIvHnqkVfw8e6CbxnpXKeAuIz7+1V72AhLPzOkif4yPrI6tSYF5nvzq6U4Yk1qFnXiLQjkA1s4EcZH6V0KbHMsu7Mtv3Irspdn8KUI3j2UwZcssFu1EuLHhLNussziRQK9tOg9ixb0U1WXuUJn7Noh9odTAsAt6jLFdr5eN/IINgC9WQqvY/W94Tc2/z5TWR7z382pEkMBR/3sf+nYKA82069tagkyrtJ/YXi00CWU4vjpnMvwPEYcmtCddfCPi8ZIUrn grahamc@Morbo"
44 + ];
45 +}
macs/nodes/mac4.nix new
+28
@@ -0,0 +1,28 @@
1 +{ config, lib, pkgs, ... }:
2 +{
3 + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ];
4 + boot.kernelModules = [ "kvm-intel" "wl" ];
5 + boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
6 +
7 + fileSystems."/" =
8 + { device = "rpool/root";
9 + fsType = "zfs";
10 + };
11 +
12 + fileSystems."/boot" =
13 + { device = "/dev/disk/by-label/boot";
14 + fsType = "vfat";
15 + };
16 +
17 + swapDevices = [ { device = "/dev/disk/by-label/swap"; } ];
18 +
19 + nix.maxJobs = lib.mkDefault 4;
20 + boot.loader.systemd-boot.enable = true;
21 + boot.loader.efi.canTouchEfiVariables = true;
22 +
23 + services.openssh.enable = true;
24 +
25 + networking.hostId = "b73d17b0";
26 + nixpkgs.config.allowUnfree = true;
27 + system.stateVersion = "18.09"; # Did you read the comment?
28 +}
macs/nodes/mac5.nix new
+35
@@ -0,0 +1,35 @@
1 +# Do not modify this file! It was generated by ‘nixos-generate-config’
2 +# and may be overwritten by future invocations. Please make changes
3 +# to /etc/nixos/configuration.nix instead.
4 +{ config, lib, pkgs, ... }:
5 +{
6 +
7 + boot.loader.systemd-boot.enable = true;
8 + boot.loader.efi.canTouchEfiVariables = true;
9 +
10 + services.openssh.enable = true;
11 +
12 + system.stateVersion = "18.09"; # Did you read the comment?
13 + nixpkgs.config.allowUnfree = true;
14 + networking.hostId = "9d9a37de";
15 +
16 + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" "sdhci_pci" ];
17 + boot.kernelModules = [ "kvm-intel" "wl" ];
18 + boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
19 +
20 + fileSystems."/" =
21 + { device = "rpool/root";
22 + fsType = "zfs";
23 + };
24 +
25 + fileSystems."/boot" =
26 + { device = "/dev/disk/by-label/boot";
27 + fsType = "vfat";
28 + };
29 +
30 + swapDevices =
31 + [ { device = "/dev/disk/by-label/swap"; }
32 + ];
33 +
34 + nix.maxJobs = lib.mkDefault 4;
35 +}
macs/nodes/mac6.nix new
+43
@@ -0,0 +1,43 @@
1 +{ config, lib, pkgs, ... }:
2 +
3 +{
4 + imports =
5 + [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
6 + ];
7 +
8 + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" "sdhci_pci" ];
9 + boot.kernelModules = [ "kvm-intel" "wl" ];
10 + boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
11 + boot.supportedFilesystems = [ "zfs" ];
12 +
13 + fileSystems."/" =
14 + { device = "rpool/root";
15 + fsType = "zfs";
16 + };
17 +
18 + fileSystems."/boot" =
19 + { device = "/dev/disk/by-label/boot";
20 + fsType = "vfat";
21 + };
22 +
23 + swapDevices =
24 + [ { device = "/dev/disk/by-label/swap"; }
25 + ];
26 +
27 + nix.maxJobs = lib.mkDefault 4;
28 +
29 + networking.hostId = "0480d43b";
30 + nixpkgs.config.allowUnfree = true;
31 +
32 + boot.loader.systemd-boot.enable = true;
33 + boot.loader.efi.canTouchEfiVariables = true;
34 +
35 + services.openssh.enable = true;
36 +
37 + users.users.root.openssh.authorizedKeys.keys = [
38 + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDI6/qMXX80oWm+NyftRw45D+mRJwJQ6gexkUhp1OgZc3MuW6Zm2RO2IZHEjJLSMUndZebbznPmPPM58VxiyQnRYH2+hn+qCrwSsyCUxA8Gz6PpxeaeUMlpbsuXOPFbvBraDZEqIvx/gIK849nIahGz3EcfaY73lVRP+MrrVHBGyQmaOLoNfzrJp8rZfLqokQQXmG1d3DzjkIi87TZLgrdxQewpk/4eKBKf8FDnEYeV3ood78SPa3syS48al99Q7e8JyAEZJfyCQkUSUxgSizU5+se1A5seDJg2Vsqef1Ah23g/lTtSn93vtjjLvObvMJTSplBO8ttG/3ylIewWYER/"
39 + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDY8wRHQtq9uBzdiAYzpSNmF+nmIHmW+AOeBTDNmdva+CFGIBbB56q7w6GCOhfXs8edrPY4qOcQGaOD0ussIvHnqkVfw8e6CbxnpXKeAuIz7+1V72AhLPzOkif4yPrI6tSYF5nvzq6U4Yk1qFnXiLQjkA1s4EcZH6V0KbHMsu7Mtv3Irspdn8KUI3j2UwZcssFu1EuLHhLNussziRQK9tOg9ixb0U1WXuUJn7Noh9odTAsAt6jLFdr5eN/IINgC9WQqvY/W94Tc2/z5TWR7z382pEkMBR/3sf+nYKA82069tagkyrtJ/YXi00CWU4vjpnMvwPEYcmtCddfCPi8ZIUrn grahamc@Morbo"
40 + ];
41 +
42 + system.stateVersion = "18.09"; # Did you read the comment?
43 +}
macs/nodes/mac7.nix new
+41
@@ -0,0 +1,41 @@
1 +{ config, lib, pkgs, ... }:
2 +
3 +{
4 + imports =
5 + [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
6 + ];
7 +
8 + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" "sdhci_pci" ];
9 + boot.kernelModules = [ "kvm-intel" "wl" ];
10 + boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
11 + boot.supportedFilesystems = [ "zfs" ];
12 + fileSystems."/" =
13 + { device = "rpool/root";
14 + fsType = "zfs";
15 + };
16 +
17 + fileSystems."/boot" =
18 + { device = "/dev/disk/by-label/boot";
19 + fsType = "vfat";
20 + };
21 +
22 + swapDevices =
23 + [ { device = "/dev/disk/by-label/swap"; }
24 + ];
25 +
26 + networking.hostId = "a139a86e";
27 +
28 + nix.maxJobs = lib.mkDefault 4;
29 + nixpkgs.config.allowUnfree = true;
30 +
31 + boot.loader.systemd-boot.enable = true;
32 + boot.loader.efi.canTouchEfiVariables = true;
33 +
34 + services.openssh.enable = true;
35 + system.stateVersion = "18.09"; # Did you read the comment?
36 +
37 + users.users.root.openssh.authorizedKeys.keys = [
38 + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDI6/qMXX80oWm+NyftRw45D+mRJwJQ6gexkUhp1OgZc3MuW6Zm2RO2IZHEjJLSMUndZebbznPmPPM58VxiyQnRYH2+hn+qCrwSsyCUxA8Gz6PpxeaeUMlpbsuXOPFbvBraDZEqIvx/gIK849nIahGz3EcfaY73lVRP+MrrVHBGyQmaOLoNfzrJp8rZfLqokQQXmG1d3DzjkIi87TZLgrdxQewpk/4eKBKf8FDnEYeV3ood78SPa3syS48al99Q7e8JyAEZJfyCQkUSUxgSizU5+se1A5seDJg2Vsqef1Ah23g/lTtSn93vtjjLvObvMJTSplBO8ttG/3ylIewWYER/"
39 + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDY8wRHQtq9uBzdiAYzpSNmF+nmIHmW+AOeBTDNmdva+CFGIBbB56q7w6GCOhfXs8edrPY4qOcQGaOD0ussIvHnqkVfw8e6CbxnpXKeAuIz7+1V72AhLPzOkif4yPrI6tSYF5nvzq6U4Yk1qFnXiLQjkA1s4EcZH6V0KbHMsu7Mtv3Irspdn8KUI3j2UwZcssFu1EuLHhLNussziRQK9tOg9ixb0U1WXuUJn7Noh9odTAsAt6jLFdr5eN/IINgC9WQqvY/W94Tc2/z5TWR7z382pEkMBR/3sf+nYKA82069tagkyrtJ/YXi00CWU4vjpnMvwPEYcmtCddfCPi8ZIUrn grahamc@Morbo"
40 + ];
41 +}
macs/nodes/mac8.nix new
+33
@@ -0,0 +1,33 @@
1 +# Do not modify this file! It was generated by ‘nixos-generate-config’
2 +# and may be overwritten by future invocations. Please make changes
3 +# to /etc/nixos/configuration.nix instead.
4 +{ config, lib, pkgs, ... }:
5 +{
6 + boot.loader.systemd-boot.enable = true;
7 + boot.loader.efi.canTouchEfiVariables = true;
8 +
9 + services.openssh.enable = true;
10 + system.stateVersion = "18.09"; # Did you read the comment?
11 + nixpkgs.config.allowUnfree = true;
12 + networking.hostId = "2f5fc3a0";
13 +
14 + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" "sdhci_pci" ];
15 + boot.kernelModules = [ "kvm-intel" "wl" ];
16 + boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
17 +
18 + fileSystems."/" =
19 + { device = "rpool/root";
20 + fsType = "zfs";
21 + };
22 +
23 + fileSystems."/boot" =
24 + { device = "/dev/disk/by-label/boot";
25 + fsType = "vfat";
26 + };
27 +
28 + swapDevices =
29 + [ { device = "/dev/disk/by-label/swap"; }
30 + ];
31 +
32 + nix.maxJobs = lib.mkDefault 4;
33 +}