1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19:45 +01:00

dwm-status: add module

This commit is contained in:
Tobias Happ 2019-08-10 16:57:19 +02:00 committed by Robert Helgesson
parent 5eed33ef08
commit db0dfb4b08
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
3 changed files with 79 additions and 0 deletions

View file

@ -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'.
'';
}
]; ];
}; };
} }

View file

@ -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; })

View 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}";
};
};
};
}