remmina: add module
Adds a module to enable managing Remmina, an RDP client, with a Home Manager module, providing a systemd service and mimetype integration that can be disabled if so desired.
This commit is contained in:
parent
31c77dcc2e
commit
1f305c363e
|
@ -1498,6 +1498,14 @@ in {
|
||||||
A new module is available: 'programs.spotify-player'.
|
A new module is available: 'programs.spotify-player'.
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
time = "2024-04-19T14:53:17+00:00";
|
||||||
|
condition = hostPlatform.isLinux;
|
||||||
|
message = ''
|
||||||
|
A new module is available: 'services.remmina'.
|
||||||
|
'';
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -340,6 +340,7 @@ let
|
||||||
./services/recoll.nix
|
./services/recoll.nix
|
||||||
./services/redshift-gammastep/gammastep.nix
|
./services/redshift-gammastep/gammastep.nix
|
||||||
./services/redshift-gammastep/redshift.nix
|
./services/redshift-gammastep/redshift.nix
|
||||||
|
./services/remmina.nix
|
||||||
./services/rsibreak.nix
|
./services/rsibreak.nix
|
||||||
./services/safeeyes.nix
|
./services/safeeyes.nix
|
||||||
./services/screen-locker.nix
|
./services/screen-locker.nix
|
||||||
|
|
74
modules/services/remmina.nix
Normal file
74
modules/services/remmina.nix
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
inherit (lib) mkIf mkMerge mkEnableOption mkPackageOption mkOption;
|
||||||
|
|
||||||
|
cfg = config.services.remmina;
|
||||||
|
|
||||||
|
in {
|
||||||
|
meta.maintainers = with lib.maintainers; [ cyntheticfox ];
|
||||||
|
|
||||||
|
options.services.remmina = {
|
||||||
|
enable = mkEnableOption "Remmina";
|
||||||
|
|
||||||
|
package = mkPackageOption pkgs "remmina" { };
|
||||||
|
|
||||||
|
addRdpMimeTypeAssoc = mkEnableOption "Remmina RDP file open option" // {
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
systemdService = {
|
||||||
|
enable = mkEnableOption "systemd Remmina service" // { default = true; };
|
||||||
|
|
||||||
|
startupFlags = mkOption {
|
||||||
|
type = with lib.types; listOf str;
|
||||||
|
default = [ "--icon" ];
|
||||||
|
description = ''
|
||||||
|
Startup flags documented in the manpage to run at service startup.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
{ home.packages = [ cfg.package ]; }
|
||||||
|
|
||||||
|
(mkIf cfg.systemdService.enable {
|
||||||
|
systemd.user.services.remmina = {
|
||||||
|
Unit = {
|
||||||
|
Description = "Remmina remote desktop client";
|
||||||
|
Documentation = "man:remmina(1)";
|
||||||
|
Requires = [ "graphical-session-pre.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
Service = {
|
||||||
|
Type = "simple";
|
||||||
|
ExecStart = "${lib.getExe cfg.package} ${
|
||||||
|
lib.escapeShellArgs cfg.systemdService.startupFlags
|
||||||
|
}";
|
||||||
|
Restart = "on-failure";
|
||||||
|
};
|
||||||
|
|
||||||
|
Install.WantedBy = [ "graphical-session.target" ];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf (config.xdg.mimeApps.enable && cfg.addRdpMimeTypeAssoc) {
|
||||||
|
xdg.mimeApps.associations.added."application/x-rdp" =
|
||||||
|
"org.remmina.Remmina.desktop";
|
||||||
|
|
||||||
|
xdg.dataFile."mime/packages/application-x-rdp.xml".text = ''
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
|
||||||
|
<mime-type type="application/x-rdp">
|
||||||
|
<comment>rdp file</comment>
|
||||||
|
<icon name="application-x-rdp"/>
|
||||||
|
<glob-deleteall/>
|
||||||
|
<glob pattern="*.rdp"/>
|
||||||
|
</mime-type>
|
||||||
|
</mime-info>
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
|
@ -255,6 +255,7 @@ in import nmtSrc {
|
||||||
./modules/services/polybar
|
./modules/services/polybar
|
||||||
./modules/services/recoll
|
./modules/services/recoll
|
||||||
./modules/services/redshift-gammastep
|
./modules/services/redshift-gammastep
|
||||||
|
./modules/services/remmina
|
||||||
./modules/services/screen-locker
|
./modules/services/screen-locker
|
||||||
./modules/services/signaturepdf
|
./modules/services/signaturepdf
|
||||||
./modules/services/swayidle
|
./modules/services/swayidle
|
||||||
|
|
26
tests/modules/services/remmina/basic-config.nix
Normal file
26
tests/modules/services/remmina/basic-config.nix
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{ config, ... }: {
|
||||||
|
xdg.mimeApps.enable = true;
|
||||||
|
|
||||||
|
services.remmina = {
|
||||||
|
enable = true;
|
||||||
|
package = config.lib.test.mkStubPackage { };
|
||||||
|
|
||||||
|
addRdpMimeTypeAssoc = false;
|
||||||
|
systemdService = {
|
||||||
|
enable = true;
|
||||||
|
startupFlags = [ "--icon" "--enable-extra-hardening" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
serviceFile='./home-files/.config/systemd/user/remmina.service'
|
||||||
|
|
||||||
|
assertFileExists $serviceFile
|
||||||
|
assertFileRegex $serviceFile 'ExecStart=.*/bin/dummy'
|
||||||
|
assertFileRegex $serviceFile "dummy '--icon' '--enable-extra-hardening'"
|
||||||
|
|
||||||
|
mimetypeFile='./home-files/.local/share/mime/packages/application-x-rdp.xml'
|
||||||
|
|
||||||
|
assertPathNotExists $mimetypeFile
|
||||||
|
'';
|
||||||
|
}
|
20
tests/modules/services/remmina/default-config.nix
Normal file
20
tests/modules/services/remmina/default-config.nix
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{ config, ... }: {
|
||||||
|
xdg.mimeApps.enable = true;
|
||||||
|
|
||||||
|
services.remmina = {
|
||||||
|
enable = true;
|
||||||
|
package = config.lib.test.mkStubPackage { };
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
serviceFile='./home-files/.config/systemd/user/remmina.service'
|
||||||
|
|
||||||
|
assertFileExists $serviceFile
|
||||||
|
assertFileRegex $serviceFile 'ExecStart=.*--icon'
|
||||||
|
|
||||||
|
mimetypeFile='./home-files/.local/share/mime/packages/application-x-rdp.xml'
|
||||||
|
|
||||||
|
assertFileExists $mimetypeFile
|
||||||
|
assertFileRegex $mimetypeFile '<mime-type type="application/x-rdp">'
|
||||||
|
'';
|
||||||
|
}
|
4
tests/modules/services/remmina/default.nix
Normal file
4
tests/modules/services/remmina/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
remmina-default-config = ./default-config.nix;
|
||||||
|
remmina-basic-config = ./basic-config.nix;
|
||||||
|
}
|
Loading…
Reference in a new issue