diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-06-23 01:50:58 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-06-23 01:50:58 +0200 |
| commit | 9a7cab7fef24a2351ed9ea0dc76a1e4c03e446b9 (patch) | |
| tree | 75b1530985c43c94c7964751f50c8d73a5c87818 /modules | |
| parent | modules/{river,ly}: Avoid starting `graphical-session.target` to early (diff) | |
| download | nixos-config-9a7cab7fef24a2351ed9ea0dc76a1e4c03e446b9.zip | |
modules/ly: Make the setup script executable and improve it
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/by-name/ly/ly/module.nix | 14 | ||||
| -rw-r--r-- | modules/by-name/ly/ly/setup.sh | 40 |
2 files changed, 23 insertions, 31 deletions
diff --git a/modules/by-name/ly/ly/module.nix b/modules/by-name/ly/ly/module.nix index 4dca84bb..2fe6ea3e 100644 --- a/modules/by-name/ly/ly/module.nix +++ b/modules/by-name/ly/ly/module.nix @@ -42,6 +42,18 @@ cp "${riverDesktop}/share/applications/river.desktop" "$out" cp "${shellDesktop}" "$out/zsh.desktop" ''; + + setup = pkgs.writeShellApplication { + name = "setup"; + + runtimeInputs = [ + pkgs.findutils + pkgs.systemd + ]; + inheritPath = true; + + text = builtins.readFile ./setup.sh; + }; in { options.soispha.programs.ly = { enable = lib.mkEnableOption "ly"; @@ -88,7 +100,7 @@ in { # 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}"; + setup_cmd = "${lib.getExe setup}"; custom_sessions = "${customSessionsDir}"; diff --git a/modules/by-name/ly/ly/setup.sh b/modules/by-name/ly/ly/setup.sh index 7bf11269..6e8bed2b 100644 --- a/modules/by-name/ly/ly/setup.sh +++ b/modules/by-name/ly/ly/setup.sh @@ -1,35 +1,21 @@ -#! /nix/store/cgjr3kj3hs7ngznyws5qfg16c8scpys0-bash-interactive-5.3p9/bin/bash +#! /usr/bin/env bash # Shared environment setup for graphical sessions. +# shellcheck disable=1091 . /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 +cd "$HOME" || { + echo 1>&2 "No HOME :(" + exit 1 +} if [ -z "$_DID_SYSTEMD_CAT" ]; then export _DID_SYSTEMD_CAT=1 - exec /nix/store/a8avqfxd649rfgfpqldja6v38ljb8fj5-systemd-260.1/bin/systemd-cat -t xsession "$0" "$@" + exec 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 @@ -41,7 +27,7 @@ mkdir -p "$compose_cache" # 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 +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 @@ -51,15 +37,9 @@ 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 "$@" + # Run the supplied session command. + exec "$@" else # TODO: Do we need this? Should not the session always exist? echo "error: unknown session $1" 1>&2 |
