mirror of
https://github.com/nix-community/home-manager
synced 2024-12-19 00:09:48 +01:00
tofi: add module
This commit is contained in:
parent
f3506ba86c
commit
8ff7bb3f4d
8 changed files with 120 additions and 0 deletions
|
@ -77,6 +77,12 @@
|
||||||
githubId = 32838899;
|
githubId = 32838899;
|
||||||
name = "Daniel Wagenknecht";
|
name = "Daniel Wagenknecht";
|
||||||
};
|
};
|
||||||
|
henrisota = {
|
||||||
|
email = "henrisota@users.noreply.github.com";
|
||||||
|
github = "henrisota";
|
||||||
|
githubId = "56848082";
|
||||||
|
name = "Henri Sota";
|
||||||
|
};
|
||||||
jack5079 = {
|
jack5079 = {
|
||||||
name = "Jack W.";
|
name = "Jack W.";
|
||||||
email = "nix@jack.cab";
|
email = "nix@jack.cab";
|
||||||
|
|
|
@ -1483,6 +1483,14 @@ in {
|
||||||
A new module is available: 'programs.fd'.
|
A new module is available: 'programs.fd'.
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
time = "2024-04-19T09:23:52+00:00";
|
||||||
|
condition = hostPlatform.isLinux;
|
||||||
|
message = ''
|
||||||
|
A new module is available: 'programs.tofi'.
|
||||||
|
'';
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,6 +228,7 @@ let
|
||||||
./programs/tiny.nix
|
./programs/tiny.nix
|
||||||
./programs/tmate.nix
|
./programs/tmate.nix
|
||||||
./programs/tmux.nix
|
./programs/tmux.nix
|
||||||
|
./programs/tofi.nix
|
||||||
./programs/topgrade.nix
|
./programs/topgrade.nix
|
||||||
./programs/translate-shell.nix
|
./programs/translate-shell.nix
|
||||||
./programs/urxvt.nix
|
./programs/urxvt.nix
|
||||||
|
|
63
modules/programs/tofi.nix
Normal file
63
modules/programs/tofi.nix
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
cfg = config.programs.tofi;
|
||||||
|
|
||||||
|
in {
|
||||||
|
meta.maintainers = [ hm.maintainers.henrisota ];
|
||||||
|
|
||||||
|
options.programs.tofi = {
|
||||||
|
enable = mkEnableOption "Tofi, a tiny dynamic menu for Wayland";
|
||||||
|
|
||||||
|
package = mkPackageOption pkgs "tofi" { };
|
||||||
|
|
||||||
|
settings = mkOption {
|
||||||
|
type = with types;
|
||||||
|
let primitive = either (either str int) bool;
|
||||||
|
in attrsOf primitive;
|
||||||
|
default = { };
|
||||||
|
example = 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 = mkIf cfg.enable {
|
||||||
|
assertions =
|
||||||
|
[ (hm.assertions.assertPlatform "programs.tofi" pkgs platforms.linux) ];
|
||||||
|
|
||||||
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
|
xdg.configFile."tofi/config" = mkIf (cfg.settings != { }) {
|
||||||
|
text = let
|
||||||
|
renderedSettings = generators.toINIWithGlobalSection { } {
|
||||||
|
globalSection = cfg.settings;
|
||||||
|
};
|
||||||
|
in removeSuffix "\n\n" ''
|
||||||
|
# Generated by Home Manager.
|
||||||
|
|
||||||
|
${renderedSettings}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -207,6 +207,7 @@ in import nmtSrc {
|
||||||
./modules/programs/swayr
|
./modules/programs/swayr
|
||||||
./modules/programs/terminator
|
./modules/programs/terminator
|
||||||
./modules/programs/thunderbird
|
./modules/programs/thunderbird
|
||||||
|
./modules/programs/tofi
|
||||||
./modules/programs/waybar
|
./modules/programs/waybar
|
||||||
./modules/programs/wlogout
|
./modules/programs/wlogout
|
||||||
./modules/programs/wofi
|
./modules/programs/wofi
|
||||||
|
|
12
tests/modules/programs/tofi/basic-configuration.conf
Normal file
12
tests/modules/programs/tofi/basic-configuration.conf
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# Generated by Home Manager.
|
||||||
|
|
||||||
|
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%
|
28
tests/modules/programs/tofi/basic-configuration.nix
Normal file
28
tests/modules/programs/tofi/basic-configuration.nix
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{ config, pkgs, ... }: {
|
||||||
|
config = {
|
||||||
|
programs.tofi = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.tofi;
|
||||||
|
settings = {
|
||||||
|
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%";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
test.stubs.tofi = { };
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.config/tofi/config
|
||||||
|
assertFileContent home-files/.config/tofi/config \
|
||||||
|
${./basic-configuration.conf}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
1
tests/modules/programs/tofi/default.nix
Normal file
1
tests/modules/programs/tofi/default.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{ tofi-basic-configuration = ./basic-configuration.nix; }
|
Loading…
Reference in a new issue