xinitrc function in services/xorg.scm do not handle guix-home's direcory.

  • Open
  • quality assurance status badge
Details
One participant
  • Feng Shu
Owner
unassigned
Submitted by
Feng Shu
Severity
normal
F
F
Feng Shu wrote on 10 Dec 2023 07:37
xinitrc function in services/xorg.scm do not handle guix-home's direcory.
(name . guix-bug)(address . bug-guix@gnu.org)
87bkaysgv1.fsf@163.com
(define* (xinitrc #:key fallback-session)
"Return a system-wide xinitrc script that starts the specified X session,
which should be passed to this script as the first argument. If not, the
@var{fallback-session} will be used or, if @var{fallback-session} is false, a
desktop session from the system or user profile will be used."
(define builder
#~(begin
(use-modules (ice-9 match)
(ice-9 regex)
(ice-9 ftw)
(ice-9 rdelim)
(srfi srfi-1)
(srfi srfi-26))
...

(define system-profile
"/run/current-system/profile")

(define user-profile
(and=> (getpw (getuid))
(lambda (pw)
(string-append (passwd:dir pw) "/.guix-profile"))))

I think we should handle '.guix-home' direcory, just like .guix-profile.

...

(let* ((home (getenv "HOME"))
(xsession-file (string-append home "/.xsession"))
(session (match (command-line)
((_)
#$(if fallback-session
#~(list #$fallback-session)
#f))
((_ x ..1)
x))))
(if (file-exists? xsession-file)
;; Run ~/.xsession when it exists.
(apply exec-from-login-shell xsession-file
(or session '()))
;; Otherwise, start the specified session or a fallback.
(apply exec-from-login-shell
(or session
(find-session user-profile)
(find-session system-profile)))))))

(program-file "xinitrc" builder))


--
F
F
Feng Shu wrote on 14 Dec 2023 03:58
[PATCH] services: xorg: Find sessions from guix home directory.
(address . 67738@debbugs.gnu.org)
87msud7a8c.fsf@163.com
From 19ca112441184a2c54a02ebbb6b84bca1c23dfea Mon Sep 17 00:00:00 2001

* gnu/services/xorg.scm (xinitrc): Find sessions from guix home directory.
---
gnu/services/xorg.scm | 6 ++++++
1 file changed, 6 insertions(+)

Toggle diff (28 lines)
diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index f8cf9f25b6..9235295dd6 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -458,6 +458,11 @@ (define user-profile
(lambda (pw)
(string-append (passwd:dir pw) "/.guix-profile"))))
+ (define guix-home-profile
+ (and=> (getpw (getuid))
+ (lambda (pw)
+ (string-append (passwd:dir pw) "/.guix-home/profile"))))
+
(define (xsession-command desktop-file)
;; Read from DESKTOP-FILE its X session command and return it as a
;; list.
@@ -503,6 +508,7 @@ (define (find-session profile)
(apply exec-from-login-shell
(or session
(find-session user-profile)
+ (find-session guix-home-profile)
(find-session system-profile)))))))
(program-file "xinitrc" builder))
--
2.39.2


--
F
F
Feng Shu wrote on 15 Dec 2023 01:46
[PATCH v2] services: xorg: Find sessions from guix home directory.
(address . 67738@debbugs.gnu.org)
87bkass37b.fsf@163.com
From 0e3968aff482ed8ef912f02b744631bb8899f9e4 Mon Sep 17 00:00:00 2001
From: Feng Shu <tumashu@163.com>
Date: Thu, 14 Dec 2023 10:58:02 +0800
Subject: [PATCH v2] services: xorg: Find sessions from guix home directory.

* gnu/services/xorg.scm (xinitrc): Find sessions from guix home directory.
---
gnu/services/xorg.scm | 6 ++++++
1 file changed, 6 insertions(+)

Toggle diff (28 lines)
diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index f8cf9f25b6..9235295dd6 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -458,6 +458,11 @@ (define user-profile
(lambda (pw)
(string-append (passwd:dir pw) "/.guix-profile"))))
+ (define guix-home-profile
+ (and=> (getpw (getuid))
+ (lambda (pw)
+ (string-append (passwd:dir pw) "/.guix-home/profile"))))
+
(define (xsession-command desktop-file)
;; Read from DESKTOP-FILE its X session command and return it as a
;; list.
@@ -503,6 +508,7 @@ (define (find-session profile)
(apply exec-from-login-shell
(or session
(find-session user-profile)
+ (find-session guix-home-profile)
(find-session system-profile)))))))
(program-file "xinitrc" builder))
--
2.39.2


--
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 67738@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 67738
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch