From 3499e3ec704b00d2155e1be72bb8f34081e471e4 Mon Sep 17 00:00:00 2001 From: Daniel Thwaites Date: Wed, 23 Jul 2025 12:32:21 +0100 Subject: [PATCH] treewide: properly quote stylix.image when used as a shell argument Closes: https://github.com/nix-community/stylix/issues/1720 Fixes: 218d4424b063 ("treewide: remove redundant stylix.image Nix store copies (#1659)") --- modules/grub/nixos.nix | 6 +++++- stylix/palette.nix | 2 +- stylix/testbed/images.nix | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/grub/nixos.nix b/modules/grub/nixos.nix index 195ea5a1..17b9a566 100644 --- a/modules/grub/nixos.nix +++ b/modules/grub/nixos.nix @@ -134,7 +134,11 @@ in cfg.useWallpaper # Make sure the background image is .png by asking to convert it then - "${lib.getExe' pkgs.imagemagick "convert"} ${config.stylix.image} png32:$out/background.png" + '' + ${lib.getExe' pkgs.imagemagick "convert"} \ + ${lib.escapeShellArg config.stylix.image} \ + "png32:$out/background.png" + '' else "cp ${pixel "base00"} $out/background.png" } diff --git a/stylix/palette.nix b/stylix/palette.nix index febefd32..44e339f1 100644 --- a/stylix/palette.nix +++ b/stylix/palette.nix @@ -83,7 +83,7 @@ in default = pkgs.runCommand "palette.json" { } '' ${lib.getExe cfg.paletteGenerator} \ "${cfg.polarity}" \ - ${cfg.image} \ + ${lib.escapeShellArg cfg.image} \ "$out" ''; }; diff --git a/stylix/testbed/images.nix b/stylix/testbed/images.nix index fd569b51..03e1aafc 100644 --- a/stylix/testbed/images.nix +++ b/stylix/testbed/images.nix @@ -9,7 +9,9 @@ }; light = fetchurl { - name = "three-bicycles.jpg"; + # 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="; };