mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
services: greetd: Add gexp compilers for sessions.
* gnu/home/services/base.scm (make-greetd-agreety-session-command, greetd-wlgreet-sway-session-command, make-greetd-default-session-command): Remove variables. (greetd-agreety-session-compiler, greetd-wlgreet-sway-session-compiler): New gexp compilers. (greetd-terminal-configuration)[default-session-command]<sanitize>: Remove it. Signed-off-by: Andrew Tropin <andrew@trop.in>
This commit is contained in:
parent
7de6aa8a0a
commit
fdc9e1b27e
1 changed files with 30 additions and 35 deletions
|
@ -2900,11 +2900,18 @@ (define greetd-agreety-tty-xdg-session-command
|
||||||
(quote (#$@extra-env)))
|
(quote (#$@extra-env)))
|
||||||
(apply execl #$command #$command (list #$@args)))))))
|
(apply execl #$command #$command (list #$@args)))))))
|
||||||
|
|
||||||
(define (make-greetd-agreety-session-command config command)
|
(define-gexp-compiler (greetd-agreety-session-compiler
|
||||||
(let ((agreety (file-append (greetd-agreety config) "/bin/agreety")))
|
(session <greetd-agreety-session>)
|
||||||
(program-file
|
system target)
|
||||||
"agreety-command"
|
(let ((agreety (file-append (greetd-agreety session)
|
||||||
#~(execl #$agreety #$agreety "-c" #$command))))
|
"/bin/agreety"))
|
||||||
|
(command ((if (greetd-agreety-xdg-env? session)
|
||||||
|
greetd-agreety-tty-xdg-session-command
|
||||||
|
greetd-agreety-tty-session-command)
|
||||||
|
session)))
|
||||||
|
(lower-object
|
||||||
|
(program-file "agreety-command"
|
||||||
|
#~(execl #$agreety #$agreety "-c" #$command)))))
|
||||||
|
|
||||||
(define-record-type* <greetd-wlgreet-session>
|
(define-record-type* <greetd-wlgreet-session>
|
||||||
greetd-wlgreet-session make-greetd-wlgreet-session
|
greetd-wlgreet-session make-greetd-wlgreet-session
|
||||||
|
@ -2991,37 +2998,26 @@ (define (make-wlgreet-sway-configuration-file session)
|
||||||
"exec \"" wlgreet " --config " wlgreet-config "; "
|
"exec \"" wlgreet " --config " wlgreet-config "; "
|
||||||
swaymsg " exit\"\n")))
|
swaymsg " exit\"\n")))
|
||||||
|
|
||||||
(define (greetd-wlgreet-sway-session-command session)
|
(define-gexp-compiler (greetd-wlgreet-sway-session-compiler
|
||||||
|
(session <greetd-wlgreet-sway-session>)
|
||||||
|
system target)
|
||||||
(let ((sway (file-append (greetd-wlgreet-sway-session-sway session)
|
(let ((sway (file-append (greetd-wlgreet-sway-session-sway session)
|
||||||
"/bin/sway"))
|
"/bin/sway"))
|
||||||
(config (make-wlgreet-sway-configuration-file session)))
|
(config (make-wlgreet-sway-configuration-file session)))
|
||||||
(program-file "wlgreet-sway-session-command"
|
(lower-object
|
||||||
#~(let* ((log-file (open-output-file
|
(program-file "wlgreet-sway-session-command"
|
||||||
(string-append "/tmp/sway-greeter."
|
#~(let* ((log-file (open-output-file
|
||||||
(number->string (getpid))
|
(string-append "/tmp/sway-greeter."
|
||||||
".log")))
|
(number->string (getpid))
|
||||||
(username (getenv "USER"))
|
".log")))
|
||||||
(useruid (number->string (passwd:uid (getpwuid username)))))
|
(username (getenv "USER"))
|
||||||
;; redirect stdout/err to log-file
|
(useruid (number->string (passwd:uid (getpwuid username)))))
|
||||||
(dup2 (fileno log-file) 1)
|
;; redirect stdout/err to log-file
|
||||||
(dup2 1 2)
|
(dup2 (fileno log-file) 1)
|
||||||
(sleep 1) ;give seatd/logind some time to start up
|
(dup2 1 2)
|
||||||
(setenv "XDG_RUNTIME_DIR" (string-append "/run/user/" useruid))
|
(sleep 1) ;give seatd/logind some time to start up
|
||||||
(execl #$sway #$sway "-d" "-c" #$config)))))
|
(setenv "XDG_RUNTIME_DIR" (string-append "/run/user/" useruid))
|
||||||
|
(execl #$sway #$sway "-d" "-c" #$config))))))
|
||||||
(define (make-greetd-default-session-command config-or-command)
|
|
||||||
(cond ((greetd-agreety-session? config-or-command)
|
|
||||||
(cond ((greetd-agreety-xdg-env? config-or-command)
|
|
||||||
(make-greetd-agreety-session-command
|
|
||||||
config-or-command
|
|
||||||
(greetd-agreety-tty-xdg-session-command config-or-command)))
|
|
||||||
(#t
|
|
||||||
(make-greetd-agreety-session-command
|
|
||||||
config-or-command
|
|
||||||
(greetd-agreety-tty-session-command config-or-command)))))
|
|
||||||
((greetd-wlgreet-sway-session? config-or-command)
|
|
||||||
(greetd-wlgreet-sway-session-command config-or-command))
|
|
||||||
(#t config-or-command)))
|
|
||||||
|
|
||||||
(define-record-type* <greetd-terminal-configuration>
|
(define-record-type* <greetd-terminal-configuration>
|
||||||
greetd-terminal-configuration make-greetd-terminal-configuration
|
greetd-terminal-configuration make-greetd-terminal-configuration
|
||||||
|
@ -3035,8 +3031,7 @@ (define-record-type* <greetd-terminal-configuration>
|
||||||
(terminal-switch greetd-terminal-switch (default #f))
|
(terminal-switch greetd-terminal-switch (default #f))
|
||||||
(default-session-user greetd-default-session-user (default "greeter"))
|
(default-session-user greetd-default-session-user (default "greeter"))
|
||||||
(default-session-command greetd-default-session-command
|
(default-session-command greetd-default-session-command
|
||||||
(default (greetd-agreety-session))
|
(default (greetd-agreety-session))))
|
||||||
(sanitize make-greetd-default-session-command)))
|
|
||||||
|
|
||||||
(define (default-config-file-name config)
|
(define (default-config-file-name config)
|
||||||
(string-join (list "config-" (greetd-terminal-vt config) ".toml") ""))
|
(string-join (list "config-" (greetd-terminal-vt config) ".toml") ""))
|
||||||
|
|
Loading…
Reference in a new issue