diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-06-23 01:34:45 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-06-23 01:34:45 +0200 |
| commit | 518fb02308019b173ef614e074b9b71960ed9bbb (patch) | |
| tree | 8191fefaabbb7cd55730d8db2c72feac079a215a | |
| parent | treewide: Remove config eval errors (diff) | |
| download | nixos-config-518fb02308019b173ef614e074b9b71960ed9bbb.zip | |
modules/{river,ly}: Avoid starting `graphical-session.target` to early
| -rw-r--r-- | modules/by-name/ly/ly/module.nix | 12 | ||||
| -rw-r--r-- | modules/by-name/ly/ly/setup.sh | 67 | ||||
| -rw-r--r-- | modules/by-name/ri/river/module.nix | 3 |
3 files changed, 79 insertions, 3 deletions
diff --git a/modules/by-name/ly/ly/module.nix b/modules/by-name/ly/ly/module.nix index dedabe81..4dca84bb 100644 --- a/modules/by-name/ly/ly/module.nix +++ b/modules/by-name/ly/ly/module.nix @@ -31,6 +31,7 @@ Terminal=true ''; + # TODO: This could use the `services.display-manager.sessionPackages` option <2026-06-23> customSessionsDir = pkgs.runCommand "custom-sessions" {} /* @@ -39,7 +40,7 @@ '' mkdir "$out"; cp "${riverDesktop}/share/applications/river.desktop" "$out" - cp "${shellDesktop}" "$out" + cp "${shellDesktop}" "$out/zsh.desktop" ''; in { options.soispha.programs.ly = { @@ -84,6 +85,11 @@ in { dur_file_path = "${./blackhole-smooth-240x67.dur}"; full_color = true; + # NOTE: This does the same as the default nixos setup cmd, but we don't + # immidiately start the `graphical-session.target`. That is started by river's + # init. <2026-06-23> + setup_cmd = "${./setup.sh}"; + custom_sessions = "${customSessionsDir}"; # Clear the screen before starting up (otherwise error messages might linger on @@ -98,12 +104,12 @@ in { clock = "%c"; hibernate_cmd = "systemctl hibernate"; - inactivity_cmd = "systmectl suspend-then-hibernate"; + inactivity_cmd = "systemctl suspend-then-hibernate"; restart_cmd = "reboot"; shutdown_cmd = "shutdown $PLATFORM_SHUTDOWN_ARG now"; sleep_cmd = "systemctl suspend"; - inactivity_delay = 30; # unit is seconds + inactivity_delay = 120; # unit is seconds }; }; }; diff --git a/modules/by-name/ly/ly/setup.sh b/modules/by-name/ly/ly/setup.sh new file mode 100644 index 00000000..7bf11269 --- /dev/null +++ b/modules/by-name/ly/ly/setup.sh @@ -0,0 +1,67 @@ +#! /nix/store/cgjr3kj3hs7ngznyws5qfg16c8scpys0-bash-interactive-5.3p9/bin/bash + +# Shared environment setup for graphical sessions. + +. /etc/profile +if test -f ~/.profile; then + source ~/.profile +fi + +cd "$HOME" + +# Allow the user to execute commands at the beginning of the X session. +if test -f ~/.xprofile; then + source ~/.xprofile +fi + +if [ -z "$_DID_SYSTEMD_CAT" ]; then + export _DID_SYSTEMD_CAT=1 + exec /nix/store/a8avqfxd649rfgfpqldja6v38ljb8fj5-systemd-260.1/bin/systemd-cat -t xsession "$0" "$@" +fi + + + + +# Load X defaults. This should probably be safe on wayland too. +/nix/store/vs1b471vq9dmrp8chyirr38cvygzqvba-xrdb-1.2.2/bin/xrdb -merge /nix/store/w7b42g7g3ibk5c996i9y0gsy9z7wn0f1-Xresources-Xft +if test -e ~/.Xresources; then + /nix/store/vs1b471vq9dmrp8chyirr38cvygzqvba-xrdb-1.2.2/bin/xrdb -merge ~/.Xresources +elif test -e ~/.Xdefaults; then + /nix/store/vs1b471vq9dmrp8chyirr38cvygzqvba-xrdb-1.2.2/bin/xrdb -merge ~/.Xdefaults +fi + +# Import environment variables into the systemd user environment. +/run/current-system/systemd/bin/systemctl --user import-environment DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY XDG_SESSION_ID + +# Speed up application start by 50-150ms according to +# https://kdemonkey.blogspot.com/2008/04/magic-trick.html +compose_cache="${XCOMPOSECACHE:-$HOME/.compose-cache}" +mkdir -p "$compose_cache" +# To avoid accidentally deleting a wrongly set up XCOMPOSECACHE directory, +# defensively try to delete cache *files* only, following the file format specified in +# https://gitlab.freedesktop.org/xorg/lib/libx11/-/blob/master/modules/im/ximcp/imLcIm.c#L353-358 +# sprintf (*res, "%s/%c%d_%03x_%08x_%08x", dir, _XimGetMyEndian(), XIM_CACHE_VERSION, (unsigned int)sizeof (DefTree), hash, hash2); +/nix/store/c1cjgg6p8m8fssivzrc2p13mwwml3p3v-findutils-4.10.0/bin/find "$compose_cache" -maxdepth 1 -regextype posix-extended -regex '.*/[Bl][0-9]+_[0-9a-f]{3}_[0-9a-f]{8}_[0-9a-f]{8}' -delete +unset compose_cache + +# Work around KDE errors when a user first logs in and +# .local/share doesn't exist yet. +mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}" + +unset _DID_SYSTEMD_CAT + + + +# Allow the user to setup a custom session type. +if test -x ~/.xsession; then + eval exec ~/.xsession "$@" +fi + +if test "$1"; then + # Run the supplied session command. Remove any double quotes with eval. + eval exec "$@" +else + # TODO: Do we need this? Should not the session always exist? + echo "error: unknown session $1" 1>&2 + exit 1 +fi diff --git a/modules/by-name/ri/river/module.nix b/modules/by-name/ri/river/module.nix index b93e78af..5304446d 100644 --- a/modules/by-name/ri/river/module.nix +++ b/modules/by-name/ri/river/module.nix @@ -256,6 +256,9 @@ in { + mkHeading "Layout Setup" '' err_fail ${riverctl} default-layout rivertile ${lib.getExe' cfg.package "rivertile"} -main-ratio 0.5 -view-padding 1 -outer-padding 0 + '' + + '' + systemctl --user start nixos-fake-graphical-session.target ''; }; }; |
