breitbandmessung: don't use bundled electron

This commit is contained in:
Fabian Möller 2022-04-20 12:07:07 +02:00
parent a97c7f7380
commit 92e2e3b3f4
No known key found for this signature in database
GPG key ID: 70B29D65DD8A7E31

View file

@ -1,32 +1,12 @@
{ lib { lib
, stdenv , stdenv
, alsa-lib
, at-spi2-atk
, at-spi2-core
, atk
, autoPatchelfHook
, cairo
, cups
, dbus
, dpkg
, expat
, fetchurl , fetchurl
, gdk-pixbuf , dpkg
, glib , electron_16
, gtk3
, libdrm
, libxkbcommon
, makeWrapper , makeWrapper
, mesa
, nixosTests , nixosTests
, nspr , nodePackages
, nss
, pango
, pciutils
, systemd
, undmg , undmg
, writeShellScriptBin
, xorg
}: }:
let let
@ -34,19 +14,6 @@ let
version = "3.1.0"; version = "3.1.0";
# At first start, the program checks for supported operating systems by calling `lsb_release -a`
# and only runs when it finds Debian/Ubuntu. So we present us as Debian an make it happy.
fake-lsb-release = writeShellScriptBin "lsb_release" ''
echo "Distributor ID: Debian"
echo "Description: Debian GNU/Linux 10 (buster)"
echo "Release: 10"
echo "Codename: buster"
'';
binPath = lib.makeBinPath [
fake-lsb-release
];
systemArgs = rec { systemArgs = rec {
x86_64-linux = rec { x86_64-linux = rec {
src = fetchurl { src = fetchurl {
@ -54,68 +21,41 @@ let
sha256 = "sha256-jSP+H9ej9Wd+swBZSy9uMi2ExSTZ191FGZhqaocTl7w="; sha256 = "sha256-jSP+H9ej9Wd+swBZSy9uMi2ExSTZ191FGZhqaocTl7w=";
}; };
dontUnpack = true;
nativeBuildInputs = [ nativeBuildInputs = [
autoPatchelfHook
dpkg dpkg
makeWrapper makeWrapper
nodePackages.asar
]; ];
buildInputs = runtimeDependencies; unpackPhase = "dpkg-deb -x $src .";
runtimeDependencies = [
alsa-lib
at-spi2-atk
at-spi2-core
atk
cairo
cups
dbus
expat
gdk-pixbuf
glib
gtk3
libdrm
libxkbcommon
mesa
nspr
nss
pango
pciutils
systemd
xorg.libX11
xorg.libXcomposite
xorg.libXdamage
xorg.libXext
xorg.libXfixes
xorg.libXrandr
xorg.libxcb
xorg.libxshmfence
];
installPhase = '' installPhase = ''
dpkg-deb -x $src $out
mkdir -p $out/bin mkdir -p $out/bin
mv usr/share $out/share
mkdir -p $out/share/breitbandmessung/resources
chmod -R g-w $out asar e opt/Breitbandmessung/resources/app.asar $out/share/breitbandmessung/resources
addAutoPatchelfSearchPath --no-recurse $out/opt/Breitbandmessung # At first start, the program checks for supported operating systems by using the `bizzby-lsb-release`
autoPatchelfFile $out/opt/Breitbandmessung/breitbandmessung # module and only runs when it finds Debian/Ubuntu. So we present us as Debian and make it happy.
cat <<EOF > $out/share/breitbandmessung/resources/node_modules/bizzby-lsb-release/lib/lsb-release.js
module.exports = function release() {
return {
distributorID: "Debian",
description: "Debian GNU/Linux 10 (buster)",
release: "10",
codename: "buster"
}
}
EOF
makeWrapper $out/opt/Breitbandmessung/breitbandmessung $out/bin/breitbandmessung \ makeWrapper ${electron_16}/bin/electron $out/bin/breitbandmessung \
--prefix PATH : ${binPath} --add-flags $out/share/breitbandmessung/resources/build/electron.js
mv $out/usr/share $out/share
rmdir $out/usr
# Fix the desktop link # Fix the desktop link
substituteInPlace $out/share/applications/breitbandmessung.desktop \ substituteInPlace $out/share/applications/breitbandmessung.desktop \
--replace /opt/Breitbandmessung $out/bin --replace /opt/Breitbandmessung $out/bin
''; '';
dontAutoPatchelf = true;
dontPatchELF = true;
}; };
x86_64-darwin = { x86_64-darwin = {