mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
@@ -97,15 +97,11 @@ in
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = types.submodule {
|
||||
freeformType = with types; attrsOf (attrsOf eitherStrBoolIntList);
|
||||
options = {
|
||||
global.icon_path = mkOption {
|
||||
type = types.separatedString ":";
|
||||
description = "Paths where dunst will look for icons.";
|
||||
};
|
||||
};
|
||||
};
|
||||
type = lib.hm.types.dagOf (
|
||||
types.submodule {
|
||||
freeformType = with types; attrsOf eitherStrBoolIntList;
|
||||
}
|
||||
);
|
||||
default = { };
|
||||
description = "Configuration written to {file}`$XDG_CONFIG_HOME/dunst/dunstrc`.";
|
||||
example = literalExpression ''
|
||||
@@ -118,6 +114,7 @@ in
|
||||
transparency = 10;
|
||||
frame_color = "#eceff1";
|
||||
font = "Droid Sans 9";
|
||||
icon_path = "/run/current-system/sw/share/icons/hicolor/32x32/status:/run/current-system/sw/share/icons/hicolor/32x32/devices";
|
||||
};
|
||||
|
||||
urgency_normal = {
|
||||
@@ -125,6 +122,11 @@ in
|
||||
foreground = "#eceff1";
|
||||
timeout = 10;
|
||||
};
|
||||
|
||||
custom-rule = lib.hm.dag.entryAfter [ "global" ] {
|
||||
appname = "custom-app";
|
||||
timeout = 1;
|
||||
};
|
||||
};
|
||||
'';
|
||||
};
|
||||
@@ -142,7 +144,14 @@ in
|
||||
"${cfg.package}/share/dbus-1/services/org.knopwob.dunst.service";
|
||||
|
||||
xdg.configFile."dunst/dunstrc" = lib.mkIf (cfg.settings != { }) {
|
||||
text = toDunstIni cfg.settings;
|
||||
text =
|
||||
let
|
||||
sortedSettings = lib.hm.dag.topoSort cfg.settings;
|
||||
sections =
|
||||
sortedSettings.result
|
||||
or (abort "Dependency cycle in dunst settings: ${builtins.toJSON sortedSettings}");
|
||||
in
|
||||
lib.concatStringsSep "\n" (map (section: toDunstIni { ${section.name} = section.data; }) sections);
|
||||
};
|
||||
|
||||
services.dunst.settings.global.icon_path =
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
|
||||
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
||||
dunst-with-settings = ./with-settings.nix;
|
||||
dunst-with-ordered-settings = ./with-ordered-settings.nix;
|
||||
dunst-without-settings = ./without-settings.nix;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
[global]
|
||||
font="Droid Sans 9"
|
||||
icon_path="/run/current-system/sw/share/icons/hicolor/32x32/status:/run/current-system/sw/share/icons/hicolor/32x32/devices"
|
||||
timeout=30
|
||||
|
||||
[bgtvolctl]
|
||||
appname="bgtvolctl"
|
||||
timeout=1
|
||||
|
||||
[urgency_critical]
|
||||
background="#c33"
|
||||
39
tests/modules/services/dunst/with-ordered-settings.nix
Normal file
39
tests/modules/services/dunst/with-ordered-settings.nix
Normal file
@@ -0,0 +1,39 @@
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
inherit (config.lib.test) mkStubPackage;
|
||||
in
|
||||
{
|
||||
services.dunst = {
|
||||
enable = true;
|
||||
package = mkStubPackage {
|
||||
name = "dunst";
|
||||
buildScript = ''
|
||||
mkdir -p $out/share/dbus-1/services
|
||||
echo test > $out/share/dbus-1/services/org.knopwob.dunst.service
|
||||
'';
|
||||
};
|
||||
settings = {
|
||||
global = {
|
||||
timeout = 30;
|
||||
font = "Droid Sans 9";
|
||||
icon_path = lib.mkForce "/run/current-system/sw/share/icons/hicolor/32x32/status:/run/current-system/sw/share/icons/hicolor/32x32/devices";
|
||||
};
|
||||
|
||||
bgtvolctl = lib.hm.dag.entryAfter [ "global" ] {
|
||||
appname = "bgtvolctl";
|
||||
timeout = 1;
|
||||
};
|
||||
|
||||
urgency_critical = lib.hm.dag.entryAfter [ "bgtvolctl" ] {
|
||||
background = "#c33";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
configFile=home-files/.config/dunst/dunstrc
|
||||
|
||||
assertFileExists $configFile
|
||||
assertFileContent $configFile ${./with-ordered-settings-expected.ini}
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user