fork/home-manager

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

Robert HelgessonMerge PR #421575790441

master
1.5 KiB70 linesraw
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6  cfg = config.programs.wofi;
7
8  toConfig = attrs:
9    ''
10      # Generated by Home Manager.
11    '' + generators.toKeyValue { }
12    (filterAttrs (name: value: value != null) attrs);
13in {
14  meta.maintainers = [ maintainers.christoph-heiss ];
15
16  options.programs.wofi = {
17    enable = mkEnableOption
18      "wofi: a launcher/menu program for wlroots based wayland compositors such as sway";
19
20    package = mkPackageOption pkgs "wofi" { };
21
22    settings = mkOption {
23      default = { };
24      type = types.attrs;
25      description = ''
26        Configuration options for wofi. See
27        {manpage}`wofi(5)`.
28      '';
29      example = literalExpression ''
30        {
31          location = "bottom-right";
32          allow_markup = true;
33          width = 250;
34        }
35      '';
36    };
37
38    style = mkOption {
39      default = null;
40      type = types.nullOr types.str;
41      description = ''
42        CSS style for wofi to use as a stylesheet. See
43        {manpage}`wofi(7)`.
44      '';
45      example = ''
46        * {
47            font-family: monospace;
48        }
49
50        window {
51            background-color: #7c818c;
52        }
53      '';
54    };
55  };
56
57  config = mkIf cfg.enable {
58    assertions =
59      [ (hm.assertions.assertPlatform "programs.wofi" pkgs platforms.linux) ];
60
61    home.packages = [ cfg.package ];
62
63    xdg.configFile = mkMerge [
64      (mkIf (cfg.settings != { }) {
65        "wofi/config".text = toConfig cfg.settings;
66      })
67      (mkIf (cfg.style != null) { "wofi/style.css".text = cfg.style; })
68    ];
69  };
70}