@ -49,7 +49,7 @@
( define-configuration clash-configuration
( define-configuration clash-configuration
( clash
( clash
( file-like clash -bin)
( file-like mihomo -bin)
"The clash package." )
"The clash package." )
( log-file
( log-file
@ -70,23 +70,15 @@
( no-serialization ) )
( no-serialization ) )
( define %clash-accounts
( define %clash-accounts
( list ( user-group ( name "clash" ) ( system? #t ) )
( 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" ) ) ) ) )
( define clash-activation
( define clash-activation
( match-record-lambda <clash-configuration>
( match-record-lambda <clash-configuration>
( clash log-file data-directory config )
( data-directory config )
# ~ ( begin
# ~ ( begin
( use-modules ( guix build utils ) )
( use-modules ( guix build utils ) )
( let ( ( config-dest ( string-append # $data-directory "/config.yaml" ) )
( let ( ( config-dest ( string-append # $data-directory "/config.yaml" ) ) )
( user ( getpwnam "clash" ) ) )
( mkdir-p # $data-directory )
( mkdir-p # $data-directory )
( chown # $data-directory ( passwd:uid user ) ( passwd:gid user ) )
( if ( file-exists? config-dest )
( if ( file-exists? config-dest )
( delete-file config-dest ) )
( delete-file config-dest ) )
( symlink # $config config-dest ) ) ) ) )
( symlink # $config config-dest ) ) ) ) )
@ -97,7 +89,7 @@
( define clash-shepherd-service
( define clash-shepherd-service
( match-record-lambda <clash-configuration>
( match-record-lambda <clash-configuration>
( clash log-file data-directory config shepherd-provision )
( clash log-file data-directory shepherd-provision )
( list ( shepherd-service
( list ( shepherd-service
( documentation "Run clash." )
( documentation "Run clash." )
( provision shepherd-provision )
( provision shepherd-provision )
@ -111,7 +103,6 @@
mihomo-cmd
mihomo-cmd
clash-cmd ) )
clash-cmd ) )
"-d" # $data-directory )
"-d" # $data-directory )
# :user "clash"
# :group "clash"
# :group "clash"
# :log-file # $log-file ) )
# :log-file # $log-file ) )
( stop # ~ ( make-kill-destructor ) )
( stop # ~ ( make-kill-destructor ) )