stylix/testbed: make path escaping test actually contain a space

Previously the space was sanitized away by `fetchurl` because it was
part of the derivation name. Also, the path with a space was not used
in the `schemeless` theme, which is where the bug happened.
This commit is contained in:
Daniel Thwaites 2025-07-23 20:59:28 +01:00 committed by NAHO
parent 3499e3ec70
commit 8017dec82d
No known key found for this signature in database
GPG key ID: BFB5D5E3F4C95185
2 changed files with 21 additions and 9 deletions

View file

@ -1,5 +1,6 @@
{
fetchurl,
runCommandLocal,
}:
{
dark = fetchurl {
@ -8,11 +9,22 @@
hash = "sha256-Dm/0nKiTFOzNtSiARnVg7zM0J1o+EuIdUQ3OAuasM58=";
};
light = fetchurl {
# Includes a space to make sure the path is properly quoted via
# `lib.escapeShellArg` when used as a shell argument.
name = "three bicycles.jpg";
url = "https://unsplash.com/photos/hwLAI5lRhdM/download?ixid=M3wxMjA3fDB8MXxhbGx8fHx8fHx8fHwxNzE2MzYxNDcwfA&force=true";
hash = "sha256-S0MumuBGJulUekoGI2oZfUa/50Jw0ZzkqDDu1nRkFUA=";
};
light =
let
image = fetchurl {
name = "three-bicycles.jpg";
url = "https://unsplash.com/photos/hwLAI5lRhdM/download?ixid=M3wxMjA3fDB8MXxhbGx8fHx8fHx8fHwxNzE2MzYxNDcwfA&force=true";
hash = "sha256-S0MumuBGJulUekoGI2oZfUa/50Jw0ZzkqDDu1nRkFUA=";
};
# Create a path containing a space to test that `stylix.image` is
# correctly quoted when used as a shell argument. We have to use a
# directory as the parent because derivation names themselves cannot
# contain spaces.
directory = runCommandLocal "three-bicycles" { } ''
mkdir "$out"
cp ${image} "$out/three bicycles.jpg"
'';
in
"${directory}/three bicycles.jpg";
}

View file

@ -5,8 +5,8 @@ in
{
stylix = {
enable = true;
image = images.dark;
polarity = "dark";
image = images.light;
polarity = "light";
cursor = {
name = "Vanilla-DMZ";
package = pkgs.vanilla-dmz;