mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
yofi: add module (#7528)
This commit is contained in:
parent
fe38a5e028
commit
1fde6fb1be
5 changed files with 148 additions and 0 deletions
82
modules/programs/yofi.nix
Normal file
82
modules/programs/yofi.nix
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
concatStringsSep
|
||||||
|
types
|
||||||
|
mkIf
|
||||||
|
mkEnableOption
|
||||||
|
mkPackageOption
|
||||||
|
mkOption
|
||||||
|
;
|
||||||
|
|
||||||
|
cfg = config.programs.yofi;
|
||||||
|
tomlFormat = pkgs.formats.toml { };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
|
||||||
|
|
||||||
|
options.programs.yofi = {
|
||||||
|
enable = mkEnableOption "yofi";
|
||||||
|
package = mkPackageOption pkgs "yofi" { nullable = true; };
|
||||||
|
settings = mkOption {
|
||||||
|
inherit (tomlFormat) type;
|
||||||
|
default = { };
|
||||||
|
example = {
|
||||||
|
width = 400;
|
||||||
|
height = 512;
|
||||||
|
force_window = false;
|
||||||
|
corner_radius = "0";
|
||||||
|
font_size = 24;
|
||||||
|
bg_color = "0x272822ee";
|
||||||
|
bg_border_color = "0x131411ff";
|
||||||
|
input_text = {
|
||||||
|
font_color = "0xf8f8f2ff";
|
||||||
|
bg_color = "0x75715eff";
|
||||||
|
margin = "5";
|
||||||
|
padding = "1.7 -4";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
description = ''
|
||||||
|
Configuration settings for yofi. For all the available options
|
||||||
|
see: <https://github.com/l4l/yofi/wiki/Configuration#main-configuration>
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
blacklist = mkOption {
|
||||||
|
type = with types; listOf str;
|
||||||
|
default = [ ];
|
||||||
|
example = [
|
||||||
|
"firefox"
|
||||||
|
"librewolf"
|
||||||
|
"com.obsproject.Studio"
|
||||||
|
"com.rtosta.zapzap"
|
||||||
|
"cups"
|
||||||
|
"kitty-open"
|
||||||
|
"nvim"
|
||||||
|
];
|
||||||
|
description = ''
|
||||||
|
List of .desktop files yofi should ignore.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
assertions = [
|
||||||
|
(lib.hm.assertions.assertPlatform "programs.yofi" pkgs lib.platforms.linux)
|
||||||
|
];
|
||||||
|
|
||||||
|
home.packages = mkIf (cfg.package != null) [ cfg.package ];
|
||||||
|
xdg.configFile = {
|
||||||
|
"yofi/yofi.config" = mkIf (cfg.settings != { }) {
|
||||||
|
source = tomlFormat.generate "yofi-config" cfg.settings;
|
||||||
|
};
|
||||||
|
"yofi/blacklist" = mkIf (cfg.blacklist != [ ]) {
|
||||||
|
text = concatStringsSep "\n" (map (x: x + ".desktop") cfg.blacklist);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
7
tests/modules/programs/yofi/blacklist
Normal file
7
tests/modules/programs/yofi/blacklist
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
firefox.desktop
|
||||||
|
librewolf.desktop
|
||||||
|
com.obsproject.Studio.desktop
|
||||||
|
com.rtosta.zapzap.desktop
|
||||||
|
cups.desktop
|
||||||
|
kitty-open.desktop
|
||||||
|
nvim.desktop
|
||||||
5
tests/modules/programs/yofi/default.nix
Normal file
5
tests/modules/programs/yofi/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{ lib, pkgs, ... }:
|
||||||
|
|
||||||
|
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
||||||
|
yofi-example-config = ./example-config.nix;
|
||||||
|
}
|
||||||
41
tests/modules/programs/yofi/example-config.nix
Normal file
41
tests/modules/programs/yofi/example-config.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
{
|
||||||
|
programs.yofi = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
width = 400;
|
||||||
|
height = 512;
|
||||||
|
force_window = false;
|
||||||
|
corner_radius = "0";
|
||||||
|
font_size = 24;
|
||||||
|
bg_color = "0x272822ee";
|
||||||
|
bg_border_color = "0x131411ff";
|
||||||
|
input_text = {
|
||||||
|
font_color = "0xf8f8f2ff";
|
||||||
|
bg_color = "0x75715eff";
|
||||||
|
margin = "5";
|
||||||
|
padding = "1.7 -4";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
blacklist = [
|
||||||
|
"firefox"
|
||||||
|
"librewolf"
|
||||||
|
"com.obsproject.Studio"
|
||||||
|
"com.rtosta.zapzap"
|
||||||
|
"cups"
|
||||||
|
"kitty-open"
|
||||||
|
"nvim"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.config/yofi/yofi.config
|
||||||
|
assertFileExists home-files/.config/yofi/blacklist
|
||||||
|
|
||||||
|
assertFileContent home-files/.config/yofi/yofi.config \
|
||||||
|
${./yofi.config}
|
||||||
|
|
||||||
|
assertFileContent home-files/.config/yofi/blacklist \
|
||||||
|
${./blacklist}
|
||||||
|
'';
|
||||||
|
}
|
||||||
13
tests/modules/programs/yofi/yofi.config
Normal file
13
tests/modules/programs/yofi/yofi.config
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
bg_border_color = "0x131411ff"
|
||||||
|
bg_color = "0x272822ee"
|
||||||
|
corner_radius = "0"
|
||||||
|
font_size = 24
|
||||||
|
force_window = false
|
||||||
|
height = 512
|
||||||
|
width = 400
|
||||||
|
|
||||||
|
[input_text]
|
||||||
|
bg_color = "0x75715eff"
|
||||||
|
font_color = "0xf8f8f2ff"
|
||||||
|
margin = "5"
|
||||||
|
padding = "1.7 -4"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue