Skip to content

Commit

Permalink
darwin: add linux builder
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Feb 22, 2024
1 parent 35d1145 commit 30b53c8
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
11 changes: 6 additions & 5 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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 {
Expand Down
29 changes: 29 additions & 0 deletions systems/darwin/ci.nix
Original file line number Diff line number Diff line change
@@ -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.
};
};
};
}

0 comments on commit 30b53c8

Please sign in to comment.