Jelajahi Sumber

refactor(meili): extract nix-builder config to dedicated module and update software packages

Zander Hawke 1 bulan lalu
induk
melakukan
e1068ab0a6

+ 1 - 43
hosts/meili/default.nix

@@ -3,54 +3,12 @@
   imports = [
     outputs.modules.global.nix-config
     ./kanata.nix
+    ./nix-builder.nix
     ./system.nix
     ./software.nix
   ]
   ++ (builtins.attrValues outputs.modules.darwin);
 
-  # NOTE: might be valuable to put this in it's own file
-  nix.linux-builder = {
-    enable = false;
-    systems = [
-      "aarch64-linux"
-      "x86_64-linux"
-    ];
-    ephemeral = true;
-    supportedFeatures = [
-      "kvm"
-      "benchmark"
-      "big-parallel"
-      "nixos-test"
-    ];
-    maxJobs = 4;
-    config = {
-      # Enable x86_64 emulation
-      boot.binfmt.emulatedSystems = [ "x86_64-linux" ];
-
-      virtualisation = {
-        darwin-builder = {
-          diskSize = 40 * 1024;
-          memorySize = 8 * 1024;
-        };
-        cores = 6;
-      };
-    };
-  };
-  nix.settings.system-features = [
-    "nixos-test"
-    "apple-virt"
-    "benchmark"
-    "big-parallel"
-    "kvm"
-  ];
-  # nix.settings.extra-platforms = [ "aarch64-linux" ];
-  # launchd.daemons.linux-builder = {
-  #   serviceConfig = {
-  #     StandardOutPath = "/var/log/darwin-builder.log";
-  #     StandardErrorPath = "/var/log/darwin-builder.log";
-  #   };
-  # };
-
   # NOTE: this seems to be needed to make nix work in fish
   programs.fish = {
     enable = true;

+ 58 - 0
hosts/meili/nix-builder.nix

@@ -0,0 +1,58 @@
+# NOTE: use `sudo launchctl stop org.nixos.linux-builder` to stop VM
+{ lib, ... }:
+
+let
+  systems = [
+    "aarch64-linux"
+    "x86_64-linux"
+  ];
+in
+
+{
+  nix.linux-builder = {
+    enable = true;
+    ephemeral = true;
+    maxJobs = 4;
+
+    inherit systems;
+
+    supportedFeatures = [
+      "kvm"
+      "benchmark"
+      "big-parallel"
+      "nixos-test"
+    ];
+
+    config = {
+      # Enable x86_64 emulation
+      boot.binfmt.emulatedSystems = [ "x86_64-linux" ];
+
+      virtualisation = {
+        darwin-builder = {
+          diskSize = 50 * 1024;
+          memorySize = 8 * 1024;
+        };
+        cores = 6;
+        msize = 128 * 1024;
+      };
+    };
+  };
+
+  nix.settings.extra-platforms = systems;
+  nix.settings.system-features = [
+    "nixos-test"
+    "apple-virt"
+    "benchmark"
+    "big-parallel"
+    "kvm"
+  ];
+
+  # Keep your logs! They are vital when the VM fails to boot.
+  launchd.daemons.linux-builder = {
+    serviceConfig = {
+      StandardOutPath = "/var/log/darwin-builder.log";
+      StandardErrorPath = "/var/log/darwin-builder.log";
+      KeepAlive = lib.mkForce false;
+    };
+  };
+}

+ 3 - 3
hosts/meili/software.nix

@@ -5,7 +5,7 @@
   #   - Proton Drive set up home folders
 
   environment.systemPackages = with pkgs; [
-    devenv
+    unstable.devenv
     git
     gnupg
     jq
@@ -23,8 +23,8 @@
       # "mac-mouse-fix"
       # "alacritty" # => we're using the home-manager package now
       # "bitwarden"
-      # "brave-browser"
-      "docker-desktop"
+      "brave-browser"
+      # "docker-desktop"
       # "deepl"
       "ghostty"
       # "hot"

+ 10 - 5
modules/global/nix-config.nix

@@ -1,10 +1,15 @@
-{ lib
-, pkgs
-, config
-, outputs
-, ...
+{
+  lib,
+  pkgs,
+  config,
+  outputs,
+  ...
 }:
 {
+  # FIXME: this only exists in nixos
+  # documentation.enable = false;
+  # documentation.nixos.enable = false;
+
   nix = {
     package = pkgs.nix;