snixembed: add module

This is used by SafeEyes (another home-manager) module to show a
systemtray icon. See https://git.sr.ht/~steef/snixembed.

Fixes #5728
This commit is contained in:
Damien Cassou 2024-10-11 00:14:36 +02:00 committed by GitHub
parent 8bb5d53c58
commit 03f8e0b3b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 102 additions and 0 deletions

View file

@ -1748,6 +1748,18 @@ in {
add `-w` to your assignment of `services.swayidle.extraArgs`. add `-w` to your assignment of `services.swayidle.extraArgs`.
''; '';
} }
{
time = "2024-10-09T06:16:23+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.snixembed'.
snixembed proxies StatusNotifierItems as XEmbedded systemtray-spec
icons. This is useful for some tools in some environments, e.g., Safe
Eyes in i3, lxde or mate.
'';
}
]; ];
}; };
} }

View file

@ -361,6 +361,7 @@ let
./services/screen-locker.nix ./services/screen-locker.nix
./services/sctd.nix ./services/sctd.nix
./services/signaturepdf.nix ./services/signaturepdf.nix
./services/snixembed.nix
./services/spotifyd.nix ./services/spotifyd.nix
./services/ssh-agent.nix ./services/ssh-agent.nix
./services/stalonetray.nix ./services/stalonetray.nix

View file

@ -0,0 +1,50 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.services.snixembed;
in {
meta.maintainers = [ maintainers.DamienCassou ];
options = {
services.snixembed = {
enable = mkEnableOption
"snixembed: proxy StatusNotifierItems as XEmbedded systemtray-spec icons";
package = mkPackageOption pkgs "snixembed" { };
beforeUnits = mkOption {
type = with types; listOf str;
default = [ ];
example = [ "safeeyes.service" ];
description = ''
List of other units that should be started after snixembed.
'';
};
};
};
config = mkIf cfg.enable {
assertions = [
(hm.assertions.assertPlatform "services.snixembed" pkgs platforms.linux)
];
systemd.user.services.snixembed = {
Install.WantedBy = [ "graphical-session.target" ];
Unit = {
Description = "snixembed";
PartOf = [ "graphical-session.target" ];
StartLimitIntervalSec = 100;
StartLimitBurst = 10;
Before = cfg.beforeUnits;
};
Service = {
ExecStart = getExe pkgs.snixembed;
Restart = "on-failure";
RestartSec = 3;
};
};
};
}

View file

@ -270,6 +270,7 @@ in import nmtSrc {
./modules/services/remmina ./modules/services/remmina
./modules/services/screen-locker ./modules/services/screen-locker
./modules/services/signaturepdf ./modules/services/signaturepdf
./modules/services/snixembed
./modules/services/swayidle ./modules/services/swayidle
./modules/services/swaync ./modules/services/swaync
./modules/services/swayosd ./modules/services/swayosd

View file

@ -0,0 +1,7 @@
[Desktop Entry]
Exec=@xdg-utils@/bin/xdg-open http://localhost:9494
Icon=/snixembed/share/snixembed/public/favicon.ico
Name=Snixembed
Terminal=false
Type=Application
Version=1.4

View file

@ -0,0 +1,16 @@
{ ... }:
{
services.snixembed = {
enable = true;
beforeUnits = [ "safeeyes.service" ];
};
test.stubs = { snixembed = { outPath = "/snixembed"; }; };
nmt.script = ''
assertFileContent \
home-files/.config/systemd/user/snixembed.service \
${./basic-configuration.service}
'';
}

View file

@ -0,0 +1,14 @@
[Install]
WantedBy=graphical-session.target
[Service]
ExecStart=/snixembed/bin/dummy
Restart=on-failure
RestartSec=3
[Unit]
Before=safeeyes.service
Description=snixembed
PartOf=graphical-session.target
StartLimitBurst=10
StartLimitIntervalSec=100

View file

@ -0,0 +1 @@
{ snixembed-basic-configuration = ./basic-configuration.nix; }