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