Skip to content

Commit

Permalink
setup orbstack-builder
Browse files Browse the repository at this point in the history
  • Loading branch information
elohmeier committed Oct 23, 2024
1 parent f156e73 commit 8a7ef0d
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/darwin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ in

flake.darwinConfigurations = {
mb4 = darwinSystemFor "aarch64-darwin" [
./orbstack-builder.nix
(
{ pkgs, ... }:
{
Expand Down
42 changes: 42 additions & 0 deletions modules/darwin/orbstack-builder.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
...
}:

{
environment.etc."ssh/ssh_config.d/100-linux-builder.conf".text = ''
Host linux-builder
User builder
Hostname localhost
HostKeyAlias linux-builder
Port 31022
IdentityFile /etc/nix/builder_ed25519
'';

nix.distributedBuilds = true;

nix.buildMachines = [
{
hostName = "linux-builder";
sshUser = "builder";
sshKey = "/etc/nix/builder_ed25519";
publicHostKey = "c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSUxoT2tPWDVIcG13ZjdDWWlZMnNWQWZ5T1FTM3pNUTJWeXVPRWhPTXhQVGEgcm9vdEBuaXhvcy1idWlsZGVyCg==";
maxJobs = 4;
protocol = "ssh-ng";
speedFactor = 1;
supportedFeatures = [
"kvm"
"benchmark"
"big-parallel"
];
systems = [
"x86_64-linux"
"aarch64-linux"
];
}
];

nix.settings = {
builders-use-substitutes = true;
trusted-users = [ "enno" ];
};
}
6 changes: 6 additions & 0 deletions modules/nixos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,11 @@ in
}
)
];

orb-nixos-builder = nixosSystemFor "aarch64-linux" [
self.nixosModules.defaults
self.nixosModules.orbstack-defaults
./orbstack-builder.nix
];
};
}
37 changes: 37 additions & 0 deletions modules/nixos/orbstack-builder.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
lib,
pkgs,
...
}:

let
user = "builder";
in
{
environment.systemPackages = [ pkgs.btop ];

networking.hostName = "nixos-builder";

services.openssh = {
enable = lib.mkForce true;
ports = [ 31022 ];
};

documentation.enable = lib.mkForce false;

nix.channel.enable = false;

nix.settings = {
auto-optimise-store = true;
min-free = 1024 * 1024 * 1024;
max-free = 3 * 1024 * 1024 * 1024;
trusted-users = [ user ];
};

users.users."${user}" = {
isNormalUser = true;
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOtB32gQF96zxxtDazLlmFTZANch/2MNlU+2nmMos8cs builder@localhost"
];
};
}

0 comments on commit 8a7ef0d

Please sign in to comment.