Skip to content

Commit 2af8090

Browse files
committed
nixos/tmux: add withUtempter option
1 parent 56a5745 commit 2af8090

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

nixos/modules/programs/tmux.nix

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,16 @@ in {
178178
description = lib.mdDoc "List of plugins to install.";
179179
example = lib.literalExpression "[ pkgs.tmuxPlugins.nord ]";
180180
};
181+
182+
withUtempter = mkOption {
183+
description = lib.mdDoc ''
184+
Whether to enable libutempter for tmux.
185+
This is required so that tmux can write to /var/run/utmp (which can be queried with `who` to display currently connected user sessions).
186+
Note, this will add a guid wrapper for the group utmp!
187+
'';
188+
default = true;
189+
type = types.bool;
190+
};
181191
};
182192
};
183193

@@ -193,6 +203,15 @@ in {
193203
TMUX_TMPDIR = lib.optional cfg.secureSocket ''''${XDG_RUNTIME_DIR:-"/run/user/$(id -u)"}'';
194204
};
195205
};
206+
security.wrappers = mkIf cfg.withUtempter {
207+
utempter = {
208+
source = "${pkgs.libutempter}/lib/utempter/utempter";
209+
owner = "root";
210+
group = "utmp";
211+
setuid = false;
212+
setgid = true;
213+
};
214+
};
196215
};
197216

198217
imports = [

0 commit comments

Comments
 (0)