diff --git a/machines/moritz-desktop/configuration.nix b/machines/moritz-desktop/configuration.nix index caa4153..ba902e0 100644 --- a/machines/moritz-desktop/configuration.nix +++ b/machines/moritz-desktop/configuration.nix @@ -23,10 +23,7 @@ # This only works however if you have avahi running on your admin machine else use IP clan.core.networking.targetHost = "root@moritz-desktop"; - our.buildMachines = { - enable = true; - speedFactor = 2; - }; + our.buildMachines.enable = true; my = { ai.enable = true; diff --git a/modules/remote_builders.nix b/modules/remote_builders.nix index 241d3d1..2cb7e2b 100644 --- a/modules/remote_builders.nix +++ b/modules/remote_builders.nix @@ -21,33 +21,38 @@ others = filterAttrs (n: _v: n != config.networking.hostName) self.nixosConfigurations; - max = a: b: - if a > b - then a - else b; - mkBuilder = hostName: attrs: let config' = attrs.config; cfg' = config'.our.buildMachines; pkgs' = attrs.pkgs; in mkIf cfg'.enable { - hostName = hostName; - sshUser = "remotebuild"; + # NOTE: https://github.com/NixOS/nix/issues/3177 + hostName = + if hostName == config.networking.hostName + then "local?root=/nix/store" + else hostName; + sshUser = + if hostName == config.networking.hostName + then null + else "remotebuild"; # CPU architecture of the builder, and the operating system it runs. # If your builder supports multiple architectures # (e.g. search for "binfmt" for emulation), systems = [pkgs'.system] ++ config'.boot.binfmt.emulatedSystems; # Nix custom ssh-variant that avoids lots of "trusted-users" settings pain - protocol = "ssh-ng"; + protocol = + if hostName == config.networking.hostName + then null + else "ssh-ng"; # default is 1 but may keep the builder idle in between builds maxJobs = 3; - speedFactor = max (cfg'.speedFactor - cfg.speedFactor + 1) 1; + speedFactor = 1; supportedFeatures = cfg'.supportedFeatures; mandatoryFeatures = []; }; - buildMachines = mapAttrsToList mkBuilder others; + buildMachines = mapAttrsToList mkBuilder self.nixosConfigurations; remotebuildKeys = mapAttrsToList ( @@ -81,11 +86,6 @@ in { benchmark | Machine can generate metrics (means the builds usually takes the same amount of time) ''; }; - speedFactor = mkOption { - type = types.int; - default = 1; - description = "How fast is the builder compared to your local machine"; - }; }; config = mkIf cfg.enable { users.users.remotebuild = {