1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-24 02:39:48 +01:00

yambar: add module

This commit is contained in:
Akiyoshi Suda 2022-10-25 21:31:46 +09:00 committed by Robert Helgesson
parent f2c5ba5e72
commit 5514ed3210
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
8 changed files with 130 additions and 0 deletions

View file

@ -1642,6 +1642,20 @@ in {
https://github.com/hyprwm/hyprpaper for more.
'';
}
{
time = "2024-05-10T21:28:38+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'programs.yambar'.
Yambar is a lightweight and configurable status panel for X11 and
Wayland, that goes to great lengths to be both CPU and battery
efficient - polling is only done when absolutely necessary.
See https://codeberg.org/dnkl/yambar for more.
'';
}
];
};
}

View file

@ -254,6 +254,7 @@ let
./programs/wpaperd.nix
./programs/xmobar.nix
./programs/xplr.nix
./programs/yambar.nix
./programs/yazi.nix
./programs/yt-dlp.nix
./programs/z-lua.nix

View file

@ -0,0 +1,55 @@
{ config, lib, pkgs, ... }:
let
cfg = config.programs.yambar;
yamlFormat = pkgs.formats.yaml { };
in {
meta.maintainers = [ lib.maintainers.carpinchomug ];
options.programs.yambar = {
enable = lib.mkEnableOption "Yambar";
package = lib.mkPackageOption pkgs "yambar" { };
settings = lib.mkOption {
type = yamlFormat.type;
default = { };
example = lib.literalExpression ''
bar = {
location = "top";
height = 26;
background = "00000066";
right = [
{
clock.content = [
{
string.text = "{time}";
}
];
}
];
};
'';
description = ''
Configuration written to {file}`$XDG_CONFIG_HOME/yambar/config.yml`.
See {manpage}`yambar(5)` for options.
'';
};
};
config = lib.mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "programs.yambar" pkgs
lib.platforms.linux)
];
home.packages = [ cfg.package ];
xdg.configFile."yambar/config.yml" = lib.mkIf (cfg.settings != { }) {
source = yamlFormat.generate "config.yml" cfg.settings;
};
};
}

View file

@ -219,6 +219,7 @@ in import nmtSrc {
./modules/programs/wofi
./modules/programs/wpaperd
./modules/programs/xmobar
./modules/programs/yambar
./modules/programs/yt-dlp
./modules/services/activitywatch
./modules/services/avizo

View file

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

View file

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

View file

@ -0,0 +1,9 @@
bar:
background: '00000066'
height: 26
location: top
right:
- clock:
content:
- string:
text: '{time}'

View file

@ -0,0 +1,35 @@
{ config, ... }:
{
programs.yambar = {
enable = true;
package = config.lib.test.mkStubPackage { };
settings = {
bar = {
location = "top";
height = 26;
background = "00000066";
right = [{ clock.content = [{ string.text = "{time}"; }]; }];
};
};
};
nmt.script = ''
assertFileContent \
home-files/.config/yambar/config.yml \
${
builtins.toFile "yambar-expected.yml" ''
bar:
background: '00000066'
height: 26
location: top
right:
- clock:
content:
- string:
text: '{time}'
''
}
'';
}