Setup distributed

This commit is contained in:
Sridhar Ratnakumar 2024-03-26 16:48:20 -04:00
parent 3b4431b8c5
commit cede676eb0
2 changed files with 34 additions and 1 deletions

View file

@ -8,6 +8,25 @@
../nix-darwin/zsh-completion-fix.nix
];
# Github runner CI
users = {
knownUsers = [ "github-runner" ];
forceRecreate = true;
users.github-runner = {
uid = 1009;
description = "GitHub Runner";
home = "/Users/github-runner";
createHome = true;
shell = pkgs.bashInteractive;
# NOTE: Go to macOS Remote-Login settings and allow all users to ssh.
openssh.authorizedKeys.keys = [
# github-runner VM's /etc/ssh/ssh_host_ed25519_key.pub
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJUJvyuUnIs2q2TkJq29wqJ6HyOAeMmIK8PcH7xAlpVY root@github-runner"
];
};
};
nix.settings.trusted-users = [ "github-runner" ];
nixpkgs.hostPlatform = "aarch64-darwin";
environment.systemPackages = with pkgs; [

View file

@ -2,8 +2,9 @@
# - [x] Intial config
# - [x] Colmena deploy, with keys from 1Password.
# - [x] Github Runners
# - [ ] Distributed builder to host (macOS)
# - [x] Distributed builder to host (macOS)
# - [x] Refactor, to allow multiple repos (then remove easy-github-runners.nix)
# - [ ] Refactor into own dir
{ flake, pkgs, lib, ... }:
let
@ -29,6 +30,7 @@ let
];
url = "https://github.com/${user}/${repoName}";
})));
hostIP = "10.37.129.2"; # Find out using `ifconfig` on host, looking for bridge101
in
{
imports = [
@ -62,4 +64,16 @@ in
services.github-runners = mkPersonalRunners "srid" {
perpetuum.num = 2;
};
# macOS remote builder
nix.distributedBuilds = true;
nix.buildMachines = [{
hostName = hostIP;
systems = [ "aarch64-darwin" "x86_64-darwin" ];
# supportedFeatures = [ "kvm" "benchmark" "big-parallel" ];
maxJobs = 6; # 6 cores
protocol = "ssh-ng";
sshUser = user;
sshKey = "/etc/ssh/ssh_host_ed25519_key";
}];
}