mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 06:31:02 +00:00
87 lines
3 KiB
Nix
87 lines
3 KiB
Nix
{ stdenv, libXScrnSaver, makeWrapper, fetchurl, wrapGAppsHook, gtk3, unzip, atomEnv, libuuid, at-spi2-atk, at-spi2-core }:
|
|
|
|
let
|
|
version = "5.0.8";
|
|
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 = "1blw38x4fp4w2vs6r1d0jz3pg0m78417i0q9bvwpnwbn6wil857y";
|
|
};
|
|
x86_64-linux = fetchurl {
|
|
url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-linux-x64.zip";
|
|
sha256 = "1gz5n8gkgka7343qcwckagd4ply1lxwiaccdjv16srk2wwc9bc9m";
|
|
};
|
|
armv7l-linux = fetchurl {
|
|
url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-linux-armv7l.zip";
|
|
sha256 = "1y8yna6z7xc378k6hsgngv9v98yjwq36knnr4qan0pw26paw1m82";
|
|
};
|
|
aarch64-linux = fetchurl {
|
|
url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-linux-arm64.zip";
|
|
sha256 = "1ha4ajvi0z051b6npigw6w4xi3bj3hhpxfr3xw4fgx6g6bvf1vpx";
|
|
};
|
|
}.${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 = "1h7i2ik6wms5v6ji0mp33kzfh9sd89m7w3m2nm6wrjny7m0b43ww";
|
|
};
|
|
|
|
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)
|