diff --git a/modules/symlinkScript/checks/filesToPatch.nix b/modules/symlinkScript/checks/filesToPatch.nix index af1fa392..01b9f1ef 100644 --- a/modules/symlinkScript/checks/filesToPatch.nix +++ b/modules/symlinkScript/checks/filesToPatch.nix @@ -7,36 +7,47 @@ let # Create a dummy package with a desktop file that references itself dummyPackage = - (pkgs.runCommand "dummy-app" { } '' - mkdir -p $out/bin - mkdir -p $out/share/applications + (pkgs.runCommand "dummy-app" + { + nativeBuildInputs = [ pkgs.makeBinaryWrapper ]; + } + '' + mkdir -p $out/bin + mkdir -p $out/share/applications - # Create a simple executable - cat > $out/bin/dummy-app <<'EOF' - #!/bin/sh - echo "Hello from dummy app" - EOF - chmod +x $out/bin/dummy-app + # Make a dummy program to have a valid package + makeWrapper ${pkgs.hello}/bin/hello $out/bin/dummy-app - # Create a desktop file that references the package path - cat > $out/share/applications/dummy-app.desktop < $out/share/applications/dummy-app.desktop < "$file" + # Use `sd` which works for both text and binary files + ${pkgs.sd}/bin/sd --fixed-strings "$oldPath" "$newPath" < "$target" > "$file" # Preserve permissions chmod --reference="$target" "$file" fi