mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36:05 +01:00
Some files don't need nesting and can be root level again to reduce conflicts with other PRs. Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
81 lines
1.8 KiB
Nix
81 lines
1.8 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
inherit (lib) mkIf mkOption types;
|
|
|
|
cfg = config.programs.wofi;
|
|
|
|
toConfig =
|
|
attrs:
|
|
''
|
|
# Generated by Home Manager.
|
|
''
|
|
+ lib.generators.toKeyValue { } (lib.filterAttrs (name: value: value != null) attrs);
|
|
in
|
|
{
|
|
meta.maintainers = [ lib.maintainers.christoph-heiss ];
|
|
|
|
options.programs.wofi = {
|
|
enable = lib.mkEnableOption "wofi: a launcher/menu program for wlroots based wayland compositors such as sway";
|
|
|
|
package = lib.mkPackageOption pkgs "wofi" { nullable = true; };
|
|
|
|
settings = mkOption {
|
|
default = { };
|
|
type = types.attrs;
|
|
description = ''
|
|
Configuration options for wofi. See
|
|
{manpage}`wofi(5)`.
|
|
'';
|
|
example = lib.literalExpression ''
|
|
{
|
|
location = "bottom-right";
|
|
allow_markup = true;
|
|
width = 250;
|
|
}
|
|
'';
|
|
};
|
|
|
|
style = mkOption {
|
|
default = null;
|
|
type = with types; nullOr (either lines path);
|
|
example = ''
|
|
* {
|
|
font-family: monospace;
|
|
}
|
|
|
|
window {
|
|
background-color: #7c818c;
|
|
}
|
|
'';
|
|
description = ''
|
|
CSS style for wofi to use as a stylesheet. See
|
|
{manpage}`wofi(7)`
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
assertions = [
|
|
(lib.hm.assertions.assertPlatform "programs.wofi" pkgs lib.platforms.linux)
|
|
];
|
|
|
|
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
|
|
|
xdg.configFile = lib.mkMerge [
|
|
(mkIf (cfg.settings != { }) {
|
|
"wofi/config".text = toConfig cfg.settings;
|
|
})
|
|
(
|
|
let
|
|
styleFile = if lib.isString cfg.style then pkgs.writeText "wofi-style" cfg.style else cfg.style;
|
|
in
|
|
mkIf (cfg.style != null) { "wofi/style.css".source = styleFile; }
|
|
)
|
|
];
|
|
};
|
|
}
|