home-manager: programs.valw.noctalia.enable; README and checklist

This commit is contained in:
elwrcl committed 2026-10-04 06:15:11 +03:00
1 parent 127d44040e
commit 9fa71fd399
4 files changed
+64 -13

No files matched your search

+24 -12
View File
@@ -13,28 +13,32 @@
# The home-manager module, evaluated with stand-ins for the two
# home-manager options it sets (no home-manager input needed).
homeModule =
settings:
valwConfig:
(lib.evalModules {
modules = [
self.homeModules.default
(
{ lib, ... }:
{
options.home.packages = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [ ];
};
options.xdg.configFile = lib.mkOption {
let
files = lib.mkOption {
type = lib.types.attrsOf (
lib.types.submodule { options.source = lib.mkOption { type = lib.types.path; }; }
);
default = { };
};
in
{
options.home.packages = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [ ];
};
options.xdg.configFile = files;
options.xdg.dataFile = files;
config._module.args.pkgs = pkgs;
config.programs.valw = {
enable = true;
inherit settings;
};
}
// valwConfig;
}
)
];
@@ -58,12 +62,19 @@
let
plain = homeModule { };
set = homeModule {
preview.timeout_secs = 3;
sound.volume = 0.4;
settings = {
preview.timeout_secs = 3;
sound.volume = 0.4;
};
};
noctalia = homeModule { noctalia.enable = true; };
in
assert lib.assertMsg (plain.home.packages == [ valw ]) "the module installs valw";
assert lib.assertMsg (plain.xdg.configFile == { }) "no settings, no config file";
assert lib.assertMsg (plain.xdg.dataFile == { }) "no Noctalia plugin unless asked";
assert lib.assertMsg (
noctalia.xdg.dataFile."noctalia/plugins/valw".source == "${valw}/share/valw/noctalia-plugin"
) "the plugin is linked where Noctalia looks";
pkgs.runCommand "valw-home-module" { } ''
grep -qx 'timeout_secs = 3' ${set.xdg.configFile."valw/config.toml".source}
grep -qx 'volume = 0.4' ${set.xdg.configFile."valw/config.toml".source}
@@ -79,7 +90,8 @@
let
fails =
settings:
pkgs.testers.testBuildFailure (homeModule settings).xdg.configFile."valw/config.toml".source;
pkgs.testers.testBuildFailure
(homeModule { inherit settings; }).xdg.configFile."valw/config.toml".source;
in
pkgs.runCommand "valw-home-module-rejects" { } ''
grep -q 'sound.volume must be between 0 and 1' ${fails { sound.volume = 2; }}/testBuildFailure.log
+9
View File
@@ -45,6 +45,12 @@
valw at build time. Empty means valw's defaults.
'';
};
noctalia.enable = lib.mkEnableOption ''
valw's Noctalia plugin (a bar button, the toolbar as a Noctalia
panel and a control-center tile), linked into
`$XDG_DATA_HOME/noctalia/plugins/valw`. Enable `elars/valw` and
place its widget in Noctalia's own settings
'';
};
config = lib.mkIf cfg.enable {
@@ -52,6 +58,9 @@
xdg.configFile."valw/config.toml" = lib.mkIf (cfg.settings != { }) {
source = checked cfg.settings;
};
xdg.dataFile."noctalia/plugins/valw" = lib.mkIf cfg.noctalia.enable {
source = "${cfg.package}/share/valw/noctalia-plugin";
};
};
};
}