Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: vscode: patch .desktop file to use absolute files. #56952

Closed
wants to merge 1 commit into from

Conversation

moredhel
Copy link
Member

@moredhel moredhel commented Mar 6, 2019

Motivation for this change

fix to work with Crostini

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions (Crostini)
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@veprbl
Copy link
Member

veprbl commented Mar 6, 2019

cc @eadwu

@eadwu
Copy link
Member

eadwu commented Mar 6, 2019

Works fine for vscode but this would break vscode-with-extensions. Also since you're patching for absolute paths, you should also patch this line [1] to be consistent.

diff --git a/pkgs/applications/editors/vscode/with-extensions.nix b/pkgs/applications/editors/vscode/with-extensions.nix
index 88bea0c0809..9ae4e619c71 100644
--- a/pkgs/applications/editors/vscode/with-extensions.nix
+++ b/pkgs/applications/editors/vscode/with-extensions.nix
@@ -67,7 +67,12 @@ runCommand "${wrappedPkgName}-with-extensions-${wrappedPkgVersion}" {
   mkdir -p "$out/share/pixmaps"
 
   ln -sT "${vscode}/share/pixmaps/code.png" "$out/share/pixmaps/code.png"
-  ln -sT "${vscode}/share/applications/${executableName}.desktop" "$out/share/applications/${executableName}.desktop"
+
+  substitute "${vscode}/share/applications/${executableName}.desktop" "$out/share/applications/${executableName}.desktop" \
+    --replace "${vscode}" "$out"
+  substitute "${vscode}/share/applications/${executableName}-url-handler.desktop" "$out/share/applications/${executableName}-url-handler.desktop" \
+    --replace "${vscode}" "$out"
+
   makeWrapper "${vscode}/bin/${executableName}" "$out/bin/${executableName}" ${lib.optionalString (vscodeExtensions != []) ''
     --add-flags "--extensions-dir ${combinedExtensionsDrv}/share/${wrappedPkgName}/extensions"
   ''}

[1]

exec = executableName + " --open-url %U";

@moredhel
Copy link
Member Author

moredhel commented Mar 7, 2019

@eadwu thanks for the advice, I think I am going to hold out on this PR for the moment while I discuss on #56954 a better solution for Crostini in general.

If you have any thoughts regarding it, then do hop over and let us know 👍

@moredhel moredhel changed the title vscode: patch .desktop file to use absolute files. WIP: vscode: patch .desktop file to use absolute files. Mar 7, 2019
@worldofpeace
Copy link
Contributor

I believe this has already been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants