Merge pull request #23516 from layus/fix-wrapFirefox-default-browser
wrapFirefox: fix default-browser update
This commit is contained in:
commit
9788dded2f
@ -17,7 +17,7 @@ browser:
|
||||
, desktopName ? # browserName with first letter capitalized
|
||||
(lib.toUpper (lib.substring 0 1 browserName) + lib.substring 1 (-1) browserName)
|
||||
, nameSuffix ? ""
|
||||
, icon ? browserName, libtrick ? true
|
||||
, icon ? browserName
|
||||
}:
|
||||
|
||||
let
|
||||
@ -52,16 +52,15 @@ let
|
||||
gst-plugins = with gst_all; [ gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-ffmpeg ];
|
||||
gtk_modules = [ libcanberra_gtk2 ];
|
||||
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
in stdenv.mkDerivation {
|
||||
inherit name;
|
||||
|
||||
desktopItem = makeDesktopItem {
|
||||
name = browserName;
|
||||
exec = browserName + " %U";
|
||||
exec = "${browserName}${nameSuffix} %U";
|
||||
inherit icon;
|
||||
comment = "";
|
||||
desktopName = desktopName;
|
||||
desktopName = "${desktopName}${nameSuffix}";
|
||||
genericName = "Web Browser";
|
||||
categories = "Application;Network;WebBrowser;";
|
||||
mimeType = stdenv.lib.concatStringsSep ";" [
|
||||
@ -84,39 +83,27 @@ stdenv.mkDerivation {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
makeWrapper "${browser}/bin/${browserName}" \
|
||||
makeWrapper "$(readlink -v --canonicalize-existing "${browser}/bin/${browserName}")" \
|
||||
"$out/bin/${browserName}${nameSuffix}" \
|
||||
--suffix-each MOZ_PLUGIN_PATH ':' "$plugins" \
|
||||
--suffix LD_LIBRARY_PATH ':' "$libs" \
|
||||
--suffix-each GTK_PATH ':' "$gtk_modules" \
|
||||
--suffix-each LD_PRELOAD ':' "$(cat $(filterExisting $(addSuffix /extra-ld-preload $plugins)))" \
|
||||
--prefix-contents PATH ':' "$(filterExisting $(addSuffix /extra-bin-path $plugins))" \
|
||||
--set MOZ_OBJDIR "$(ls -d "${browser}/lib/${browserName}"*)" \
|
||||
--suffix PATH ':' "$out/bin" \
|
||||
--set MOZ_APP_LAUNCHER "${browserName}${nameSuffix}" \
|
||||
${lib.optionalString (!ffmpegSupport) ''--prefix GST_PLUGIN_SYSTEM_PATH : "$GST_PLUGIN_SYSTEM_PATH"''}
|
||||
|
||||
${ lib.optionalString libtrick
|
||||
''
|
||||
libdirname="$(echo "${browser}/lib/${browserName}"*)"
|
||||
libdirbasename="$(basename "$libdirname")"
|
||||
mkdir -p "$out/lib/$libdirbasename"
|
||||
ln -s "$libdirname"/* "$out/lib/$libdirbasename"
|
||||
script_location="$(mktemp "$out/lib/$libdirbasename/${browserName}${nameSuffix}.XXXXXX")"
|
||||
mv "$out/bin/${browserName}${nameSuffix}" "$script_location"
|
||||
ln -s "$script_location" "$out/bin/${browserName}${nameSuffix}"
|
||||
''
|
||||
}
|
||||
|
||||
if [ -e "${browser}/share/icons" ]; then
|
||||
mkdir -p "$out/share"
|
||||
ln -s "${browser}/share/icons" "$out/share/icons"
|
||||
else
|
||||
mkdir -p "$out/share/icons/hicolor/128x128/apps"
|
||||
ln -s "$out/lib/$libdirbasename/browser/icons/mozicon128.png" \
|
||||
ln -s "${browser}/lib/${browserName}-"*"/browser/icons/mozicon128.png" \
|
||||
"$out/share/icons/hicolor/128x128/apps/${browserName}.png"
|
||||
fi
|
||||
|
||||
mkdir -p $out/share/applications
|
||||
cp $desktopItem/share/applications/* $out/share/applications
|
||||
install -D -t $out/share/applications $desktopItem/share/applications/*
|
||||
|
||||
# For manpages, in case the program supplies them
|
||||
mkdir -p $out/nix-support
|
||||
|
Loading…
Reference in New Issue
Block a user