1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-24 02:39:48 +01:00

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:
Cynthia Fox 2024-04-19 11:16:42 -04:00 committed by GitHub
parent 31c77dcc2e
commit 1f305c363e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 134 additions and 0 deletions

View file

@ -1498,6 +1498,14 @@ in {
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'.
'';
}
];
};
}

View file

@ -340,6 +340,7 @@ let
./services/recoll.nix
./services/redshift-gammastep/gammastep.nix
./services/redshift-gammastep/redshift.nix
./services/remmina.nix
./services/rsibreak.nix
./services/safeeyes.nix
./services/screen-locker.nix

View 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>
'';
})
]);
}

View file

@ -255,6 +255,7 @@ in import nmtSrc {
./modules/services/polybar
./modules/services/recoll
./modules/services/redshift-gammastep
./modules/services/remmina
./modules/services/screen-locker
./modules/services/signaturepdf
./modules/services/swayidle

View 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
'';
}

View 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">'
'';
}

View file

@ -0,0 +1,4 @@
{
remmina-default-config = ./default-config.nix;
remmina-basic-config = ./basic-config.nix;
}