bemenu: add module

This commit is contained in:
Omer Naveed 2023-11-29 01:23:23 -06:00 committed by Robert Helgesson
parent c48ae40dbb
commit 2aff324cf6
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
8 changed files with 107 additions and 0 deletions

View file

@ -317,6 +317,12 @@
github = "nurelin"; github = "nurelin";
githubId = 5276274; githubId = 5276274;
}; };
omernaveedxyz = {
name = "Omer Naveed";
email = "omer@omernaveed.dev";
github = "omernaveedxyz";
githubId = 112912585;
};
otavio = { otavio = {
email = "otavio.salvador@ossystems.com.br"; email = "otavio.salvador@ossystems.com.br";
github = "otavio"; github = "otavio";

View file

@ -1363,6 +1363,14 @@ in
A new module is available: 'programs.sftpman'. A new module is available: 'programs.sftpman'.
''; '';
} }
{
time = "2023-12-29T08:22:40+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'programs.bemenu'.
'';
}
]; ];
}; };
} }

View file

@ -63,6 +63,7 @@ let
./programs/bat.nix ./programs/bat.nix
./programs/bacon.nix ./programs/bacon.nix
./programs/beets.nix ./programs/beets.nix
./programs/bemenu.nix
./programs/borgmatic.nix ./programs/borgmatic.nix
./programs/bottom.nix ./programs/bottom.nix
./programs/boxxy.nix ./programs/boxxy.nix

View file

@ -0,0 +1,52 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.bemenu;
in {
meta.maintainers = [ hm.maintainers.omernaveedxyz ];
options.programs.bemenu = {
enable = mkEnableOption "bemenu";
package = mkPackageOption pkgs "bemenu" { };
settings = mkOption {
type = with types; attrsOf (oneOf [ str int bool ]);
default = { };
example = literalExpression ''
{
line-height = 28;
prompt = "open";
ignorecase = true;
fb = "#1e1e2e";
ff = "#cdd6f4";
nb = "#1e1e2e";
nf = "#cdd6f4";
tb = "#1e1e2e";
hb = "#1e1e2e";
tf = "#f38ba8";
hf = "#f9e2af";
af = "#cdd6f4";
ab = "#1e1e2e";
}
'';
description =
"Configuration options for bemenu. See {manpage}`bemenu(1)`.";
};
};
config = mkIf cfg.enable {
assertions =
[ (hm.assertions.assertPlatform "programs.bemenu" pkgs platforms.linux) ];
home.packages = [ cfg.package ];
home.sessionVariables = mkIf (cfg.settings != { }) {
BEMENU_OPTS = cli.toGNUCommandLineShell { } cfg.settings;
};
};
}

View file

@ -181,6 +181,7 @@ import nmt {
./modules/programs/autorandr ./modules/programs/autorandr
./modules/programs/awscli ./modules/programs/awscli
./modules/programs/beets # One test relies on services.mpd ./modules/programs/beets # One test relies on services.mpd
./modules/programs/bemenu
./modules/programs/borgmatic ./modules/programs/borgmatic
./modules/programs/boxxy ./modules/programs/boxxy
./modules/programs/firefox ./modules/programs/firefox

View file

@ -0,0 +1,26 @@
{
programs.bemenu = {
enable = true;
settings = {
line-height = 28;
prompt = "open";
ignorecase = true;
fb = "#1e1e2e";
ff = "#cdd6f4";
nb = "#1e1e2e";
nf = "#cdd6f4";
tb = "#1e1e2e";
hb = "#1e1e2e";
tf = "#f38ba8";
hf = "#f9e2af";
af = "#cdd6f4";
ab = "#1e1e2e";
};
};
nmt.script = ''
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
assertFileContains home-path/etc/profile.d/hm-session-vars.sh \
"export BEMENU_OPTS=\"'--ab' '#1e1e2e' '--af' '#cdd6f4' '--fb' '#1e1e2e' '--ff' '#cdd6f4' '--hb' '#1e1e2e' '--hf' '#f9e2af' '--ignorecase' '--line-height' '28' '--nb' '#1e1e2e' '--nf' '#cdd6f4' '--prompt' 'open' '--tb' '#1e1e2e' '--tf' '#f38ba8'\""
'';
}

View file

@ -0,0 +1,4 @@
{
bemenu-empty-configuration = ./empty-configuration.nix;
bemenu-basic-configuration = ./basic-configuration.nix;
}

View file

@ -0,0 +1,9 @@
{
programs.bemenu = { enable = true; };
nmt.script = ''
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
assertFileNotRegex home-path/etc/profile.d/hm-session-vars.sh \
"export BEMENU_OPTS"
'';
}