fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Robert HelgessonMerge PR #421575790441

master
1.8 KiB59 linesraw
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let cfg = config.programs.xmobar;
6in {
7  options.programs.xmobar = {
8    enable = mkEnableOption "Xmobar, a minimalistic status bar";
9
10    package = mkOption {
11      default = pkgs.haskellPackages.xmobar;
12      defaultText = literalExpression "pkgs.haskellPackages.xmobar";
13      type = types.package;
14      description = ''
15        Package providing the {command}`xmobar` binary.
16      '';
17    };
18
19    extraConfig = mkOption {
20      default = "";
21      example = literalExpression ''
22        Config
23          { font        = "Fira Code"
24          , borderColor = "#d0d0d0"
25          , border      = FullB
26          , borderWidth = 3
27          , bgColor     = "#222"
28          , fgColor     = "grey"
29          , position    = TopSize C 99 30
30          , commands    =
31              [ Run Cpu ["-t", "cpu: <fc=#4eb4fa><bar> <total>%</fc>"] 10
32              , Run Network "enp3s0" ["-S", "True", "-t", "eth: <fc=#4eb4fa><rx></fc>/<fc=#4eb4fa><tx></fc>"] 10
33              , Run Memory ["-t","mem: <fc=#4eb4fa><usedbar> <usedratio>%</fc>"] 10
34              , Run Date "date: <fc=#4eb4fa>%a %d %b %Y %H:%M:%S </fc>" "date" 10
35              , Run StdinReader
36              ]
37          , sepChar     = "%"
38          , alignSep    = "}{"
39          , template    = "  %StdinReader% | %cpu% | %memory% | %enp3s0%  }{%date%  "
40          }
41      '';
42      type = types.lines;
43      description = ''
44        Extra configuration lines to add to
45        {file}`$XDG_CONFIG_HOME/xmobar/.xmobarrc`.
46        See
47        <https://xmobar.org/#configuration>
48        for options.
49      '';
50    };
51  };
52
53  config = mkIf cfg.enable {
54    home.packages = [ cfg.package ];
55    xdg.configFile."xmobar/.xmobarrc".text = cfg.extraConfig;
56  };
57
58  meta.maintainers = [ hm.maintainers.t4ccer ];
59}