

Another alternative approach would be to add a duplicate desktop file, but to write it declaratively using Home Manager:
# in home.nix
home.file.".local/share/applications/firefox.desktop".source =
pkgs.runCommand "firefox-desktop" { } ''
cp "${pkgs.firefox}/share/applications/firefox.desktop" "$out"
substituteInPlace "$out" \
--replace-fail "Terminal=false" "Terminal=true"
'';
# - or -
home.file.".local/share/applications/firefox.desktop".text = ''
[Desktop Entry]
Name=Firefox
Icon=firefox
Exec=firefox --name firefox %U
'';
It would be possible to DIY this with user activation scripts, but I don’t really see a value in doing that over the symlinkJoin
.
It understands
\n
if I recall correctly. You can also write regular bash, use templating tools, etc. Just use thenativeBuildInputs
parameter if you need a binary that isn’t provided by stdenv.