diff --git a/tests/configs/default.nix b/tests/configs/default.nix index 4f1032d..7183bae 100644 --- a/tests/configs/default.nix +++ b/tests/configs/default.nix @@ -16,6 +16,7 @@ in specialArgs.yourMomName = "Yor mom"; }; xdg-desktop-entry = build { modules = [ ./xdg-desktop-entry.nix ]; }; + xdg-basedirs = build { modules = [ ./xdg-basedirs.nix ]; }; single-basepackage = build { modules = [ ./single-basepackage.nix ]; }; neofetch-with-additional-files = build { modules = [ ./neofetch-with-additional-files.nix ]; }; lib-modules-make-wraparound = build { modules = [ ./lib-modules-subset/make-wraparound.nix ]; }; diff --git a/tests/configs/xdg-basedirs.nix b/tests/configs/xdg-basedirs.nix new file mode 100644 index 0000000..3733b28 --- /dev/null +++ b/tests/configs/xdg-basedirs.nix @@ -0,0 +1,53 @@ +{ + config, + lib, + pkgs, + wrapperManagerLib, + ... +}: + +{ + xdg.configDirs = wrapperManagerLib.getXdgConfigDirs ( + with pkgs; + [ + yt-dlp + ] + ); + + xdg.dataDirs = wrapperManagerLib.getXdgDataDirs ( + with pkgs; + [ + yt-dlp + ] + ); + + wrappers.xdg-config-dirs-script = { + arg0 = let + app = pkgs.writeShellScript "xdg-dirs-script" '' + echo "$XDG_CONFIG_DIRS" | tr ':' '\n' + ''; + in builtins.toString app; + }; + + wrappers.xdg-data-dirs-script = { + arg0 = let + app = pkgs.writeShellScript "xdg-dirs-script" '' + echo "$XDG_DATA_DIRS" | tr ':' '\n' + ''; + in builtins.toString app; + }; + + build.extraPassthru.wrapperManagerTests = { + actuallyBuilt = + let + wrapper = config.build.toplevel; + in + pkgs.runCommand "wrapper-manager-xdg-desktop-entry-actually-built" { } '' + [ -x "${wrapper}/bin/xdg-data-dirs-script" ] && { + ${lib.getExe' wrapper "xdg-data-dirs-script"} | grep "${pkgs.yt-dlp}/share" > /dev/null + } && [ -x "${wrapper}/bin/xdg-config-dirs-script" ] && { + ${lib.getExe' wrapper "xdg-config-dirs-script"} | grep "${pkgs.yt-dlp}/etc/xdg" > /dev/null + } && touch $out + ''; + }; +}