home-manager/modules/services/fnott.nix
Emily 36a53d9f26 treewide: convert all option docs to Markdown
This process was automated by [my fork of `nix-doc-munge`]. All
conversions were automatically checked to produce the same DocBook
result when converted back, modulo minor typographical/formatting
differences on the acceptable-to-desirable spectrum.

To reproduce this commit, run:

  $ NIX_PATH=nixpkgs=flake:nixpkgs/e7e69199f0372364a6106a1e735f68604f4c5a25 \
    nix shell nixpkgs#coreutils \
    -c find . -name '*.nix' \
    -exec nix run -- github:emilazy/nix-doc-munge/98dadf1f77351c2ba5dcb709a2a171d655f15099 \
    {} +
  $ ./format

[my fork of `nix-doc-munge`]: https://github.com/emilazy/nix-doc-munge/tree/home-manager
2023-07-17 18:40:56 +01:00

116 lines
3.3 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.fnott;
concatStringsSep' = sep: list: concatStringsSep sep (remove "" list);
iniFormat = pkgs.formats.ini { };
in {
meta.maintainers = with maintainers; [ polykernel ];
options = {
services.fnott = {
enable = mkEnableOption (lib.mdDoc ''
fnott, a lightweight Wayland notification daemon for wlroots-based compositors
'');
package = mkOption {
type = types.package;
default = pkgs.fnott;
defaultText = literalExpression "pkgs.fnott";
description = lib.mdDoc "Package providing {command}`fnott`.";
};
extraFlags = mkOption {
type = types.listOf types.str;
default = [ ];
example = [ "-s" ];
description = lib.mdDoc ''
Extra arguments to use for executing fnott.
'';
};
configFile = mkOption {
type = types.either types.str types.path;
default = "${config.xdg.configHome}/fnott/fnott.ini";
defaultText = "$XDG_CONFIG_HOME/fnott/fnott.ini";
description = lib.mdDoc ''
Path to the configuration file read by fnott.
Note that environment variables in the path won't be properly expanded.
The configuration specified under
{option}`services.fnott.settings` will be generated and
written to {file}`$XDG_CONFIG_HOME/fnott/fnott.ini`
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 {
type = iniFormat.type;
default = { };
description = lib.mdDoc ''
Configuration written to
{file}`$XDG_CONFIG_HOME/fnott/fnott.ini`.
See
{manpage}`fnott.ini(5)` for a list of available options and <https://codeberg.org/dnkl/fnott/src/branch/master/fnott.ini>
for an example configuration.
'';
example = literalExpression ''
{
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' " " [
"${cfg.package}/bin/fnott"
"-c ${escapeShellArg cfg.configFile}"
(escapeShellArgs cfg.extraFlags)
];
};
};
xdg.dataFile."dbus-1/services/fnott.service".text = ''
[D-BUS Service]
Name=org.freedesktop.Notifications
Exec=${cfg.package}/bin/fnott
SystemdService=fnott.service
'';
xdg.configFile."fnott/fnott.ini".source =
iniFormat.generate "fnott.ini" cfg.settings;
};
}