2023-11-27 01:48:22 +00:00
|
|
|
{ channel, version, revision, hash }:
|
2022-02-22 00:13:49 +00:00
|
|
|
|
|
|
|
{ stdenv
|
|
|
|
, fetchurl
|
|
|
|
, lib
|
2023-03-03 12:13:25 +00:00
|
|
|
, makeWrapper
|
2022-02-22 00:13:49 +00:00
|
|
|
|
|
|
|
, binutils-unwrapped
|
|
|
|
, xz
|
|
|
|
, gnutar
|
|
|
|
, file
|
|
|
|
|
|
|
|
, glibc
|
|
|
|
, glib
|
|
|
|
, nss
|
|
|
|
, nspr
|
|
|
|
, atk
|
|
|
|
, at-spi2-atk
|
|
|
|
, xorg
|
|
|
|
, cups
|
|
|
|
, dbus
|
|
|
|
, expat
|
|
|
|
, libdrm
|
|
|
|
, libxkbcommon
|
2024-03-30 21:52:15 +00:00
|
|
|
, pipewire
|
2022-02-22 00:13:49 +00:00
|
|
|
, gtk3
|
|
|
|
, pango
|
|
|
|
, cairo
|
|
|
|
, gdk-pixbuf
|
|
|
|
, mesa
|
|
|
|
, alsa-lib
|
|
|
|
, at-spi2-core
|
|
|
|
, libuuid
|
|
|
|
, systemd
|
2022-05-28 16:44:08 +01:00
|
|
|
, wayland
|
2024-04-03 05:31:42 +01:00
|
|
|
, libGL
|
2023-10-28 13:00:48 +01:00
|
|
|
|
|
|
|
# command line arguments which are always set e.g "--disable-gpu"
|
|
|
|
, commandLineArgs ? ""
|
2022-02-22 00:13:49 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
baseName = "microsoft-edge";
|
|
|
|
|
|
|
|
shortName = if channel == "stable"
|
|
|
|
then "msedge"
|
|
|
|
else "msedge-" + channel;
|
|
|
|
|
|
|
|
longName = if channel == "stable"
|
|
|
|
then baseName
|
|
|
|
else baseName + "-" + channel;
|
|
|
|
|
2023-06-24 19:19:19 +01:00
|
|
|
iconSuffix = lib.optionalString (channel != "stable") "_${channel}";
|
2022-02-22 00:13:49 +00:00
|
|
|
|
2023-06-24 19:19:19 +01:00
|
|
|
desktopSuffix = lib.optionalString (channel != "stable") "-${channel}";
|
2022-02-22 00:13:49 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2023-09-21 00:36:30 +01:00
|
|
|
pname="${baseName}-${channel}";
|
|
|
|
inherit version;
|
2022-02-22 00:13:49 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://packages.microsoft.com/repos/edge/pool/main/m/${baseName}-${channel}/${baseName}-${channel}_${version}-${revision}_amd64.deb";
|
2023-11-27 01:48:22 +00:00
|
|
|
inherit hash;
|
2022-02-22 00:13:49 +00:00
|
|
|
};
|
|
|
|
|
2023-03-03 12:13:25 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
|
2022-02-22 00:13:49 +00:00
|
|
|
unpackCmd = "${binutils-unwrapped}/bin/ar p $src data.tar.xz | ${xz}/bin/xz -dc | ${gnutar}/bin/tar -xf -";
|
|
|
|
sourceRoot = ".";
|
|
|
|
|
|
|
|
dontPatch = true;
|
|
|
|
dontConfigure = true;
|
|
|
|
dontPatchELF = true;
|
|
|
|
|
|
|
|
buildPhase = let
|
|
|
|
libPath = {
|
|
|
|
msedge = lib.makeLibraryPath [
|
|
|
|
glibc glib nss nspr atk at-spi2-atk xorg.libX11
|
|
|
|
xorg.libxcb cups.lib dbus.lib expat libdrm
|
|
|
|
xorg.libXcomposite xorg.libXdamage xorg.libXext
|
|
|
|
xorg.libXfixes xorg.libXrandr libxkbcommon
|
2024-03-30 21:52:15 +00:00
|
|
|
pipewire gtk3 pango cairo gdk-pixbuf mesa
|
2022-05-28 16:44:08 +01:00
|
|
|
alsa-lib at-spi2-core xorg.libxshmfence systemd wayland
|
2022-02-22 00:13:49 +00:00
|
|
|
];
|
|
|
|
naclHelper = lib.makeLibraryPath [
|
|
|
|
glib nspr atk libdrm xorg.libxcb mesa xorg.libX11
|
|
|
|
xorg.libXext dbus.lib libxkbcommon
|
|
|
|
];
|
|
|
|
libwidevinecdm = lib.makeLibraryPath [
|
|
|
|
glib nss nspr
|
|
|
|
];
|
|
|
|
libGLESv2 = lib.makeLibraryPath [
|
2024-04-03 05:31:42 +01:00
|
|
|
xorg.libX11 xorg.libXext xorg.libxcb wayland libGL
|
2022-02-22 00:13:49 +00:00
|
|
|
];
|
|
|
|
liboneauth = lib.makeLibraryPath [
|
|
|
|
libuuid xorg.libX11
|
|
|
|
];
|
|
|
|
};
|
|
|
|
in ''
|
|
|
|
patchelf \
|
|
|
|
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
|
|
|
--set-rpath "${libPath.msedge}" \
|
|
|
|
opt/microsoft/${shortName}/msedge
|
|
|
|
|
|
|
|
patchelf \
|
|
|
|
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
|
|
|
opt/microsoft/${shortName}/msedge-sandbox
|
|
|
|
|
|
|
|
patchelf \
|
|
|
|
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
|
|
|
opt/microsoft/${shortName}/msedge_crashpad_handler
|
|
|
|
|
|
|
|
patchelf \
|
|
|
|
--set-rpath "${libPath.libwidevinecdm}" \
|
|
|
|
opt/microsoft/${shortName}/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so
|
|
|
|
|
|
|
|
patchelf \
|
|
|
|
--set-rpath "${libPath.libGLESv2}" \
|
|
|
|
opt/microsoft/${shortName}/libGLESv2.so
|
|
|
|
|
|
|
|
patchelf \
|
|
|
|
--set-rpath "${libPath.liboneauth}" \
|
|
|
|
opt/microsoft/${shortName}/liboneauth.so
|
2023-12-13 00:34:45 +00:00
|
|
|
'' + lib.optionalString (lib.versionOlder version "121") ''
|
2023-11-27 01:48:22 +00:00
|
|
|
patchelf \
|
2023-12-13 00:34:45 +00:00
|
|
|
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
|
|
|
--set-rpath "${libPath.naclHelper}" \
|
|
|
|
opt/microsoft/${shortName}/nacl_helper
|
2022-02-22 00:13:49 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp -R opt usr/bin usr/share $out
|
|
|
|
|
|
|
|
${if channel == "stable"
|
2023-05-17 21:30:28 +01:00
|
|
|
then "ln -sf $out/bin/${longName} $out/bin/${baseName}-${channel}"
|
2022-02-22 00:13:49 +00:00
|
|
|
else "ln -sf $out/opt/microsoft/${shortName}/${baseName}-${channel} $out/opt/microsoft/${shortName}/${baseName}"}
|
|
|
|
|
|
|
|
ln -sf $out/opt/microsoft/${shortName}/${longName} $out/bin/${longName}
|
|
|
|
|
|
|
|
rm -rf $out/share/doc
|
|
|
|
rm -rf $out/opt/microsoft/${shortName}/cron
|
|
|
|
|
|
|
|
for icon in '16' '24' '32' '48' '64' '128' '256'
|
|
|
|
do
|
|
|
|
${ "icon_source=$out/opt/microsoft/${shortName}/product_logo_\${icon}${iconSuffix}.png" }
|
|
|
|
${ "icon_target=$out/share/icons/hicolor/\${icon}x\${icon}/apps" }
|
|
|
|
mkdir -p $icon_target
|
|
|
|
cp $icon_source $icon_target/microsoft-edge${desktopSuffix}.png
|
|
|
|
done
|
|
|
|
|
|
|
|
substituteInPlace $out/share/applications/${longName}.desktop \
|
|
|
|
--replace /usr/bin/${baseName}-${channel} $out/bin/${longName}
|
|
|
|
|
|
|
|
substituteInPlace $out/share/gnome-control-center/default-apps/${longName}.xml \
|
|
|
|
--replace /opt/microsoft/${shortName} $out/opt/microsoft/${shortName}
|
|
|
|
|
|
|
|
substituteInPlace $out/share/menu/${longName}.menu \
|
|
|
|
--replace /opt/microsoft/${shortName} $out/opt/microsoft/${shortName}
|
|
|
|
|
|
|
|
substituteInPlace $out/opt/microsoft/${shortName}/xdg-mime \
|
2023-03-03 12:13:25 +00:00
|
|
|
--replace "\''${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" "\''${XDG_DATA_DIRS:-/run/current-system/sw/share}" \
|
2022-02-22 00:13:49 +00:00
|
|
|
--replace "xdg_system_dirs=/usr/local/share/:/usr/share/" "xdg_system_dirs=/run/current-system/sw/share/" \
|
|
|
|
--replace /usr/bin/file ${file}/bin/file
|
|
|
|
|
|
|
|
substituteInPlace $out/opt/microsoft/${shortName}/default-app-block \
|
|
|
|
--replace /opt/microsoft/${shortName} $out/opt/microsoft/${shortName}
|
|
|
|
|
|
|
|
substituteInPlace $out/opt/microsoft/${shortName}/xdg-settings \
|
2023-03-03 12:13:25 +00:00
|
|
|
--replace "\''${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" "\''${XDG_DATA_DIRS:-/run/current-system/sw/share}" \
|
|
|
|
--replace "\''${XDG_CONFIG_DIRS:-/etc/xdg}" "\''${XDG_CONFIG_DIRS:-/run/current-system/sw/etc/xdg}"
|
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
wrapProgram "$out/bin/${longName}" \
|
2023-10-28 13:00:48 +01:00
|
|
|
--prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.pname}-${gtk3.version}" \
|
|
|
|
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
|
|
|
|
--add-flags ${lib.escapeShellArg commandLineArgs}
|
2022-02-22 00:13:49 +00:00
|
|
|
'';
|
|
|
|
|
2023-10-14 23:23:55 +01:00
|
|
|
# We only want automatic updates for stable, beta and dev will get updated by the same script
|
|
|
|
# and are only used for testing.
|
|
|
|
passthru = lib.optionalAttrs (channel == "stable") { updateScript = ./update.py; };
|
2023-09-21 00:35:27 +01:00
|
|
|
|
2022-02-22 00:13:49 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://www.microsoft.com/en-us/edge";
|
|
|
|
description = "The web browser from Microsoft";
|
|
|
|
license = licenses.unfree;
|
2022-06-01 09:07:10 +01:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
2022-02-22 00:13:49 +00:00
|
|
|
platforms = [ "x86_64-linux" ];
|
2023-09-21 00:37:02 +01:00
|
|
|
maintainers = with maintainers; [ zanculmarktum kuwii rhysmdnz ];
|
2022-02-22 00:13:49 +00:00
|
|
|
};
|
|
|
|
}
|