From cfe57d1d90e6b7d3041e6ad43f93d407a10bd210 Mon Sep 17 00:00:00 2001 From: Timo Wilken Date: Sun, 4 Jun 2023 00:25:22 +0200 Subject: Set up offloading from laptop to servers --- tw/system/lap.scm | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'tw/system') diff --git a/tw/system/lap.scm b/tw/system/lap.scm index 1bcc0d78..4c63da44 100644 --- a/tw/system/lap.scm +++ b/tw/system/lap.scm @@ -367,6 +367,37 @@ support extra features (acr, pmu, gr).") (extra-special-file "/etc/NetworkManager/dispatcher.d/09-set-timezone" (program-file "set-timezone" set-timezone-script)) + (extra-special-file "/etc/guix/machines.scm" + (scheme-file "machines.scm" + #~(let ((lud (build-machine + (name "lud.twilken.net") + (systems '("x64_64-linux")) + (port '#$(assoc-ref %ssh-ports "lud.twilken.net")) + (host-key "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGqXbxv3a2bZyGjnEirVCMtRBeLKW/ha8ULSR9Xye4Z1") + (user "timo") + (private-key "/home/timo/.local/share/ssh-keys/id_rsa") + (speed .5))) ; 4 cores, 8 GB RAM + (vin (build-machine + (name "vin.twilken.net") + (systems '("x64_64-linux")) + (port '#$(assoc-ref %ssh-ports "vin.twilken.net")) + (host-key "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEEpdfKxzoCwg53TKPF5YxgUwhGF+bELAyBGdxagQroJ") + (user "timo") + (private-key "/home/timo/.local/share/ssh-keys/id_rsa") + (speed 1.)))) ; 8 cores, 16 GB RAM + (use-modules (ice-9 popen) + (ice-9 textual-ports) + (ice-9 regex)) + (let* ((regexp (make-regexp "^GENERAL\\.CONNECTION:[[:space:]]+TLAN$" regexp/newline)) + (pipe (open-pipe* OPEN_READ #$(file-append network-manager "/bin/nmcli") + "device" "show" "wlp3s0")) + (at-home? (regexp-exec regexp (get-string-all pipe)))) + (close-pipe pipe) + ;; Only offload to vin when at home, as the network connection is too bad otherwise. + (if at-home? + (list lud vin) + (list lud)))))) + (modify-services (append %system-channel-services %desktop-services) (gdm-service-type config => -- cgit v1.2.3