fuzzel: add module

This commit is contained in:
Sefa Eyeoglu 2023-03-01 15:57:55 +01:00 committed by Robert Helgesson
parent 9384997717
commit e0026e16a5
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
9 changed files with 109 additions and 0 deletions

3
.github/CODEOWNERS vendored
View file

@ -117,6 +117,9 @@ Makefile @thiagokokada
/modules/services/fusuma.nix @iosmanthus
/tests/modules/services/fusuma @iosmanthus
/modules/programs/fuzzel.nix @Scrumplex
/tests/modules/programs/fuzzel @Scrumplex
/modules/programs/gallery-dl.nix @marsam
/tests/modules/programs/gallery-dl @marsam

View file

@ -1015,6 +1015,14 @@ in
A new module is available: 'programs.translate-shell'.
'';
}
{
time = "2023-05-13T13:51:18+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'programs.fuzzel'.
'';
}
];
};
}

View file

@ -76,6 +76,7 @@ let
./programs/firefox.nix
./programs/fish.nix
./programs/foot.nix
./programs/fuzzel.nix
./programs/fzf.nix
./programs/gallery-dl.nix
./programs/getmail.nix

View file

@ -0,0 +1,52 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) literalExpression mkEnableOption mkPackageOption mkOption mkIf;
cfg = config.programs.fuzzel;
iniFormat = pkgs.formats.ini { };
in {
meta.maintainers = [ lib.maintainers.Scrumplex ];
options.programs.fuzzel = {
enable = mkEnableOption "fuzzel";
package = mkPackageOption pkgs "fuzzel" { };
settings = mkOption {
type = iniFormat.type;
default = { };
example = literalExpression ''
{
main = {
terminal = "''${pkgs.foot}/bin/foot";
layer = "overlay";
};
colors.background = "ffffffff";
}
'';
description = ''
Configuration for fuzzel written to
<filename>$XDG_CONFIG_HOME/fuzzel/fuzzel.ini</filename>. See
<citerefentry><refentrytitle>fuzzel.ini</refentrytitle>
<manvolnum>5</manvolnum></citerefentry> for a list of available options.
'';
};
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "programs.fuzzel" pkgs
lib.platforms.linux)
];
home.packages = [ cfg.package ];
xdg.configFile."fuzzel/fuzzel.ini" = mkIf (cfg.settings != { }) {
source = iniFormat.generate "fuzzel.ini" cfg.settings;
};
};
}

View file

@ -157,6 +157,7 @@ import nmt {
./modules/programs/borgmatic
./modules/programs/firefox
./modules/programs/foot
./modules/programs/fuzzel
./modules/programs/getmail
./modules/programs/gnome-terminal
./modules/programs/hexchat

View file

@ -0,0 +1,4 @@
{
fuzzel-example-settings = ./example-settings.nix;
fuzzel-empty-settings = ./empty-settings.nix;
}

View file

@ -0,0 +1,11 @@
{ ... }:
{
programs.fuzzel.enable = true;
test.stubs.fuzzel = { };
nmt.script = ''
assertPathNotExists home-files/.config/fuzzel
'';
}

View file

@ -0,0 +1,6 @@
[border]
width=6
[main]
dpi-aware=yes
font=Fira Code:size=11

View file

@ -0,0 +1,23 @@
{ config, ... }:
{
programs.fuzzel = {
enable = true;
package = config.lib.test.mkStubPackage { };
settings = {
main = {
font = "Fira Code:size=11";
dpi-aware = "yes";
};
border = { width = 6; };
};
};
nmt.script = ''
assertFileContent \
home-files/.config/fuzzel/fuzzel.ini \
${./example-settings-expected.ini}
'';
}