From 9b2bfc95ea14be45a68065b24608bcf2f1aaabff Mon Sep 17 00:00:00 2001 From: yaroslav Date: Tue, 23 Sep 2025 23:01:16 +0300 Subject: [PATCH] added distributed build --- flake.nix | 2 ++ hosts/Aphelion/Aphelion_misc.nix | 17 +++++++++++++++++ hosts/Ratchet/hardware-Ratchet.nix | 2 ++ hosts/Ratchet/misc_Ratchet.nix | 24 ++++++++++++++++++++++++ hosts/generic/users.nix | 2 +- 5 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 hosts/Ratchet/misc_Ratchet.nix diff --git a/flake.nix b/flake.nix index 237bb46..54685e9 100644 --- a/flake.nix +++ b/flake.nix @@ -37,11 +37,13 @@ specialArgs = { inherit inputs; }; modules = [ impermanence.nixosModules.impermanence + chaotic.nixosModules.default asus-numberpad-driver.nixosModules.default ./hosts/generic/configuration_generic.nix ./hosts/generic/users.nix ./hosts/Ratchet/hardware-Ratchet.nix ./hosts/Ratchet/fingerprint.nix + ./hosts/Ratchet/misc_Ratchet.nix ./hosts/generic/persistence.nix ./hosts/generic/cups.nix ./desktop/kde.nix diff --git a/hosts/Aphelion/Aphelion_misc.nix b/hosts/Aphelion/Aphelion_misc.nix index 179af41..2f16739 100644 --- a/hosts/Aphelion/Aphelion_misc.nix +++ b/hosts/Aphelion/Aphelion_misc.nix @@ -23,5 +23,22 @@ networking.interfaces.enp12s0.wakeOnLan.enable = true; networking.interfaces.enp12s0.wakeOnLan.policy = [ "magic" ]; + + # build substituter + users.users.nixremote = { + isNormalUser = true; + createHome = false; + group = "nixremote"; + + openssh.authorizedKeys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIt6Ts4SNWXv2hObOOKyyxXr/6iZBRZXEwE0mtEpCa8X root@Ratchet" + ]; + }; + + users.groups.remotebuild = {}; + + services.nix-serve.secretKeyFile = "/home/store_secret.pem"; + + nix.settings.trusted-users = [ "nixremote" ]; } diff --git a/hosts/Ratchet/hardware-Ratchet.nix b/hosts/Ratchet/hardware-Ratchet.nix index 5279cc0..ffbab49 100644 --- a/hosts/Ratchet/hardware-Ratchet.nix +++ b/hosts/Ratchet/hardware-Ratchet.nix @@ -68,6 +68,8 @@ }; }; + chaotic.mesa-git.enable = true; + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's # still possible to use this option, but it's recommended to use it in conjunction diff --git a/hosts/Ratchet/misc_Ratchet.nix b/hosts/Ratchet/misc_Ratchet.nix new file mode 100644 index 0000000..6d8cc30 --- /dev/null +++ b/hosts/Ratchet/misc_Ratchet.nix @@ -0,0 +1,24 @@ +{ config, pkgs, ...}: +{ + nix.buildMachines = [ { + hostName = "Aphelion"; + 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 = 16; + 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 + ''; + nix.settings.trusted-public-keys = [ + "Aphelion:8l9lrL3kszDTXkpA/R4ZFhSifiBoogiOIt1srgLb6Vw=" + ]; + +} diff --git a/hosts/generic/users.nix b/hosts/generic/users.nix index 2f4b2c2..e6472a8 100644 --- a/hosts/generic/users.nix +++ b/hosts/generic/users.nix @@ -11,7 +11,7 @@ initialHashedPassword = "$6$.r5fJE91KtrOA2T.$JVjtzlFWx.RsTsNmO5WOsi1MhK6TUTKo8K5F2GgG.bAXYuYjGu4sK3SMzhk4oJ9FBoAcnyHmk7sLMsgLbUeoE1"; openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEUF1XU/l++LwgpasO5mO141gftk97/viBTRSO9cJD0u yaroslav@Ratchet" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINgYswQa7LdwBpNkiw73du4nocbbET9FXKzWtjivBwHv yaroslav@Aphelion" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIOIbrPzjI1OF+af5Js69ZSbw7EwpIBcndp+LQvWHtOE yaroslav@Aphelion" ]; }; users.users.root = {