@cryptotaxi247 / infra / commits / 15a8f8cb

Make it easy to make a mac use catalina

Graham Christensen committed Jan 16, 2022 at 19:07 UTC 15a8f8cbb12eab0d137d2376468184a366ee0804
1 file changed +33 -21
delft/network.nix
+33 -21
@@ -5,7 +5,7 @@ let
5 prometheus-postgres-exporter = self.callPackage ./prometheus/postgres-exporter.nix {};
6 };
7
8 - makeMac = { ip, extra }: {
8 + makeMac = { ip, extra, useCatalina ? false }: {
9 deployment = {
10 targetHost = ip;
11 };
@@ -13,31 +13,42 @@ let
13 # work around nix#3462
14 documentation.nixos.enable = false;
15
16 - macosGuest = {
17 - enable = true;
18 - network = {
19 - interiorNetworkPrefix = "10.172.170"; #172="n", 170="x"
20 - externalInterface = "enp3s0f0";
21 - sshInterface = "wg0";
22 - };
23 -
24 - guest = {
25 - sockets = 1;
26 - cores = 2;
27 - threads = 2;
28 - memoryInMegs = 6 * 1024;
29 - zvolName = "rpool/mac-hdd-2-initial-setup-startup-script.img";
30 - ovmfCodeFile = ../macs/dist/OVMF_CODE.fd;
31 - ovmfVarsFile = ../macs/dist/OVMF_VARS-1024x768.fd;
32 - guestConfigDir = ../macs/guest;
33 - };
34 - };
16 imports = [
17 ../macs/host
18 extra
19 + ({ lib, pkgs, ... }: {
20 + macosGuest = {
21 +
22 + enable = true;
23 + network = {
24 + interiorNetworkPrefix = "10.172.170"; #172="n", 170="x"
25 + externalInterface = "enp3s0f0";
26 + sshInterface = "wg0";
27 + };
28 +
29 + guest = {
30 + sockets = 1;
31 + cores = 2;
32 + threads = 2;
33 + memoryInMegs = 6 * 1024;
34 + ovmfCodeFile = ../macs/dist/OVMF_CODE.fd;
35 + ovmfVarsFile = ../macs/dist/OVMF_VARS-1024x768.fd;
36 + } // (if useCatalina then
37 + {
38 + zvolName = lib.mkForce "rpool/catalina";
39 + guestConfigDir = lib.mkForce ../macs/guest-catalina;
40 + cloverImage = (pkgs.callPackage ../macs/dist/clover-catalina {}).clover-image;
41 + }
42 + else
43 + {
44 + zvolName = "rpool/mac-hdd-2-initial-setup-startup-script.img";
45 + guestConfigDir = ../macs/guest;
46 + }
47 + );
48 + };
49 + })
50 ];
51 };
40 -
52 in {
53 defaults = {
54 documentation.nixos.enable = false;
@@ -93,6 +104,7 @@ in {
104
105 mac2 = makeMac {
106 ip = "10.254.2.2";
107 + useCatalina = true;
108 extra = {
109 imports = [
110 ../macs/nodes/mac2.nix