1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-18 09:09:45 +01:00
home-manager/modules/services/dunst.nix

79 lines
1.8 KiB
Nix
Raw Normal View History

2017-01-07 19:16:26 +01:00
{ config, lib, pkgs, ... }:
with lib;
2017-10-09 11:20:12 +02:00
let
cfg = config.services.dunst;
toDunstIni = generators.toINI {
mkKeyValue = key: value:
let
value' =
if isBool value then (if value then "yes" else "no")
else if isString value then "\"${value}\""
else toString value;
in
"${key}=${value'}";
};
in
2017-01-07 19:16:26 +01:00
{
meta.maintainers = [ maintainers.rycee ];
2017-01-07 19:16:26 +01:00
options = {
services.dunst = {
enable = mkEnableOption "the dunst notification daemon";
settings = mkOption {
2017-10-09 11:20:12 +02:00
type = types.attrsOf types.attrs;
2017-01-07 19:16:26 +01:00
default = {};
description = "Configuration written to ~/.config/dunstrc";
2017-10-09 11:20:12 +02:00
example = literalExample ''
{
global = {
geometry = "300x5-30+50";
transparency = 10;
frame_color = "#eceff1";
font = "Droid Sans 9";
};
urgency_normal = {
background = "#37474f";
foreground = "#eceff1";
timeout = 10;
};
};
'';
2017-01-07 19:16:26 +01:00
};
};
};
2017-10-09 11:20:12 +02:00
config = mkIf cfg.enable (
mkMerge [
{
home.file.".local/share/dbus-1/services/org.knopwob.dunst.service".source =
"${pkgs.dunst}/share/dbus-1/services/org.knopwob.dunst.service";
2017-01-07 19:16:26 +01:00
2017-10-09 11:20:12 +02:00
systemd.user.services.dunst = {
Unit = {
Description = "Dunst notification daemon";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
2017-01-07 19:16:26 +01:00
2017-10-09 11:20:12 +02:00
Service = {
Type = "dbus";
BusName = "org.freedesktop.Notifications";
ExecStart = "${pkgs.dunst}/bin/dunst";
};
};
}
(mkIf (cfg.settings != {}) {
home.file.".config/dunst/dunstrc".text = toDunstIni cfg.settings;
})
]
);
2017-01-07 19:16:26 +01:00
}