unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* display manager doesn't read ~/.xsession when it is a symlink
@ 2023-03-17 20:18 Rodrigo Morales
  2023-03-21 10:56 ` 宋文武
  0 siblings, 1 reply; 3+ messages in thread
From: Rodrigo Morales @ 2023-03-17 20:18 UTC (permalink / raw)
  To: help-guix

Table of Contents
_________________

1. The context
2. The problem
3. The question
4. Appendix


1 The context
=============

  I'm using the [display manager]/[login manager] that is bundled with
  GUIX by default.

  Consider the following `~/.xsession' file.

  ,----
  | cat ~/.xsession
  `----

  ,----
  | # Map Caps Lock to Ctrl
  | setxkbmap -option 'ctrl:nocaps' -layout us
  | # Start Emacs using the exwm script
  | exwm
  `----

  I've noticed that when `~/.xsession' doesn't have execute permissions
  (see code block below) and when I try to log in to my account through
  the display manager, the display manager is shown again (i.e. the
  window manager is not started).

  ,----
  | ls -l ~/.xsession
  `----

  ,----
  | -rw-r--r-- 1 rdrg users 108 Mar 17 14:34 /home/rdrg/.xsession
  `----

  When the file has execute permissions (see code block below) and when
  I log in to my account through the display manager, the window manager
  is started. So, I conclude that `~/.xsession' requires execute
  permissions.

  ,----
  | chmod +x ~/.xsession
  | ls -l ~/.xsession
  `----

  ,----
  | -rwxr-xr-x 1 rdrg users 108 Mar 17 14:34 /home/rdrg/.xsession
  `----


2 The problem
=============

  I have created `~/my/guix-config/xdg/xsession' in `~/my/guix-config/',
  which is the directory that contains a git repo with all my
  configurations (see file structure below).

  ,----
  | find ~/my/guix-config ! -path '*/.git/*' | tree -a --fromfile
  `----

  ,----
  | .
  | └── home
  |     └── rdrg
  |         └── my
  |             └── guix-config
  |                 ├── fontconfig
  |                 │   └── fonts.conf
  |                 ├── .git
  |                 ├── home-configuration.scm
  |                 ├── mpv
  |                 │   ├── input.conf
  |                 │   └── mpv.conf
  |                 ├── rime
  |                 │   └── default.custom.yaml
  |                 ├── tmux
  |                 │   └── tmux.conf
  |                 ├── xdg
  |                 │   ├── defaults.list
  |                 │   ├── emacsclient-open-file.desktop
  |                 │   ├── inkscape.desktop
  |                 │   ├── mpv.desktop
  |                 │   ├── okular.desktop
  |                 │   ├── xsession
  |                 │   └── zathura.desktop
  |                 └── zathura
  |                     └── zathurarc
  |
  | 11 directories, 15 files
  `----

  The file `~/my/guix-config/xdg/xsession' has the same content as the
  file shown in the first section and it has execute permissions.

  ,----
  | cat ~/my/guix-config/xdg/xsession
  `----

  ,----
  | # Map Caps Lock to Ctrl
  | setxkbmap -option 'ctrl:nocaps' -layout us
  | # Start Emacs using the exwm script
  | exwm
  `----

  ,----
  | ls -l ~/my/guix-config/xdg/xsession
  `----

  ,----
  | -rwxr-xr-x 1 rdrg users 108 Mar 17 15:07
/home/rdrg/my/guix-config/xdg/xsession
  `----

  I've symlinked `~/my/guix-config/xdg/xsession' to `~/.xsession' by
  using the following instruction in
  `~/my/guix-config/home-configuration.scm' (see appendix for my
  complete configuration)

  ,----
  | (... some omitted lines ...)
  |    (service
  |     home-files-service-type
  |     `((".xsession"
  |        ,(local-file "xdg/xsession"))
  | (... some omitted lines ...)
  | #+END_SRC scheme
  |
  | I use the following command to create symbolic links from =$HOME= to my
git repo.
  |
  | #+BEGIN_SRC sh
  | guix home reconfigure ~/my/guix-config/home-configuration.scm
  `----

  After completion of `guix home reconfigure', the file `~/.xsession' is
  a symbolic link.

  ,----
  | ls -l ~/.xsession
  `----

  ,----
  | lrwxrwxrwx 1 rdrg users 52 Mar 17 14:47 /home/rdrg/.xsession ->
/gnu/store/hs5d7dkq6ywzd062yg4dcqfx5v0wa7dj-xsession
  `----

  The problem is that when I try to log in through the display manager,
  I'm redirected again to the display manager (the same behavior
  described above when `~/.xsession' is a regular file and doesn't have
  execute permissions).


3 The question
==============

  Is it possible for the display manager correctly execute `~/.xsession'
  even when it is a symbolic link?

  I need to do this because I use `guix home reconfigure
  ~/my/guix-config/home-configuration.scm' to configure my `$HOME', so
  `~/.xsession' is a symbolic link.


4 Appendix
==========

  ,----
  | cat ~/my/guix-config/home-configuration.scm
  `----

  ,----
  | ;; This "home-environment" file can be passed to 'guix home reconfigure'
  | ;; to reproduce the content of your profile.  This is "symbolic": it
only
  | ;; specifies package names.  To reproduce the exact same profile, you
also
  | ;; need to capture the channels being used, as returned by "guix
describe".
  | ;; See the "Replicating Guix" section in the manual.
  |
  | (use-modules (gnu home)
  |              (gnu packages)
  |              (gnu services)
  |              (guix gexp)
  |              (gnu home services)
  |              (gnu home services shells)
  |              (gnu home services ssh)
  |              ;; zathura
  |              ;; zathura-pdf-mupdf
  |              ;; xournalpp
  |              (gnu packages pdf)
  |              ;; okular
  |              (gnu packages kde)
  |              ;; inkscape
  |              (gnu packages inkscape)
  |              ;; git
  |              (gnu packages version-control)
  |              ;; libreoffice
  |              (gnu packages libreoffice)
  |              ;; mpv
  |              (gnu packages video)
  |              ;; audacity
  |              (gnu packages audio)
  |              ;; ripgrep
  |              (gnu packages rust-apps)
  |              ;; tmux
  |              (gnu packages tmux)
  |              ;; xdg-utils
  |              (gnu packages freedesktop)
  |              ;; font-misc-misc
  |              (gnu packages xorg)
  |              ;; rsync
  |              (gnu packages rsync)
  |              ;; tree
  |              (gnu packages admin)
  |              ;; emacs-rime
  |              (gnu packages emacs-xyz)
  |              ;; xcape
  |              (gnu packages xdisorg))
  |
  | (home-environment
  |  ;; Below is the list of packages that will show up in your
  |  ;; Home profile, under ~/.guix-home/profile.
  |  (packages
  |   (list
  |    git
  |    okular
  |    tree
  |    xdg-utils
  |    font-misc-misc
  |    zathura
  |    zathura-pdf-mupdf
  |    tmux
  |    inkscape
  |    xournalpp
  |    libreoffice
  |    mpv
  |    audacity
  |    ;; Transfer files between systems. Both the host and the
  |    ;; destination must have rsync installed in order transfer files
  |    ;; mutually.
  |    rsync
  |    ripgrep
  |    setxkbmap
  |    xcape
  |    emacs-rime))
  |  ;; Below is the list of Home services.  To search for available
  |  ;; services, run 'guix home search KEYWORD' in a terminal.
  |  (services
  |   (list
  |    (simple-service
  |     'some-useful-env-vars-service
  |     home-environment-variables-service-type
  |     '(("EDITOR" . "emacsclient")))
  |    (service
  |     home-openssh-service-type
  |     (home-openssh-configuration
  |      (hosts
  |       (list
  |        (openssh-host
  |         (name "desktop")
  |         (host-name "192.168.1.35")
  |         (user "beep1560")
  |         (port 22))))))
  |    (service
  |     home-bash-service-type
  |     (home-bash-configuration
  |      (aliases
  |       '(("grep" . "grep --color=auto")
  |         ("ll" . "ls -l")
  |         ("ls" . "ls -p --color=auto")
  |         ("d" . "cd ~/Downloads")))))
  |    (service
  |     home-files-service-type
  |     `((".xsession"
  |        ,(local-file "xdg/xsession"))
  |       (".local/share/applications/defaults.list"
  |        ,(local-file "xdg/defaults.list"))
  |       (".local/share/applications/emacsclient-open-file.desktop"
  |        ,(local-file "xdg/emacsclient-open-file.desktop"))
  |       (".local/share/applications/inkscape.desktop"
  |        ,(local-file "xdg/inkscape.desktop"))
  |       (".local/share/applications/okular.desktop"
  |        ,(local-file "xdg/okular.desktop"))
  |       (".local/share/applications/zathura.desktop"
  |        ,(local-file "xdg/zathura.desktop"))
  |       (".local/share/applications/mpv.desktop"
  |        ,(local-file "xdg/mpv.desktop"))))
  |    (service
  |     home-xdg-configuration-files-service-type
  |     `(("tmux/tmux.conf"
  |        ,(local-file "tmux/tmux.conf"))
  |       ("ibus/rime/default.custom.yaml"
  |        ,(local-file "rime/default.custom.yaml"))
  |       ("mpv/mpv.conf"
  |        ,(local-file "mpv/mpv.conf"))
  |       ("mpv/input.conf"
  |        ,(local-file "mpv/input.conf"))
  |       ("zathura/zathurarc"
  |        ,(local-file "zathura/zathurarc")))))))
  `----

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: display manager doesn't read ~/.xsession when it is a symlink
  2023-03-17 20:18 display manager doesn't read ~/.xsession when it is a symlink Rodrigo Morales
@ 2023-03-21 10:56 ` 宋文武
  2023-03-21 13:53   ` Gary Johnson
  0 siblings, 1 reply; 3+ messages in thread
From: 宋文武 @ 2023-03-21 10:56 UTC (permalink / raw)
  To: Rodrigo Morales; +Cc: help-guix

Rodrigo Morales <moralesrodrigo1100@gmail.com> writes:

> [...]
>   I've symlinked `~/my/guix-config/xdg/xsession' to `~/.xsession' by
>   using the following instruction in
>   `~/my/guix-config/home-configuration.scm' (see appendix for my
>   complete configuration)
>
>   ,----
>   | (... some omitted lines ...)
>   |    (service
>   |     home-files-service-type
>   |     `((".xsession"
>   |        ,(local-file "xdg/xsession"))
>   | (... some omitted lines ...)
>   | #+END_SRC scheme

Hello, you can use (local-file "xdg/xsession" recursive? #t) to make the
store file kept the permission bits, which would lead to a executable
~/.xsession.


Hope this helps!


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: display manager doesn't read ~/.xsession when it is a symlink
  2023-03-21 10:56 ` 宋文武
@ 2023-03-21 13:53   ` Gary Johnson
  0 siblings, 0 replies; 3+ messages in thread
From: Gary Johnson @ 2023-03-21 13:53 UTC (permalink / raw)
  To: Rodrigo Morales; +Cc: help-guix

> Rodrigo Morales <moralesrodrigo1100@gmail.com> writes:
>
>> [...]
>>   I've symlinked `~/my/guix-config/xdg/xsession' to `~/.xsession' by
>>   using the following instruction in
>>   `~/my/guix-config/home-configuration.scm' (see appendix for my
>>   complete configuration)
>>
>>   ,----
>>   | (... some omitted lines ...)
>>   |    (service
>>   |     home-files-service-type
>>   |     `((".xsession"
>>   |        ,(local-file "xdg/xsession"))
>>   | (... some omitted lines ...)
>>   | #+END_SRC scheme
>
> Hello, you can use (local-file "xdg/xsession" recursive? #t) to make the
> store file kept the permission bits, which would lead to a executable
> ~/.xsession.

Exactly right. In order to preserve the executable bit on your xsession
file when running it through `guix home`, you have to set the
#:recursive? option to #t in `local-file`. Here's an update to your
example service in `~/my/guix-config/home-configuration.scm`:

(... some omitted lines ...)
(simple-service 'rodrigo-dotfiles
                (home-files-service-type
                 `((".xsession" ,(local-file "xdg/xsession" #:recursive? #t)))))
(... some omitted lines ...)

Happy hacking!
  Gary

-- 
Protect yourself from surveillance: https://emailselfdefense.fsf.org
=======================================================================
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

Why is HTML email a security nightmare? See https://useplaintext.email/

Please avoid sending me MS-Office attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-21 14:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-17 20:18 display manager doesn't read ~/.xsession when it is a symlink Rodrigo Morales
2023-03-21 10:56 ` 宋文武
2023-03-21 13:53   ` Gary Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).