about summary refs log tree commit diff
path: root/nixos/modules/programs/tmux.nix
diff options
context:
space:
mode:
authorKlemens Nanni <klemens@posteo.de>2019-05-30 13:48:22 +0200
committerAndreas Rammhold <andreas@rammhold.de>2019-05-31 15:09:59 +0200
commit7f104aa6e200771a716ca76d53dc5f337c9bed8b (patch)
tree23d59cbf7b5a7da30fe99f15b128e624acd9fe96 /nixos/modules/programs/tmux.nix
parent7e3dc85252ba9a5e2983dd6cd42cab9bfd695512 (diff)
tmux module: Fix escaping in TMUX_TMPDIR
5404595b55eeefae69f2952a34dfc70e32523060 relocated code but kept
one backslah too many, leading to

	$ tmux
	error creating /run/user/$(id -u)/tmux-1000 (No such file or directory)

/run/user/$UID/ is created by pam_systemd(3) which also populates
XD_RUNTIME_DIR with that value.

Alternatively, TMUX_TMPDIR might simply default to XDG_RUNTIME_DIR
without providing the same directory yet again as default string in
parameter substitution, however such behaviour change is subject to
another patch.

In fact, with `security.polkit.enable = false` systemd_logind(8) fails
to start and /run/user/$UID/ is never created for unprivileged users
in proper login sessions;  XDG_RUNTIME_DIR would consequently not be
set either.

Removing the fallback to /run/user/$UID/ would have caused TMUX_TMPDIR
to be empty, which in turn would lead tmux(1) to use /tmp/.  This
effectively breaks the idea of isolated sockets entirely while hiding
errors from the user.
Diffstat (limited to 'nixos/modules/programs/tmux.nix')
-rw-r--r--nixos/modules/programs/tmux.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/nixos/modules/programs/tmux.nix b/nixos/modules/programs/tmux.nix
index 3d5a37274ae2d..ed077e3daa762 100644
--- a/nixos/modules/programs/tmux.nix
+++ b/nixos/modules/programs/tmux.nix
@@ -177,7 +177,7 @@ in {
       systemPackages = [ pkgs.tmux ];
 
       variables = {
-        TMUX_TMPDIR = lib.optional cfg.secureSocket ''''${XDG_RUNTIME_DIR:-"/run/user/\$(id -u)"}'';
+        TMUX_TMPDIR = lib.optional cfg.secureSocket ''''${XDG_RUNTIME_DIR:-"/run/user/$(id -u)"}'';
       };
     };
   };