aboutsummaryrefslogtreecommitdiff
path: root/home-manager/modules/services/polybar.nix
diff options
context:
space:
mode:
Diffstat (limited to 'home-manager/modules/services/polybar.nix')
-rw-r--r--home-manager/modules/services/polybar.nix48
1 files changed, 20 insertions, 28 deletions
diff --git a/home-manager/modules/services/polybar.nix b/home-manager/modules/services/polybar.nix
index 4225ed9b38c..934a990638f 100644
--- a/home-manager/modules/services/polybar.nix
+++ b/home-manager/modules/services/polybar.nix
@@ -6,30 +6,28 @@ let
cfg = config.services.polybar;
- eitherStrBoolIntList = with types; either str (either bool (either int (listOf str)));
+ eitherStrBoolIntList = with types;
+ either str (either bool (either int (listOf str)));
toPolybarIni = generators.toINI {
mkKeyValue = key: value:
let
quoted = v:
- if hasPrefix " " v || hasSuffix " " v
- then ''"${v}"''
- else v;
-
- value' =
- if isBool value then (if value then "true" else "false")
- else if (isString value && key != "include-file") then quoted value
- else toString value;
- in
- "${key}=${value'}";
+ if hasPrefix " " v || hasSuffix " " v then ''"${v}"'' else v;
+
+ value' = if isBool value then
+ (if value then "true" else "false")
+ else if (isString value && key != "include-file") then
+ quoted value
+ else
+ toString value;
+ in "${key}=${value'}";
};
configFile = pkgs.writeText "polybar.conf"
(toPolybarIni cfg.config + "\n" + cfg.extraConfig);
-in
-
-{
+in {
options = {
services.polybar = {
enable = mkEnableOption "Polybar status bar";
@@ -39,7 +37,7 @@ in
default = pkgs.polybar;
defaultText = literalExample "pkgs.polybar";
description = "Polybar package to install.";
- example = literalExample ''
+ example = literalExample ''
pkgs.polybar.override {
i3GapsSupport = true;
alsaSupport = true;
@@ -50,15 +48,14 @@ in
};
config = mkOption {
- type = types.coercedTo
- types.path
+ type = types.coercedTo types.path
(p: { "section/base" = { include-file = "${p}"; }; })
(types.attrsOf (types.attrsOf eitherStrBoolIntList));
description = ''
Polybar configuration. Can be either path to a file, or set of attributes
that will be used to create the final configuration.
'';
- default = {};
+ default = { };
example = literalExample ''
{
"bar/top" = {
@@ -118,25 +115,20 @@ in
Description = "Polybar status bar";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
- X-Restart-Triggers = [
- "${config.xdg.configFile."polybar/config".source}"
- ];
+ X-Restart-Triggers =
+ [ "${config.xdg.configFile."polybar/config".source}" ];
};
Service = {
Type = "forking";
Environment = "PATH=${cfg.package}/bin:/run/wrappers/bin";
ExecStart =
- let
- scriptPkg = pkgs.writeShellScriptBin "polybar-start" cfg.script;
- in
- "${scriptPkg}/bin/polybar-start";
+ let scriptPkg = pkgs.writeShellScriptBin "polybar-start" cfg.script;
+ in "${scriptPkg}/bin/polybar-start";
Restart = "on-failure";
};
- Install = {
- WantedBy = [ "graphical-session.target" ];
- };
+ Install = { WantedBy = [ "graphical-session.target" ]; };
};
};