2021-08-10 06:21:03 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.fnott;
|
|
|
|
|
2021-12-27 09:03:18 +01:00
|
|
|
concatStringsSep' = sep: list: concatStringsSep sep (remove "" list);
|
2021-08-10 06:21:03 +02:00
|
|
|
|
2021-10-15 05:39:01 +02:00
|
|
|
iniFormat = pkgs.formats.ini { };
|
2021-08-10 06:21:03 +02:00
|
|
|
in {
|
2021-11-21 05:54:00 +01:00
|
|
|
meta.maintainers = with maintainers; [ polykernel ];
|
|
|
|
|
2021-08-10 06:21:03 +02:00
|
|
|
options = {
|
|
|
|
services.fnott = {
|
|
|
|
enable = mkEnableOption ''
|
|
|
|
fnott, a lightweight Wayland notification daemon for wlroots-based compositors
|
|
|
|
'';
|
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.fnott;
|
2021-10-09 11:14:08 +02:00
|
|
|
defaultText = literalExpression "pkgs.fnott";
|
2021-08-10 06:21:03 +02:00
|
|
|
description = "Package providing <command>fnott</command>.";
|
|
|
|
};
|
|
|
|
|
2021-08-28 05:01:24 +02:00
|
|
|
extraFlags = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [ ];
|
|
|
|
example = [ "-s" ];
|
|
|
|
description = ''
|
|
|
|
Extra arguments to use for executing fnott.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-08-10 06:21:03 +02:00
|
|
|
configFile = mkOption {
|
|
|
|
type = types.either types.str types.path;
|
|
|
|
default = "${config.xdg.configHome}/fnott/fnott.ini";
|
|
|
|
defaultText = "$XDG_CONFIG_HOME/fnott/fnott.ini";
|
|
|
|
description = ''
|
|
|
|
Path to the configuration file read by fnott.
|
|
|
|
</para><para>
|
|
|
|
Note that environment variables in the path won't be properly expanded.
|
|
|
|
</para><para>
|
2022-06-15 15:49:39 +02:00
|
|
|
The configuration specified under
|
2021-08-10 06:21:03 +02:00
|
|
|
<option>services.fnott.settings</option> will be generated and
|
|
|
|
written to <filename>$XDG_CONFIG_HOME/fnott/fnott.ini</filename>
|
|
|
|
regardless of this option. This allows using a mutable configuration file
|
|
|
|
generated from the immutable one, useful in scenarios where live reloading is desired.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
settings = mkOption {
|
2021-10-15 05:39:01 +02:00
|
|
|
type = iniFormat.type;
|
2021-08-10 06:21:03 +02:00
|
|
|
default = { };
|
|
|
|
description = ''
|
|
|
|
Configuration written to
|
|
|
|
<filename>$XDG_CONFIG_HOME/fnott/fnott.ini</filename>.
|
|
|
|
</para><para>
|
|
|
|
See
|
|
|
|
<citerefentry>
|
|
|
|
<refentrytitle>fnott.ini</refentrytitle>
|
|
|
|
<manvolnum>5</manvolnum>
|
2022-12-03 05:20:00 +01:00
|
|
|
</citerefentry> for a list of available options and <link
|
2021-08-10 06:21:03 +02:00
|
|
|
xlink:href="https://codeberg.org/dnkl/fnott/src/branch/master/fnott.ini"/>
|
|
|
|
for an example configuration.
|
|
|
|
'';
|
2021-10-09 11:14:08 +02:00
|
|
|
example = literalExpression ''
|
2021-08-10 06:21:03 +02:00
|
|
|
{
|
|
|
|
main = {
|
|
|
|
notification-margin = 5;
|
|
|
|
};
|
|
|
|
|
|
|
|
low = {
|
|
|
|
timeout = 5;
|
|
|
|
title-font = "Dina:weight=bold:slant=italic";
|
|
|
|
title-color = "ffffff";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
assertions =
|
|
|
|
[ (hm.assertions.assertPlatform "services.fnott" pkgs platforms.linux) ];
|
|
|
|
|
|
|
|
home.packages = [ cfg.package ];
|
|
|
|
|
|
|
|
systemd.user.services.fnott = {
|
|
|
|
Unit = {
|
|
|
|
Description = "Fnott notification daemon";
|
|
|
|
Documentation = "man:fnott(1)";
|
|
|
|
After = [ "graphical-session-pre.target" ];
|
|
|
|
PartOf = [ "graphical-session.target" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
Service = {
|
|
|
|
Type = "dbus";
|
|
|
|
BusName = "org.freedesktop.Notifications";
|
|
|
|
ExecStart = concatStringsSep' " " [
|
2021-08-28 05:01:24 +02:00
|
|
|
"${cfg.package}/bin/fnott"
|
|
|
|
"-c ${escapeShellArg cfg.configFile}"
|
2021-08-10 06:21:03 +02:00
|
|
|
(escapeShellArgs cfg.extraFlags)
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-04-20 15:48:56 +02:00
|
|
|
xdg.dataFile."dbus-1/services/fnott.service".text = ''
|
|
|
|
[D-BUS Service]
|
|
|
|
Name=org.freedesktop.Notifications
|
|
|
|
Exec=${cfg.package}/bin/fnott
|
|
|
|
SystemdService=fnott.service
|
|
|
|
'';
|
|
|
|
|
2021-10-15 05:39:01 +02:00
|
|
|
xdg.configFile."fnott/fnott.ini".source =
|
|
|
|
iniFormat.generate "fnott.ini" cfg.settings;
|
2021-08-10 06:21:03 +02:00
|
|
|
};
|
|
|
|
}
|