about summary refs log tree commit diff
path: root/nixos/modules/programs/tmux.nix
diff options
context:
space:
mode:
authorgnidorah <gnidorah@users.noreply.github.com>2017-12-29 15:02:58 +0300
committergnidorah <gnidorah@users.noreply.github.com>2017-12-29 15:05:20 +0300
commit766ae1ecf965670aa72f3fc035c9187c79c63abe (patch)
treed1d069368bca42be019b25b75fe5180c36cc42f7 /nixos/modules/programs/tmux.nix
parent8a5f3ec6a8c606fb2fe56f674d30511d150975dd (diff)
downloadnixlib-766ae1ecf965670aa72f3fc035c9187c79c63abe.tar
nixlib-766ae1ecf965670aa72f3fc035c9187c79c63abe.tar.gz
nixlib-766ae1ecf965670aa72f3fc035c9187c79c63abe.tar.bz2
nixlib-766ae1ecf965670aa72f3fc035c9187c79c63abe.tar.lz
nixlib-766ae1ecf965670aa72f3fc035c9187c79c63abe.tar.xz
nixlib-766ae1ecf965670aa72f3fc035c9187c79c63abe.tar.zst
nixlib-766ae1ecf965670aa72f3fc035c9187c79c63abe.zip
tmux module: add secureSocket option
Diffstat (limited to 'nixos/modules/programs/tmux.nix')
-rw-r--r--nixos/modules/programs/tmux.nix11
1 files changed, 10 insertions, 1 deletions
diff --git a/nixos/modules/programs/tmux.nix b/nixos/modules/programs/tmux.nix
index ed1d88a420a2..1eb6fa6bf2fa 100644
--- a/nixos/modules/programs/tmux.nix
+++ b/nixos/modules/programs/tmux.nix
@@ -151,6 +151,15 @@ in {
         type = types.str;
         description = "Set the $TERM variable.";
       };
+
+      secureSocket = mkOption {
+        default = true;
+        type = types.bool;
+        description = ''
+          Store tmux socket under /run, which is more secure than /tmp, but as a
+          downside it doesn't survive user logout.
+        '';
+      };
     };
   };
 
@@ -163,7 +172,7 @@ in {
       systemPackages = [ pkgs.tmux ];
 
       variables = {
-        TMUX_TMPDIR = ''''${XDG_RUNTIME_DIR:-"/run/user/\$(id -u)"}'';
+        TMUX_TMPDIR = lib.optional cfg.secureSocket ''''${XDG_RUNTIME_DIR:-"/run/user/\$(id -u)"}'';
       };
     };
   };