nix-darwin now includes linux-builder

This commit is contained in:
James Walker 2023-07-09 13:56:26 -04:00
parent 4f1f81e425
commit aee94aef3a
Signed by: walkah
GPG Key ID: 3C127179D6086E93
2 changed files with 29 additions and 78 deletions

54
flake.lock generated
View File

@ -7,11 +7,11 @@
]
},
"locked": {
"lastModified": 1688145780,
"narHash": "sha256-dNUINvO7qM7fItWSeqL2nE/F3IHCGZEeERMkm1i4pP4=",
"lastModified": 1688898859,
"narHash": "sha256-NjvwXnMp8oMQ86FHVhzlmgGy2dVDMGVLpZ4+YVsJgMU=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "43587cdb726f73b962f12028055520dbd1d7233f",
"rev": "66a3047fa88eb6aa5c5a2e675de91f0431fbe561",
"type": "github"
},
"original": {
@ -158,11 +158,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1688220547,
"narHash": "sha256-cNKKLPaEOxd6t22Mt3tHGubyylbKGdoi2A3QkMTKes0=",
"lastModified": 1688892808,
"narHash": "sha256-AeWzyG37EqyHH2C1GmrV9y0ZQ4e7rAs9AUOnw8I4YUI=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "89d10f8adce369a80e046c2fd56d1e7b7507bb5b",
"rev": "b70db52ff06f30e3de7f21b6ea47e75baa0c46f6",
"type": "github"
},
"original": {
@ -173,11 +173,11 @@
},
"nixlib": {
"locked": {
"lastModified": 1687654967,
"narHash": "sha256-ki8vItcjn8Z8n+QD9NEoCQbbbG7VzWy71hyOkFFwCkM=",
"lastModified": 1688259758,
"narHash": "sha256-CYVbYQfIm3vwciCf6CCYE+WOOLE3vcfxfEfNHIfKUJQ=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "b3ec8fb525fc0c8f08eff5ef93c684b4c6d0e777",
"rev": "a92befce80a487380ea5e92ae515fe33cebd3ac6",
"type": "github"
},
"original": {
@ -194,11 +194,11 @@
]
},
"locked": {
"lastModified": 1688003049,
"narHash": "sha256-5oSxbv8OVSg2dOvycJ9eisacxF8e52N0PVUFryWWJmE=",
"lastModified": 1688738567,
"narHash": "sha256-yax5BYOfpE0+95kyJmEcfKEdZBaFvCENDogBB4VQB3Q=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "bde0bc291c95b710dd63d5e5c422e47f760a1406",
"rev": "9191c85aab6b1a7ad395c13d340f2aa0e3ddf552",
"type": "github"
},
"original": {
@ -209,11 +209,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1686838567,
"narHash": "sha256-aqKCUD126dRlVSKV6vWuDCitfjFrZlkwNuvj5LtjRRU=",
"lastModified": 1688798314,
"narHash": "sha256-MFG5rx7L756rtrPHsL662m64AZ4sKqUcApaiYgSKfNM=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "429f232fe1dc398c5afea19a51aad6931ee0fb89",
"rev": "47dca15d86fdd2eabcf434d7cc0b5baa8d1a463c",
"type": "github"
},
"original": {
@ -225,11 +225,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1686960236,
"narHash": "sha256-AYCC9rXNLpUWzD9hm+askOfpliLEC9kwAo7ITJc4HIw=",
"lastModified": 1688679045,
"narHash": "sha256-t3xGEfYIwhaLTPU8FLtN/pLPytNeDwbLI6a7XFFBlGo=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "04af42f3b31dba0ef742d254456dc4c14eedac86",
"rev": "3c7487575d9445185249a159046cc02ff364bff8",
"type": "github"
},
"original": {
@ -241,11 +241,11 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1687031877,
"narHash": "sha256-yMFcVeI+kZ6KD2QBrFPNsvBrLq2Gt//D0baHByMrjFY=",
"lastModified": 1688868408,
"narHash": "sha256-RR9N5XTAxSBhK8MCvLq9uxfdkd7etC//seVXldy0k48=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e2e2059d19668dab1744301b8b0e821e3aae9c99",
"rev": "510d721ce097150ae3b80f84b04b13b039186571",
"type": "github"
},
"original": {
@ -257,11 +257,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1688188316,
"narHash": "sha256-CXuQllDKCxtZaB/umnZOvoJ/d4kJguYgffeTA9l1B3o=",
"lastModified": 1688859638,
"narHash": "sha256-GyRhX8GlTQqDWx43uBFEYEQ/WKEqDwjzABHxUCatAno=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8277b539d371bf4308fc5097911aa58bfac1794f",
"rev": "d485da9d0034a72ceb9679c2ab0156c073f66b82",
"type": "github"
},
"original": {
@ -294,11 +294,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1687398569,
"narHash": "sha256-e/umuIKFcFtZtWeX369Hbdt9r+GQ48moDmlTcyHWL28=",
"lastModified": 1688873469,
"narHash": "sha256-9TMSXvXmrr7bDYi+WeskWe/yho9UP01dGbV9vW5bRVc=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "2ff6973350682f8d16371f8c071a304b8067f192",
"rev": "b2047c8fc963407916ad3834165309007dc5a1f7",
"type": "github"
},
"original": {

View File

@ -1,31 +1,6 @@
{ config, nixpkgs, pkgs, ... }:
let
dataDir = "/var/lib/darwin-builder";
port = 33022;
darwin-builder = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
"${nixpkgs}/nixos/modules/profiles/macos-builder.nix"
{
system.nixos.revision = nixpkgs.lib.mkForce null;
virtualisation.host.pkgs = pkgs;
virtualisation.darwin-builder.hostPort = port;
virtualisation.darwin-builder.workingDirectory = dataDir;
}
];
};
in
{
{ config, nixpkgs, pkgs, ... }: {
nix.distributedBuilds = true;
nix.buildMachines = [
{
hostName = "builder";
systems = [ "aarch64-linux" ];
maxJobs = 4;
speedFactor = 2;
supportedFeatures = [ "kvm" "benchmark" "big-parallel" ];
}
{
hostName = "plato";
systems = [ "x86_64-linux" ];
@ -33,29 +8,5 @@ in
supportedFeatures = [ "benchmark" "big-parallel" "kvm" ];
}
];
nix.settings.builders-use-substitutes = true;
# We can't/want to edit /var/root/.ssh/config so instead we create the config at another location and tell ssh to use that instead by modifying NIX_SSHOPTS
environment.etc."nix/ssh_config".text = ''
Host builder
User builder
HostName 127.0.0.1
Port ${toString port}
IdentityFile ${dataDir}/keys/builder_ed25519
Host plato
IdentityFile /var/root/.ssh/id_plato
'';
# Tell nix-daemon to use our custom SSH config
nix.envVars = { NIX_SSHOPTS = "-F /etc/nix/ssh_config"; };
launchd.daemons.darwin-builder = {
command = "${darwin-builder.config.system.build.macos-builder-installer}/bin/create-builder";
serviceConfig = {
KeepAlive = true;
RunAtLoad = true;
StandardOutPath = "/var/log/darwin-builder.log";
StandardErrorPath = "/var/log/darwin-builder.log";
};
};
nix.linux-builder.enable = true;
}