1 { config, lib, pkgs, ... }:
5 cfg = config.programs.mosh;
9 options.programs.mosh = {
10 enable = lib.mkEnableOption "mosh";
11 openFirewall = lib.mkEnableOption "" // {
12 description = "Whether to automatically open the necessary ports in the firewall.";
15 withUtempter = lib.mkEnableOption "" // {
17 Whether to enable libutempter for mosh.
19 This is required so that mosh can write to /var/run/utmp (which can be queried with `who` to display currently connected user sessions).
20 Note, this will add a guid wrapper for the group utmp!
26 config = lib.mkIf cfg.enable {
27 environment.systemPackages = [ pkgs.mosh ];
28 networking.firewall.allowedUDPPortRanges = lib.optional cfg.openFirewall { from = 60000; to = 61000; };
29 security.wrappers = lib.mkIf cfg.withUtempter {
31 source = "${pkgs.libutempter}/lib/utempter/utempter";