summary refs log tree commit diff
diff options
context:
space:
mode:
authorArtturin <Artturin@artturin.com>2022-11-13 23:21:50 +0200
committerArtturin <Artturin@artturin.com>2022-11-14 15:26:19 +0200
commit2af809015a65810571e7e8d8541b4ca7ba25b8d4 (patch)
treee7358f8355d7da6b2b64b7a46e8f046ee0bb5abe
parent56a574567998855b5f46d6107edf64ed3e66fd3d (diff)
downloadnixpkgs-2af809015a65810571e7e8d8541b4ca7ba25b8d4.tar
nixpkgs-2af809015a65810571e7e8d8541b4ca7ba25b8d4.tar.gz
nixpkgs-2af809015a65810571e7e8d8541b4ca7ba25b8d4.tar.bz2
nixpkgs-2af809015a65810571e7e8d8541b4ca7ba25b8d4.tar.lz
nixpkgs-2af809015a65810571e7e8d8541b4ca7ba25b8d4.tar.xz
nixpkgs-2af809015a65810571e7e8d8541b4ca7ba25b8d4.tar.zst
nixpkgs-2af809015a65810571e7e8d8541b4ca7ba25b8d4.zip
nixos/tmux: add withUtempter option
-rw-r--r--nixos/modules/programs/tmux.nix19
1 files changed, 19 insertions, 0 deletions
diff --git a/nixos/modules/programs/tmux.nix b/nixos/modules/programs/tmux.nix
index cf7ea4cfcf7..4fb9175fb8d 100644
--- a/nixos/modules/programs/tmux.nix
+++ b/nixos/modules/programs/tmux.nix
@@ -178,6 +178,16 @@ in {
         description = lib.mdDoc "List of plugins to install.";
         example = lib.literalExpression "[ pkgs.tmuxPlugins.nord ]";
       };
+
+      withUtempter = mkOption {
+        description = lib.mdDoc ''
+          Whether to enable libutempter for tmux.
+          This is required so that tmux can write to /var/run/utmp (which can be queried with `who` to display currently connected user sessions).
+          Note, this will add a guid wrapper for the group utmp!
+        '';
+        default = true;
+        type = types.bool;
+      };
     };
   };
 
@@ -193,6 +203,15 @@ in {
         TMUX_TMPDIR = lib.optional cfg.secureSocket ''''${XDG_RUNTIME_DIR:-"/run/user/$(id -u)"}'';
       };
     };
+    security.wrappers = mkIf cfg.withUtempter {
+      utempter = {
+        source = "${pkgs.libutempter}/lib/utempter/utempter";
+        owner = "root";
+        group = "utmp";
+        setuid = false;
+        setgid = true;
+      };
+    };
   };
 
   imports = [