fix so sway inherits program env vars

This commit is contained in:
2024-02-02 15:36:06 +00:00
parent d3eaa69261
commit 065d045640
2 changed files with 14 additions and 2 deletions

View File

@@ -107,13 +107,16 @@ in
systemd.defaultUnit = "graphical.target";
sane.users."${cfg.user}".fs.".profile".symlink.text = lib.optionalString (cfg.afterLogin != null) ''
# lib.mkAfter so that launching the DE happens *after* any other .profile setup.
# alternatively, we could recurse: exec a new login shell with some env-var signalling to not launch the DE,
# run with `-c "{cfg.afterLogin}"`
sane.users."${cfg.user}".fs.".profile".symlink.text = lib.mkAfter (lib.optionalString (cfg.afterLogin != null) ''
# if already running a desktop environment, or if running from ssh, then `tty` will show /dev/pts/NN.
if [ "$(tty)" = "/dev/${tty}" ]; then
echo 'launching default session in ${builtins.toString cfg.delay}s'
sleep ${builtins.toString cfg.delay} && exec ${cfg.afterLogin}
fi
'';
'');
# see: `man login.defs`
# disable timeout for `login` program.

View File

@@ -113,6 +113,15 @@ let
;
in
lib.concatStringsSep "\n" env + "\n";
fs.".profile".symlink.text = ''
# source env vars and the like, as systemd would. `man environment.d`
for env in ~/.config/environment.d/*.conf; do
# surround with `set -o allexport` since environment.d doesn't explicitly `export` their vars
set -a
source "$env"
set +a
done
'';
}
{
fs = lib.mkMerge (mapAttrsToList (serviceName: value: