diff --git a/hosts/hydra/configuration.nix b/hosts/hydra/configuration.nix index 7fcddae6..f3a557e9 100644 --- a/hosts/hydra/configuration.nix +++ b/hosts/hydra/configuration.nix @@ -5,8 +5,9 @@ ./hydra.nix ./cache.nix - ./../../lib/hq.nix - ./../../lib/emery.nix + ../../lib/hq.nix + ../../lib/emery.nix + ../../lib/buildfarmer.nix ]; networking.interfaces.eth0.preferTempAddress = false; @@ -19,6 +20,7 @@ programs.mosh.enable = true; nix = { + distributedBuilds = true; package = pkgs.nixFlakes; useSandbox = false; maxJobs = lib.mkDefault 4; diff --git a/hosts/hydra/hydra.nix b/hosts/hydra/hydra.nix index 4e3f9a92..122cc15c 100644 --- a/hosts/hydra/hydra.nix +++ b/hosts/hydra/hydra.nix @@ -14,7 +14,8 @@ { hostName = "server7.hq.c3d2.de"; system = "x86_64-linux"; - maxJobs = 2; + sshUser = "buildfarmer"; + sshKey = "/root/.ssh/id_ed25519"; } ]; }; diff --git a/hosts/server7/configuration.nix b/hosts/server7/configuration.nix index 9a6a551f..cb6bd60c 100644 --- a/hosts/server7/configuration.nix +++ b/hosts/server7/configuration.nix @@ -7,6 +7,7 @@ in { ../../lib/hq.nix ../../lib/default-gateway.nix ../../lib/emery.nix + ../../lib/buildfarmer.nix ../../lib/yggdrasil.nix ./containers ./hardware-configuration.nix @@ -42,11 +43,12 @@ in { package = pkgs.nixFlakes; extraOptions = "experimental-features = nix-command flakes"; gc.automatic = true; - trustedUsers = [ "root" ]; + distributedBuilds = true; buildMachines = [{ hostName = "hydra.hq.c3d2.de"; system = "x86_64-linux"; - maxJobs = 2; + sshUser = "buildfarmer"; + sshKey = "/root/.ssh/id_ed25519"; }]; }; diff --git a/lib/buildfarmer.nix b/lib/buildfarmer.nix new file mode 100644 index 00000000..9220a0f0 --- /dev/null +++ b/lib/buildfarmer.nix @@ -0,0 +1,15 @@ +{ config, pkgs, ... }: + +{ + users.users.buildfarmer = { + isNormalUser = false; + description = "User for remote Nix builds"; + useDefaultShell = true; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMwS9B/d6QJUyZW9b52R2TlJgkI5oGDyOvzMN7H9Cz4/ hydra@hydra" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINA3x2+5ieo5QgehFHqXCYAYZSP8dxXyE1E/fSLnny8y root@serve7" + ]; + }; + + nix.trustedUsers = [ "buildfarmer" ]; +}