mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-04 21:03:15 +00:00
87 lines
3.0 KiB
Nix
87 lines
3.0 KiB
Nix
{ stdenv, libXScrnSaver, makeWrapper, fetchurl, wrapGAppsHook, gtk3, unzip, atomEnv, libuuid, at-spi2-atk, at-spi2-core }:
|
|
|
|
let
|
|
version = "5.0.0";
|
|
name = "electron-${version}";
|
|
|
|
throwSystem = throw "Unsupported system: ${stdenv.hostPlatform.system}";
|
|
|
|
meta = with stdenv.lib; {
|
|
description = "Cross platform desktop application shell";
|
|
homepage = https://github.com/electron/electron;
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ travisbhartwell manveru ];
|
|
platforms = [ "x86_64-darwin" "x86_64-linux" "i686-linux" "armv7l-linux" "aarch64-linux" ];
|
|
};
|
|
|
|
linux = {
|
|
inherit name version meta;
|
|
src = {
|
|
i686-linux = fetchurl {
|
|
url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-linux-ia32.zip";
|
|
sha256 = "01320qv0x18rmjn6ibbs49pd04d58rz5dac509lxxay8nfb14gdp";
|
|
};
|
|
x86_64-linux = fetchurl {
|
|
url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-linux-x64.zip";
|
|
sha256 = "0mkc8r5xggkzdypyq4hxigmjl6d1jn0139l8nwj1vr224ggnskhn";
|
|
};
|
|
armv7l-linux = fetchurl {
|
|
url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-linux-armv7l.zip";
|
|
sha256 = "1w767yxm3b6sj52z0wnzr4vfn0m8n2jdjhj3ksmq6qrv401vvib3";
|
|
};
|
|
aarch64-linux = fetchurl {
|
|
url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-linux-arm64.zip";
|
|
sha256 = "1nvpfkrizkmr6xxb2ls19p9mhgpms65ws09bx3l8sqq6275916jk";
|
|
};
|
|
}.${stdenv.hostPlatform.system} or throwSystem;
|
|
|
|
buildInputs = [ gtk3 ];
|
|
|
|
nativeBuildInputs = [
|
|
unzip
|
|
makeWrapper
|
|
wrapGAppsHook
|
|
];
|
|
|
|
dontWrapGApps = true; # electron is in lib, we need to wrap it manually
|
|
|
|
buildCommand = ''
|
|
mkdir -p $out/lib/electron $out/bin
|
|
unzip -d $out/lib/electron $src
|
|
ln -s $out/lib/electron/electron $out/bin
|
|
|
|
fixupPhase
|
|
|
|
patchelf \
|
|
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
|
--set-rpath "${atomEnv.libPath}:${stdenv.lib.makeLibraryPath [ libuuid at-spi2-atk at-spi2-core ]}:$out/lib/electron" \
|
|
$out/lib/electron/electron
|
|
|
|
wrapProgram $out/lib/electron/electron \
|
|
--prefix LD_PRELOAD : ${stdenv.lib.makeLibraryPath [ libXScrnSaver ]}/libXss.so.1 \
|
|
"''${gappsWrapperArgs[@]}"
|
|
'';
|
|
};
|
|
|
|
darwin = {
|
|
inherit name version meta;
|
|
|
|
src = fetchurl {
|
|
url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-darwin-x64.zip";
|
|
sha256 = "07s2cq4ffpx86pjxrh1hcvk3r85saxqi3kkbbfkg9r1bbq8zbapm";
|
|
};
|
|
|
|
buildInputs = [ unzip ];
|
|
|
|
buildCommand = ''
|
|
mkdir -p $out/Applications
|
|
unzip $src
|
|
mv Electron.app $out/Applications
|
|
mkdir -p $out/bin
|
|
ln -s $out/Applications/Electron.app/Contents/MacOs/Electron $out/bin/electron
|
|
'';
|
|
};
|
|
in
|
|
|
|
stdenv.mkDerivation (if stdenv.isDarwin then darwin else linux)
|