How can I provide arguments to gnome-shell ?
I would like to use –virtual-monitor argument as depicted here.
I can’t find where the systemd service is generated in gnome NixOS module.
Turns out I can do it using home manager option.
xdg = {
enable = true;
configFile."systemd/user/org.gnome.Shell@wayland.service.d/override.conf".text = ''
[Service]
ExecStart=
ExecStart=${pkgs.gnome.gnome-shell}/bin/gnome-shell --virtual-monitor 2800x1752
'';
};
Alternately, you should be able use something like the following in your NixOS config:
systemd.user.services."org.gnome.Shell@wayland".serviceConfig.ExecStart = [
# Empty ExecStart value to override the field
""
"${pkgs.gnome.gnome-shell}/bin/gnome-shell --virtual-monitor 2800x1752"
];
When I try this way, the virtual screen is added but it seems all the packages (firefox, kitty, etc…) installed via home manager are not available anymore in gnome.
I don’t think it’s the problem here.
I’m using
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
and installing firefox through home.packages.
Firefox is available if I open a non graphical tty but not when if I search for it in gnome.
I have rollback the modifications for now as i’m stuck on this issue once the virtual screen is available.
Regarding jtojnar’s suggestion, here is the difference with an without it:
Before
● org.gnome.Shell@wayland.service - GNOME Shell on Wayland
Loaded: loaded (/etc/systemd/user/org.gnome.Shell@wayland.service; linked-runtime; preset: enabled)
Active: active (running) since Mon 2024-03-18 16:51:06 CET; 15s ago
Main PID: 2381 (.gnome-shell-wr)
Tasks: 55 (limit: 33386)
Memory: 139.0M (peak: 144.6M)
CPU: 1.760s
CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/org.gnome.Shell@wayland.service
├─2381 /nix/store/9nqi5kcqhl67vy2jnpdqcanh4664xh75-gnome-shell-45.4/bin/gnome-shell
├─2813 /nix/store/kkss10l34c649i23q9fibcbzdf0r5v5b-xwayland-23.2.4/bin/Xwayland :0 -rootless -noreset -accessx -core -auth /run/user/1000/.mutter-Xwaylandauth.Q7FRK2 -listenfd 4 -listenfd 5 -displayfd 6 -listenfd 7 -byteswappedclients -enable-ei-portal
└─2915 /nix/store/vx525r55x44f4zgdnzg5i39ap13gr9iy-mutter-45.4/libexec/mutter-x11-frames
with the content of /etc/systemd/user/org.gnome.Shell@wayland.service being
[Unit]
Description=GNOME Shell on Wayland
# On wayland, force a session shutdown
OnFailure=org.gnome.Shell-disable-extensions.service gnome-session-shutdown.target
OnFailureJobMode=replace-irreversibly
CollectMode=inactive-or-failed
RefuseManualStart=on
RefuseManualStop=on
After=gnome-session-manager.target
Requisite=gnome-session-initialized.target
PartOf=gnome-session-initialized.target
Before=gnome-session-initialized.target
ConditionEnvironment=XDG_SESSION_TYPE=%I
[Service]
Slice=session.slice
Type=notify
ExecStart=/nix/store/9nqi5kcqhl67vy2jnpdqcanh4664xh75-gnome-shell-45.4/bin/gnome-shell
# Exit code 1 means we are probably *not* dealing with an extension failure
SuccessExitStatus=1
# unset some environment variables that were set by the shell and won't work now that the shell is gone
ExecStopPost=-/bin/sh -c 'test "$SERVICE_RESULT" != "exec-condition" && systemctl --user unset-environment GNOME_SETUP_DISPLAY WAYLAND_DISPLAY DISPLAY XAUTHORITY'
# On wayland we cannot restart
Restart=no
# Kill any stubborn child processes after this long
TimeoutStopSec=5
# Lower down gnome-shell's OOM score to avoid being killed by OOM-killer too early
OOMScoreAdjust=-1000
After
● org.gnome.Shell@wayland.service - GNOME Shell on Wayland
Loaded: loaded (/etc/systemd/user/org.gnome.Shell@wayland.service; linked-runtime; preset: enabled)
Drop-In: /nix/store/n2l5lc5z6mhs4yrgbq8rfbkynsrh17pc-user-units/org.gnome.Shell@wayland.service.d
└─overrides.conf
Active: active (running) since Mon 2024-03-18 16:44:29 CET; 4min 22s ago
Main PID: 2356 (.gnome-shell-wr)
Tasks: 53 (limit: 33386)
Memory: 139.9M (peak: 144.5M)
CPU: 2.817s
CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/org.gnome.Shell@wayland.service
├─2356 /nix/store/9nqi5kcqhl67vy2jnpdqcanh4664xh75-gnome-shell-45.4/bin/gnome-shell --virtual-monitor 2800x1752
├─2795 /nix/store/kkss10l34c649i23q9fibcbzdf0r5v5b-xwayland-23.2.4/bin/Xwayland :0 -rootless -noreset -accessx -core -auth /run/user/1000/.mutter-Xwaylandauth.YBG2K2 -listenfd 4 -listenfd 5 -displayfd 6 -listenfd 7 -byteswappedclients -enable-ei-portal
└─2888 /nix/store/vx525r55x44f4zgdnzg5i39ap13gr9iy-mutter-45.4/libexec/mutter-x11-frames
with the content of the overrides.conf being
[Unit]
[Service]
Environment="LOCALE_ARCHIVE=/nix/store/dlir8m82g8kvxd3ic0flrjdxjmikvzq4-glibc-locales-2.38-44/lib/locale/locale-archive"
Environment="PATH=/nix/store/mb488rr560vq1xnl10hinnyfflcrd51n-coreutils-9.4/bin:/nix/store/rr5pqqck5f6fjkv7agwjyhaljvh27ncn-findutils-4.9.0/bin:/nix/store/320v66ili0mwnyrxj3dwbxm0z8ndkbw7-gnugrep-3.11/bin:/nix/store/q7kq0naays5251ihghw0ccsz39id7kk5-gnused-4.9/bin:/nix/store/klc3y2c97sc22wsv1cjwf4dfwcws095l-systemd-255.2/bin:/nix/store/mb488rr560vq1xnl10hinnyfflcrd51n-coreutils-9.4/sbin:/nix/store/rr5pqqck5f6fjkv7agwjyhaljvh27ncn-findutils-4.9.0/sbin:/nix/store/320v66ili0mwnyrxj3dwbxm0z8ndkbw7-gnugrep-3.11/sbin:/nix/store/q7kq0naays5251ihghw0ccsz39id7kk5-gnused-4.9/sbin:/nix/store/klc3y2c97sc22wsv1cjwf4dfwcws095l-systemd-255.2/sbin"
Environment="TZDIR=/nix/store/iq0aigzp8b381hzn3bp9yivpm2hgg25p-tzdata-2024a/share/zoneinfo"
ExecStart=
ExecStart=/nix/store/9nqi5kcqhl67vy2jnpdqcanh4664xh75-gnome-shell-45.4/bin/gnome-shell --virtual-monitor 2800x1752
I’m not sure how overrides work with systemd but I guess something is missing.