From fb0a73108e0e9d580caa50e6746b9343a83057bb Mon Sep 17 00:00:00 2001 From: Hilton Chain Date: Thu, 31 Oct 2024 13:50:43 +0800 Subject: [PATCH] services: clash: Run as root. Process name related matching is only available to root user. This commit also changes the default clash implementation to mihomo. * rosenthal/services/child-error.scm (clash-configuration) [clash]: Use mihomo-bin. (%clash-accounts): Remove user account "clash". (clash-activation): Don't change directory owner. (clash-shepherd-service)[start]<#:user>: Remove. --- rosenthal/services/child-error.scm | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/rosenthal/services/child-error.scm b/rosenthal/services/child-error.scm index 8efcbfb..15f7e9e 100644 --- a/rosenthal/services/child-error.scm +++ b/rosenthal/services/child-error.scm @@ -49,7 +49,7 @@ (define-configuration clash-configuration (clash - (file-like clash-bin) + (file-like mihomo-bin) "The clash package.") (log-file @@ -70,23 +70,15 @@ (no-serialization)) (define %clash-accounts - (list (user-group (name "clash") (system? #t)) - (user-account - (name "clash") - (group "clash") - (system? #t) - (home-directory "/var/empty") - (shell (file-append shadow "/sbin/nologin"))))) + (list (user-group (name "clash") (system? #t)))) (define clash-activation (match-record-lambda - (clash log-file data-directory config) + (data-directory config) #~(begin (use-modules (guix build utils)) - (let ((config-dest (string-append #$data-directory "/config.yaml")) - (user (getpwnam "clash"))) + (let ((config-dest (string-append #$data-directory "/config.yaml"))) (mkdir-p #$data-directory) - (chown #$data-directory (passwd:uid user) (passwd:gid user)) (if (file-exists? config-dest) (delete-file config-dest)) (symlink #$config config-dest))))) @@ -97,7 +89,7 @@ (define clash-shepherd-service (match-record-lambda - (clash log-file data-directory config shepherd-provision) + (clash log-file data-directory shepherd-provision) (list (shepherd-service (documentation "Run clash.") (provision shepherd-provision) @@ -111,7 +103,6 @@ mihomo-cmd clash-cmd)) "-d" #$data-directory) - #:user "clash" #:group "clash" #:log-file #$log-file)) (stop #~(make-kill-destructor))