mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-18 22:33:00 +00:00
Can generate the config without installing application through home-manager. Helpful when a package is broken (or not provided) on a specific platform through nixpkgs and needs to be installed through other means but you still can benefit from the declarative configuration.
70 lines
1.6 KiB
Nix
70 lines
1.6 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.programs.wofi;
|
|
|
|
toConfig = attrs:
|
|
''
|
|
# Generated by Home Manager.
|
|
'' + generators.toKeyValue { }
|
|
(filterAttrs (name: value: value != null) attrs);
|
|
in {
|
|
meta.maintainers = [ maintainers.christoph-heiss ];
|
|
|
|
options.programs.wofi = {
|
|
enable = mkEnableOption
|
|
"wofi: a launcher/menu program for wlroots based wayland compositors such as sway";
|
|
|
|
package = mkPackageOption pkgs "wofi" { nullable = true; };
|
|
|
|
settings = mkOption {
|
|
default = { };
|
|
type = types.attrs;
|
|
description = ''
|
|
Configuration options for wofi. See
|
|
{manpage}`wofi(5)`.
|
|
'';
|
|
example = literalExpression ''
|
|
{
|
|
location = "bottom-right";
|
|
allow_markup = true;
|
|
width = 250;
|
|
}
|
|
'';
|
|
};
|
|
|
|
style = mkOption {
|
|
default = null;
|
|
type = types.nullOr types.str;
|
|
description = ''
|
|
CSS style for wofi to use as a stylesheet. See
|
|
{manpage}`wofi(7)`.
|
|
'';
|
|
example = ''
|
|
* {
|
|
font-family: monospace;
|
|
}
|
|
|
|
window {
|
|
background-color: #7c818c;
|
|
}
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
assertions =
|
|
[ (hm.assertions.assertPlatform "programs.wofi" pkgs platforms.linux) ];
|
|
|
|
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
|
|
|
xdg.configFile = mkMerge [
|
|
(mkIf (cfg.settings != { }) {
|
|
"wofi/config".text = toConfig cfg.settings;
|
|
})
|
|
(mkIf (cfg.style != null) { "wofi/style.css".text = cfg.style; })
|
|
];
|
|
};
|
|
}
|