nixos/modules/services/xrdp.nix

37 lines
1.2 KiB
Nix
Raw Normal View History

2023-09-05 17:17:43 +08:00
inputs:
{
options.nixos.services.xrdp = let inherit (inputs.lib) mkOption types; in
{
enable = mkOption { type = types.bool; default = false; };
port = mkOption { type = types.ints.unsigned; default = 3389; };
hostname = mkOption { type = types.nullOr types.str; default = null; };
};
config =
let
inherit (inputs.lib) mkMerge mkIf;
inherit (inputs.localLib) stripeTabs attrsToList;
inherit (inputs.config.nixos.services) xrdp;
inherit (builtins) map listToAttrs concatStringsSep toString filter attrValues;
2023-09-05 20:10:46 +08:00
in mkIf xrdp.enable (mkMerge
2023-09-05 17:17:43 +08:00
[
{
services.xrdp =
{
enable = true;
port = xrdp.port;
openFirewall = true;
defaultWindowManager = "startplasma-x11";
};
}
(
mkIf (xrdp.hostname != null)
{
services.xrdp = let keydir = inputs.config.security.acme.certs.${xrdp.hostname}.directory; in
{ sslCert = "${keydir}/full.pem"; sslKey = "${keydir}/key.pem"; };
nixos.services.acme = { enable = true; certs = [ xrdp.hostname ]; };
2023-09-05 19:47:57 +08:00
security.acme.certs.${xrdp.hostname}.group = inputs.config.systemd.services.xrdp.serviceConfig.Group;
2023-09-05 17:17:43 +08:00
}
)
2023-09-05 20:10:46 +08:00
]);
2023-09-05 17:17:43 +08:00
}