diff --git a/configurations/desktop/configuration.nix b/configurations/desktop/configuration.nix index f489bed4..0a8c9c10 100644 --- a/configurations/desktop/configuration.nix +++ b/configurations/desktop/configuration.nix @@ -39,6 +39,14 @@ cspark-desktop-niri.enable = true; # cspark-desktop-exwm.enable = true; + # This user handles building packages remotely for my laptop + users.users.nixremotebuilder = { + isNormalUser = true; + description = "Nix Remote Builder"; + openssh.authorizedKeys.keyFiles = ./resources/nixos/.ssh/cspark-desktop-nixremotebuilder.pub; + }; + nix.settings.trusted-users = [ "root" "nixremotebuilder" "@wheel" ]; + # My audio interface has issues after coming out from suspend/hibernate, this will reset it to fix it when necessary. systemd.services.audiointerface-reset-unbind = { description = "Resets audio interface to clear up any issues - de-initialises audio interface before sleeping/hibernating/shutting down"; diff --git a/configurations/desktop/resources/nixos/.ssh/cspark-desktop-nixremotebuilder.pub b/configurations/desktop/resources/nixos/.ssh/cspark-desktop-nixremotebuilder.pub new file mode 100644 index 00000000..c86f21f4 --- /dev/null +++ b/configurations/desktop/resources/nixos/.ssh/cspark-desktop-nixremotebuilder.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ+mt7zo89rAZqLpBFoONKPXsqA3+B3V2qccS2gjs8Bc root@cspark-nixos-laptop diff --git a/configurations/laptop/configuration.nix b/configurations/laptop/configuration.nix index e1b3d11f..3b1e4765 100644 --- a/configurations/laptop/configuration.nix +++ b/configurations/laptop/configuration.nix @@ -26,6 +26,42 @@ networking.networkmanager.enable = true; # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + # Setting up my desktop computer to be able to build files for my laptop + # Make remote builder desktop a known host + programs.ssh = { + knownHosts = { + cspark-desktop-nixremotebuilder = { + extraHostNames = [ "cspark-nixos-desktop" "192.168.1.110" ]; + publicKeyFile = ./resources/nixos/.ssh/cspark-desktop-nixremotebuilder.pub; + }; + }; + extraConfig = '' + Host cspark-desktop-nixremotebuilder + IdentitiesOnly yes + IdentityFile /root/.ssh/cspark-desktop-nixremotebuilder + # The weakly privileged user on the remote builder – if not set, 'root' is used – which will hopefully fail + User nixremotebuilder + ''; + }; + nix.buildMachines = [ { + hostName = "cspark-desktop-nixremotebuilder"; + sshUser = "nixremotebuilder"; + system = "x86_64-linux"; + protocol = "ssh-ng"; + # if the builder supports building for multiple architectures, + # replace the previous line by, e.g. + # systems = ["x86_64-linux" "aarch64-linux"]; + maxJobs = 1; + speedFactor = 2; + supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ]; + mandatoryFeatures = [ ]; + }] ; + nix.distributedBuilds = true; + # optional, useful when the builder has a faster internet connection than yours + nix.extraOptions = '' + builders-use-substitutes = true + ''; + # Custom desktop environments # cspark-desktop-plasma.enable = true; # cspark-desktop-gnome.enable = true; diff --git a/configurations/laptop/resources/nixos/.ssh/cspark-desktop-nixremotebuilder.pub b/configurations/laptop/resources/nixos/.ssh/cspark-desktop-nixremotebuilder.pub new file mode 100644 index 00000000..c86f21f4 --- /dev/null +++ b/configurations/laptop/resources/nixos/.ssh/cspark-desktop-nixremotebuilder.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ+mt7zo89rAZqLpBFoONKPXsqA3+B3V2qccS2gjs8Bc root@cspark-nixos-laptop diff --git a/global.nix b/global.nix index bd0eee3f..449209e0 100644 --- a/global.nix +++ b/global.nix @@ -300,6 +300,7 @@ texliveFull ripgrep + fd fzf yazi