mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 11:39:46 +01:00
dwm-status: add module
This commit is contained in:
parent
5eed33ef08
commit
db0dfb4b08
3 changed files with 79 additions and 0 deletions
|
@ -1168,6 +1168,14 @@ in
|
||||||
A new module is available: 'services.muchsync'.
|
A new module is available: 'services.muchsync'.
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
time = "2019-08-18T14:22:41+00:00";
|
||||||
|
condition = hostPlatform.isLinux;
|
||||||
|
message = ''
|
||||||
|
A new module is available: 'services.dwm-status'.
|
||||||
|
'';
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,6 +98,7 @@ let
|
||||||
(loadModule ./services/blueman-applet.nix { })
|
(loadModule ./services/blueman-applet.nix { })
|
||||||
(loadModule ./services/compton.nix { })
|
(loadModule ./services/compton.nix { })
|
||||||
(loadModule ./services/dunst.nix { })
|
(loadModule ./services/dunst.nix { })
|
||||||
|
(loadModule ./services/dwm-status.nix { condition = hostPlatform.isLinux; })
|
||||||
(loadModule ./services/emacs.nix { condition = hostPlatform.isLinux; })
|
(loadModule ./services/emacs.nix { condition = hostPlatform.isLinux; })
|
||||||
(loadModule ./services/flameshot.nix { })
|
(loadModule ./services/flameshot.nix { })
|
||||||
(loadModule ./services/getmail.nix { condition = hostPlatform.isLinux; })
|
(loadModule ./services/getmail.nix { condition = hostPlatform.isLinux; })
|
||||||
|
|
70
modules/services/dwm-status.nix
Normal file
70
modules/services/dwm-status.nix
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.dwm-status;
|
||||||
|
|
||||||
|
features = [ "audio" "backlight" "battery" "cpu_load" "network" "time" ];
|
||||||
|
|
||||||
|
configText = builtins.toJSON ({ inherit (cfg) order; } // cfg.extraConfig);
|
||||||
|
|
||||||
|
configFile = pkgs.writeText "dwm-status.json" configText;
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
services.dwm-status = {
|
||||||
|
enable = mkEnableOption "dwm-status user service";
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = pkgs.dwm-status;
|
||||||
|
defaultText = "pkgs.dwm-status";
|
||||||
|
example = "pkgs.dwm-status.override { enableAlsaUtils = false; }";
|
||||||
|
description = "Which dwm-status package to use.";
|
||||||
|
};
|
||||||
|
|
||||||
|
order = mkOption {
|
||||||
|
type = types.listOf (types.enum features);
|
||||||
|
description = "List of enabled features in order.";
|
||||||
|
};
|
||||||
|
|
||||||
|
extraConfig = mkOption {
|
||||||
|
type = types.attrs;
|
||||||
|
default = {};
|
||||||
|
example = literalExample ''
|
||||||
|
{
|
||||||
|
separator = "#";
|
||||||
|
|
||||||
|
battery = {
|
||||||
|
notifier_levels = [ 2 5 10 15 20 ];
|
||||||
|
};
|
||||||
|
|
||||||
|
time = {
|
||||||
|
format = "%H:%M";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
description = "Extra config of dwm-status.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
systemd.user.services.dwm-status = {
|
||||||
|
Unit = {
|
||||||
|
Description = "DWM status service";
|
||||||
|
PartOf = [ "graphical-session.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
Install = {
|
||||||
|
WantedBy = [ "graphical-session.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
Service = {
|
||||||
|
ExecStart = "${cfg.package}/bin/dwm-status ${configFile}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue