fix: remote building to also use localhost
This commit is contained in:
parent
184ef24913
commit
086ff8fa1c
2 changed files with 16 additions and 19 deletions
|
|
@ -23,10 +23,7 @@
|
||||||
# This only works however if you have avahi running on your admin machine else use IP
|
# This only works however if you have avahi running on your admin machine else use IP
|
||||||
clan.core.networking.targetHost = "root@moritz-desktop";
|
clan.core.networking.targetHost = "root@moritz-desktop";
|
||||||
|
|
||||||
our.buildMachines = {
|
our.buildMachines.enable = true;
|
||||||
enable = true;
|
|
||||||
speedFactor = 2;
|
|
||||||
};
|
|
||||||
|
|
||||||
my = {
|
my = {
|
||||||
ai.enable = true;
|
ai.enable = true;
|
||||||
|
|
|
||||||
|
|
@ -21,33 +21,38 @@
|
||||||
|
|
||||||
others = filterAttrs (n: _v: n != config.networking.hostName) self.nixosConfigurations;
|
others = filterAttrs (n: _v: n != config.networking.hostName) self.nixosConfigurations;
|
||||||
|
|
||||||
max = a: b:
|
|
||||||
if a > b
|
|
||||||
then a
|
|
||||||
else b;
|
|
||||||
|
|
||||||
mkBuilder = hostName: attrs: let
|
mkBuilder = hostName: attrs: let
|
||||||
config' = attrs.config;
|
config' = attrs.config;
|
||||||
cfg' = config'.our.buildMachines;
|
cfg' = config'.our.buildMachines;
|
||||||
pkgs' = attrs.pkgs;
|
pkgs' = attrs.pkgs;
|
||||||
in
|
in
|
||||||
mkIf cfg'.enable {
|
mkIf cfg'.enable {
|
||||||
hostName = hostName;
|
# NOTE: https://github.com/NixOS/nix/issues/3177
|
||||||
sshUser = "remotebuild";
|
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.
|
# CPU architecture of the builder, and the operating system it runs.
|
||||||
# If your builder supports multiple architectures
|
# If your builder supports multiple architectures
|
||||||
# (e.g. search for "binfmt" for emulation),
|
# (e.g. search for "binfmt" for emulation),
|
||||||
systems = [pkgs'.system] ++ config'.boot.binfmt.emulatedSystems;
|
systems = [pkgs'.system] ++ config'.boot.binfmt.emulatedSystems;
|
||||||
# Nix custom ssh-variant that avoids lots of "trusted-users" settings pain
|
# 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
|
# default is 1 but may keep the builder idle in between builds
|
||||||
maxJobs = 3;
|
maxJobs = 3;
|
||||||
speedFactor = max (cfg'.speedFactor - cfg.speedFactor + 1) 1;
|
speedFactor = 1;
|
||||||
supportedFeatures = cfg'.supportedFeatures;
|
supportedFeatures = cfg'.supportedFeatures;
|
||||||
mandatoryFeatures = [];
|
mandatoryFeatures = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
buildMachines = mapAttrsToList mkBuilder others;
|
buildMachines = mapAttrsToList mkBuilder self.nixosConfigurations;
|
||||||
|
|
||||||
remotebuildKeys =
|
remotebuildKeys =
|
||||||
mapAttrsToList (
|
mapAttrsToList (
|
||||||
|
|
@ -81,11 +86,6 @@ in {
|
||||||
benchmark | Machine can generate metrics (means the builds usually takes the same amount of time)
|
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 {
|
config = mkIf cfg.enable {
|
||||||
users.users.remotebuild = {
|
users.users.remotebuild = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue