nixos/dunst: init module

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit is contained in:
nyukuru 2025-03-05 21:29:16 -05:00
commit 6d5c8ef7f5
3 changed files with 82 additions and 0 deletions

View file

@ -36,6 +36,8 @@
- [dsearch](https://github.com/AvengeMedia/danksearch), a fast filesystem search service with fuzzy matching. Available as [programs.dsearch](#opt-programs.dsearch.enable).
- [Dunst](https://github.com/dunst-project/dunst), a lightweight and customizable notification daemon. Available as [services.dunst](#opt-services.dunst.enable).
- [Ente Auth](https://ente.io/auth/), an open source 2FA authenticator, with end-to-end encrypted backups. Available as [programs.ente-auth](#opt-programs.ente-auth.enable).
- [Dawarich](https://dawarich.app/), a self-hostable location history tracker. Available as [services.dawarich](#opt-services.dawarich.enable).

View file

@ -558,6 +558,7 @@
./services/desktops/bonsaid.nix
./services/desktops/cpupower-gui.nix
./services/desktops/dleyna.nix
./services/desktops/dunst.nix
./services/desktops/espanso.nix
./services/desktops/flatpak.nix
./services/desktops/geoclue2.nix

View file

@ -0,0 +1,79 @@
{
config,
pkgs,
lib,
...
}:
let
toml = pkgs.formats.toml { };
cfg = config.services.dunst;
in
{
options.services.dunst = {
enable = lib.mkEnableOption "Dunst notification daemon";
package = lib.mkPackageOption pkgs "dunst" { } // {
apply =
p:
p.override {
withX11 = cfg.enableX11;
withWayland = cfg.enableWayland;
};
};
settings = lib.mkOption {
type = toml.type;
default = { };
description = "Dunst configuration, see dunst(5)";
example = lib.literalExpression ''
{
global = {
width = 300;
height = 300;
offset = "30x50";
origin = "top-right";
transparency = 10;
frame_color = "#eceff1";
font = "Droid Sans 9";
};
urgency_normal = {
background = "#37474f";
foreground = "#eceff1";
timeout = 10;
};
};
'';
};
enableX11 = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Whether to enable X11 support.";
};
enableWayland = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Whether to enable Wayland support.";
};
};
config = lib.mkIf cfg.enable {
assertions = [
{
assertion = cfg.enableX11 || cfg.enableWayland;
message = "Dunst must be built with at least either X11 support or Wayland support";
}
];
environment = {
systemPackages = [ cfg.package ];
etc."xdg/dunst/dunstrc".source = toml.generate "dunstrc" cfg.settings;
};
services.dbus.packages = [ cfg.package ];
};
meta.maintainers = with lib.maintainers; [ nyukuru ];
}