wrapper-manager/dconf: add test and fix module

More proof that I don't do testing in this project. :)
This commit is contained in:
Gabriel Arazas 2024-08-29 20:07:28 +08:00
parent 4011c89612
commit 6b4422c8cd
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360
4 changed files with 34 additions and 3 deletions

View File

@ -39,14 +39,15 @@ in
dconfProfileFile =
pkgs.writeText
"dconf-profile"
(lib.concatMapStrings (profile: "${profile}\n") submoduleCfg.profiles);
(lib.concatMapStrings (db: "${db}\n") submoduleCfg.profile);
dconfDirName = "wrapper-manager-dconf-${config.executableName}";
dconfSettings =
settingsFormat.generate "wrapper-manager-dconf-${config.executableName}" submoduleCfg.settings;
settingsFormat.generate dconfDirName submoduleCfg.settings;
dconfSettingsDatabase =
pkgs.runCommand "wrapper-manager-dconf-${config.executableName}-database" { nativeBuildInputs = [ submoduleCfg.package ]; } ''
dconf compile ${builtins.placeholder "out"} ${dconfSettings}
dconf compile ${builtins.placeholder "out"} "${dconfSettings}/dconf"
'';
in {
options.dconf = {

View File

@ -0,0 +1,26 @@
{ config, lib, pkgs, ... }:
let
section = "one/foodogsquared/SomeMadeUpCrap";
key = "somemadeupkey";
value = true;
in
{
wrappers.dconf-test = {
arg0 = lib.getExe' pkgs.dconf "dconf";
dconf = {
enable = true;
settings.${section}.${key} = value;
};
};
build.extraPassthru.tests = {
dconfCheck = pkgs.runCommand "dconf-wrapped-test" { } ''
export HOME=$TMPDIR
# We've hardcoded the value for now since Nix toString function makes the
# boolean either "1" or an empty string.
[ "$(${lib.getExe' config.build.toplevel "dconf-test"} read '/${section}/${key}')" = 'true' ] && touch $out
'';
};
}

View File

@ -0,0 +1,3 @@
{
basic = ./basic.nix;
}

View File

@ -21,4 +21,5 @@ in
boxxy = runTests ./sandboxing/boxxy { };
zellij = runTests ./programs/zellij { };
jujutsu = runTests ./programs/jujutsu { };
dconf = runTests ./dconf { };
}