darwin: add linux builder

This commit is contained in:
Sridhar Ratnakumar 2024-02-22 13:55:43 -05:00
parent 35d1145189
commit 30b53c8f72
3 changed files with 38 additions and 6 deletions

11
flake.lock generated
View file

@ -914,15 +914,16 @@
]
},
"locked": {
"lastModified": 1708231718,
"narHash": "sha256-IZdieFWvhBkxoOFMDejqLUYqD94WN6k0YSpw0DFy+4g=",
"owner": "lnl7",
"lastModified": 1708541070,
"narHash": "sha256-dhi3XXT662o1FtP/Li2dIwcQCco6nhT+Yv71dptTlSw=",
"owner": "LoganBarnett",
"repo": "nix-darwin",
"rev": "0e6857fa1d632637488666c08e7b02c08e3178f8",
"rev": "27e6a022f25b94010fdb8e5fbbb79608dc589397",
"type": "github"
},
"original": {
"owner": "lnl7",
"owner": "LoganBarnett",
"ref": "linux-builder-big-config",
"repo": "nix-darwin",
"type": "github"
}

View file

@ -5,7 +5,8 @@
# Principle inputs
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
nix-darwin.url = "github:lnl7/nix-darwin";
# nix-darwin.url = "github:lnl7/nix-darwin";
nix-darwin.url = "github:LoganBarnett/nix-darwin/linux-builder-big-config"; # https://github.com/LnL7/nix-darwin/pull/878 (for 'systems')
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
@ -113,6 +114,7 @@
imports = [
self.darwinModules.default # Defined in nix-darwin/default.nix
./systems/darwin.nix
./systems/darwin/ci.nix
];
};
naivete = self.nixos-flake.lib.mkMacosSystem {

29
systems/darwin/ci.nix Normal file
View file

@ -0,0 +1,29 @@
{ ... }:
{
# TODO: GitHub Runners
# To build Linux derivations whilst on macOS.
#
# NOTES:
# - To SSH, `sudo su -` and then `ssh -i /etc/nix/builder_ed25519 builder@linux-builder`.
# Unfortunately, a simple `ssh linux-builder` will not work (Too many authentication failures).
# - To update virtualisation configuration, you have to disable, delete
# /private/var/lib/darwin-builder/ and re-enable.
nix.linux-builder = {
enable = true;
systems = [
"x86_64-linux"
"aarch64-linux"
];
config = { pkgs, lib, ... }: {
boot.binfmt.emulatedSystems = [ "x86_64-linux" ];
virtualisation = {
# Larger linux-builder cores, ram, and disk.
cores = 6;
memorySize = lib.mkForce (1024 * 16);
diskSize = lib.mkForce (1024 * 1); # In MB.
};
};
};
}