2016-03-26 03:22:52 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.programs.mosh;
|
|
|
|
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.programs.mosh = {
|
2016-12-16 16:58:40 +00:00
|
|
|
enable = mkOption {
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2016-12-16 16:58:40 +00:00
|
|
|
Whether to enable mosh. Note, this will open ports in your firewall!
|
|
|
|
'';
|
|
|
|
default = false;
|
|
|
|
type = lib.types.bool;
|
|
|
|
};
|
2018-06-01 23:29:33 +01:00
|
|
|
withUtempter = mkOption {
|
2022-08-14 08:03:30 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-06-01 23:29:33 +01:00
|
|
|
Whether to enable libutempter for mosh.
|
|
|
|
This is required so that mosh 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 = lib.types.bool;
|
|
|
|
};
|
2016-03-26 03:22:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
environment.systemPackages = with pkgs; [ mosh ];
|
|
|
|
networking.firewall.allowedUDPPortRanges = [ { from = 60000; to = 61000; } ];
|
2018-06-01 23:29:33 +01:00
|
|
|
security.wrappers = mkIf cfg.withUtempter {
|
|
|
|
utempter = {
|
|
|
|
source = "${pkgs.libutempter}/lib/utempter/utempter";
|
2021-10-03 10:43:13 +01:00
|
|
|
owner = "root";
|
2018-06-01 23:29:33 +01:00
|
|
|
group = "utmp";
|
|
|
|
setuid = false;
|
|
|
|
setgid = true;
|
|
|
|
};
|
|
|
|
};
|
2016-03-26 03:22:52 +00:00
|
|
|
};
|
|
|
|
}
|