nix-builder.nix 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # NOTE: use `sudo launchctl stop org.nixos.linux-builder` to stop VM
  2. { lib, ... }:
  3. let
  4. systems = [
  5. "aarch64-linux"
  6. "x86_64-linux"
  7. ];
  8. in
  9. {
  10. nix.linux-builder = {
  11. enable = true;
  12. ephemeral = true;
  13. maxJobs = 4;
  14. inherit systems;
  15. supportedFeatures = [
  16. "kvm"
  17. "benchmark"
  18. "big-parallel"
  19. "nixos-test"
  20. ];
  21. config = {
  22. # Enable x86_64 emulation
  23. boot.binfmt.emulatedSystems = [ "x86_64-linux" ];
  24. virtualisation = {
  25. darwin-builder = {
  26. diskSize = 50 * 1024;
  27. memorySize = 8 * 1024;
  28. };
  29. cores = 6;
  30. msize = 128 * 1024;
  31. };
  32. };
  33. };
  34. nix.settings.extra-platforms = systems;
  35. nix.settings.system-features = [
  36. "nixos-test"
  37. "apple-virt"
  38. "benchmark"
  39. "big-parallel"
  40. "kvm"
  41. ];
  42. # Keep your logs! They are vital when the VM fails to boot.
  43. launchd.daemons.linux-builder = {
  44. serviceConfig = {
  45. StandardOutPath = "/var/log/darwin-builder.log";
  46. StandardErrorPath = "/var/log/darwin-builder.log";
  47. KeepAlive = lib.mkForce false;
  48. };
  49. };
  50. }