feat(build): enable distributed builds and caching setup

- Added Nix distributed build configuration for multiple machines.
- Introduced caching setup with substituters and sandbox paths.
- Enabled optional build configurations with ccache support.
This commit is contained in:
Harald Hoyer 2025-11-13 09:40:08 +01:00
parent 55af1a9cad
commit 143e8cbf98
5 changed files with 127 additions and 5 deletions

View file

@ -4,6 +4,45 @@ with lib.metacfg;
{
system.defaults.dock.autohide = false;
nix.distributedBuilds = true;
nix.buildMachines = [
{
hostName = "m1.local";
system = "aarch64-darwin";
maxJobs = 4;
speedFactor = 2;
sshUser = "harald";
sshKey = "/etc/ssh/nix-builder-key";
}
{
hostName = "rialo.local";
system = "aarch64-darwin";
maxJobs = 4;
speedFactor = 2;
sshUser = "harald";
sshKey = "/etc/ssh/nix-builder-key";
}
{
hostName = "sgx.local";
system = "x86_64-linux";
maxJobs = 4;
speedFactor = 1;
sshUser = "harald";
sshKey = "/etc/ssh/nix-builder-key";
}
];
nix.settings = {
substituters = [
"https://cache.nixos.org"
"ssh-ng://harald@m4.local?ssh-key=/etc/ssh/nix-builder-key"
"ssh-ng://harald@rialo.local?ssh-key=/etc/ssh/nix-builder-key"
];
builders-use-substitutes = true;
};
homebrew = {
enable = true;
brews = [
@ -27,6 +66,7 @@ with lib.metacfg;
direnv.enable = true;
alacritty.enable = true;
};
build.enable = true;
};
environment.systemPackages = with pkgs; [

View file

@ -2,6 +2,48 @@
with lib.metacfg;
{
nix.distributedBuilds = true;
nix.buildMachines = [
{
hostName = "m1.local";
system = "aarch64-darwin";
maxJobs = 4;
speedFactor = 2;
sshUser = "harald";
sshKey = "/etc/ssh/nix-builder-key";
}
{
hostName = "rialo.local";
system = "aarch64-darwin";
maxJobs = 4;
speedFactor = 2;
sshUser = "harald";
sshKey = "/etc/ssh/nix-builder-key";
}
{
hostName = "sgx.local";
system = "x86_64-linux";
maxJobs = 4;
speedFactor = 1;
sshUser = "harald";
sshKey = "/etc/ssh/nix-builder-key";
}
];
nix.settings = {
substituters = [
"https://cache.nixos.org"
"ssh-ng://harald@m4.local?ssh-key=/etc/ssh/nix-builder-key"
"ssh-ng://harald@rialo.local?ssh-key=/etc/ssh/nix-builder-key"
];
builders-use-substitutes = true;
};
homebrew = {
enable = true;
brews = [
@ -25,6 +67,7 @@ with lib.metacfg;
direnv.enable = true;
alacritty.enable = true;
};
build.enable = true;
};
environment.systemPackages = with pkgs; [