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>
72 lines
1.6 KiB
Nix
72 lines
1.6 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
|
|
cfg = config.programs.tofi;
|
|
|
|
in
|
|
{
|
|
meta.maintainers = [ lib.hm.maintainers.henrisota ];
|
|
|
|
options.programs.tofi = {
|
|
enable = lib.mkEnableOption "Tofi, a tiny dynamic menu for Wayland";
|
|
|
|
package = lib.mkPackageOption pkgs "tofi" { nullable = true; };
|
|
|
|
settings = lib.mkOption {
|
|
type =
|
|
with lib.types;
|
|
let
|
|
primitive = either (either str int) bool;
|
|
in
|
|
attrsOf primitive;
|
|
default = { };
|
|
example = lib.literalExpression ''
|
|
{
|
|
background-color = "#000000";
|
|
border-width = 0;
|
|
font = "monospace";
|
|
height = "100%";
|
|
num-results = 5;
|
|
outline-width = 0;
|
|
padding-left = "35%";
|
|
padding-top = "35%";
|
|
result-spacing = 25;
|
|
width = "100%";
|
|
}
|
|
'';
|
|
description = ''
|
|
Settings to be written to the Tofi configuration file.
|
|
|
|
See <https://github.com/philj56/tofi/blob/master/doc/config>
|
|
for the full list of options.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
assertions = [
|
|
(lib.hm.assertions.assertPlatform "programs.tofi" pkgs lib.platforms.linux)
|
|
];
|
|
|
|
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
|
|
|
xdg.configFile."tofi/config" = lib.mkIf (cfg.settings != { }) {
|
|
text =
|
|
let
|
|
renderedSettings = lib.generators.toINIWithGlobalSection { } {
|
|
globalSection = cfg.settings;
|
|
};
|
|
in
|
|
lib.removeSuffix "\n\n" ''
|
|
# Generated by Home Manager.
|
|
|
|
${renderedSettings}
|
|
'';
|
|
};
|
|
};
|
|
}
|