microsoft-edge: refactor

(cherry picked from commit 10b190b70a9969d73873b3c9fe0b86b1b9eb4f3c)
This commit is contained in:
emaryn
2025-06-10 09:47:47 +02:00
committed by Christoph Hollizeck
parent 6d2386a548
commit 7671ffeeee
2 changed files with 34 additions and 29 deletions
+22 -18
View File
@@ -1,9 +1,10 @@
{
fetchurl,
lib,
stdenv,
fetchurl,
makeWrapper,
patchelf,
stdenv,
dpkg,
# Linked dynamic libraries.
alsa-lib,
@@ -92,6 +93,9 @@
# For Vulkan support (--enable-features=Vulkan)
addDriverRunpath,
# For QT support
qt6,
# Edge AAD sync
cacert,
libsecret,
@@ -163,13 +167,13 @@ let
wget
libsecret
libuuid
]
++ lib.optional pulseSupport libpulseaudio
++ lib.optional libvaSupport libva
++ [
gtk3
gtk4
];
qt6.qtbase
qt6.qtwayland
]
++ lib.optionals pulseSupport [ libpulseaudio ]
++ lib.optionals libvaSupport [ libva ];
in
stdenv.mkDerivation (finalAttrs: {
@@ -188,6 +192,7 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [
makeWrapper
patchelf
dpkg
];
buildInputs = [
@@ -200,13 +205,6 @@ stdenv.mkDerivation (finalAttrs: {
gsettings-desktop-schemas
];
unpackPhase = ''
runHook preUnpack
ar x $src
tar xf data.tar.xz
runHook postUnpack
'';
rpath = lib.makeLibraryPath deps + ":" + lib.makeSearchPathOutput "lib" "lib64" deps;
binpath = lib.makeBinPath deps;
@@ -218,9 +216,9 @@ stdenv.mkDerivation (finalAttrs: {
exe=$out/bin/microsoft-edge
mkdir -p $out/bin $out/share
cp -v -a opt/* $out/share
cp -v -a usr/share/* $out/share
mkdir -p $out/bin
cp -v -a usr/share $out/share
cp -v -a opt/microsoft $out/share/microsoft
# replace bundled vulkan-loader
rm -v $out/share/microsoft/$appname/libvulkan.so.1
@@ -230,6 +228,8 @@ stdenv.mkDerivation (finalAttrs: {
--replace-fail 'CHROME_WRAPPER' 'WRAPPER'
substituteInPlace $out/share/applications/microsoft-edge.desktop \
--replace-fail /usr/bin/microsoft-edge-$dist $exe
substituteInPlace $out/share/applications/com.microsoft.Edge.desktop \
--replace-fail /usr/bin/microsoft-edge-$dist $exe
substituteInPlace $out/share/gnome-control-center/default-apps/microsoft-edge.xml \
--replace-fail /opt/microsoft/msedge $exe
substituteInPlace $out/share/menu/microsoft-edge.menu \
@@ -251,13 +251,16 @@ stdenv.mkDerivation (finalAttrs: {
# "--simulate-outdated-no-au" disables auto updates and browser outdated popup
makeWrapper "$out/share/microsoft/$appname/microsoft-edge" "$exe" \
--prefix QT_PLUGIN_PATH : "${qt6.qtbase}/lib/qt-6/plugins" \
--prefix QT_PLUGIN_PATH : "${qt6.qtwayland}/lib/qt-6/plugins" \
--prefix NIXPKGS_QT6_QML_IMPORT_PATH : "${qt6.qtwayland}/lib/qt-6/qml" \
--prefix LD_LIBRARY_PATH : "$rpath" \
--prefix PATH : "$binpath" \
--suffix PATH : "${lib.makeBinPath [ xdg-utils ]}" \
--prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH:${addDriverRunpath.driverLink}/share" \
--set SSL_CERT_FILE "${cacert}/etc/ssl/certs/ca-bundle.crt" \
--set CHROME_WRAPPER "microsoft-edge-$dist" \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true --wayland-text-input-version=3}}" \
--add-flags "--simulate-outdated-no-au='Tue, 31 Dec 2099 23:59:59 GMT'" \
--add-flags ${lib.escapeShellArg commandLineArgs}
@@ -286,6 +289,7 @@ stdenv.mkDerivation (finalAttrs: {
maintainers = with lib.maintainers; [
cholli
ulrikstrid
emaryn
];
platforms = [ "x86_64-linux" ];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
+12 -11
View File
@@ -1,20 +1,19 @@
#! /usr/bin/env nix-shell
#! nix-shell -i python3 -p python3Packages.packaging python3Packages.python-debian common-updater-scripts
import base64
import textwrap
import os
from collections import OrderedDict
from os.path import abspath, dirname
from urllib import request
from collections import OrderedDict
from debian.deb822 import Packages
from debian.debian_support import Version
from os.path import abspath, dirname
PIN_PATH = dirname(abspath(__file__)) + '/default.nix'
PIN_PATH = dirname(abspath(__file__)) + "/default.nix"
def packages():
packages_url = 'https://packages.microsoft.com/repos/edge/dists/stable/main/binary-amd64/Packages'
packages_url = "https://packages.microsoft.com/repos/edge/dists/stable/main/binary-amd64/Packages"
handle = request.urlopen(packages_url)
return handle
@@ -22,22 +21,24 @@ def packages():
def latest_packages(packages: bytes):
latest_packages: OrderedDict[str, Packages] = {}
for package in Packages.iter_paragraphs(packages, use_apt_pkg=False):
name: str = package['Package']
if not name.startswith('microsoft-edge-stable'):
name: str = package["Package"]
if not name.startswith("microsoft-edge-stable"):
continue
channel = name.replace('microsoft-edge-', '')
channel = name.replace("microsoft-edge-", "")
if channel not in latest_packages:
latest_packages[channel] = package
else:
old_package = latest_packages[channel]
if old_package.get_version() < package.get_version(): # type: ignore
latest_packages[channel] = package
return OrderedDict(sorted(latest_packages.items(), key=lambda x:x[0]))
return OrderedDict(sorted(latest_packages.items(), key=lambda x: x[0]))
def write_expression():
latest = latest_packages(packages())
version = Version.re_valid_version.match(latest['stable']['Version']).group('upstream_version')
version = Version.re_valid_version.match(latest["stable"]["Version"]).group(
"upstream_version"
)
os.system(f'update-source-version microsoft-edge "{version}"')