aboutsummaryrefslogtreecommitdiff
path: root/tw/system/lap.scm
diff options
context:
space:
mode:
authorTimo Wilken2023-06-04 00:25:22 +0200
committerTimo Wilken2023-06-04 00:25:22 +0200
commitcfe57d1d90e6b7d3041e6ad43f93d407a10bd210 (patch)
tree583586e5be4af3270437af406c2bd14f48bf532a /tw/system/lap.scm
parent1bb96ebf8b93b856de64d7bb02c8fb47254932cb (diff)
Set up offloading from laptop to servers
Diffstat (limited to 'tw/system/lap.scm')
-rw-r--r--tw/system/lap.scm31
1 files changed, 31 insertions, 0 deletions
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 =>