diff options
author | Tikhon Jelvis <tikhon.jelvis@target.com> | 2016-10-17 18:18:10 -0700 |
---|---|---|
committer | Tikhon Jelvis <tikhon.jelvis@target.com> | 2016-10-19 09:16:21 -0700 |
commit | f33fbe5e8258ea2caf89acf762e059ddbb76a892 (patch) | |
tree | 8437fa13bc4717910b38b2652e4d35022986fa60 /pkgs/development/tools | |
parent | db6897220684fbabc66ea3ba62497a3333ed4a53 (diff) |
Added support to for OS X to the Electron package.
For OS X:
1. I download and extract Electron.app
2. put it in `$out/Applications`
3. link the binary to `$out/bin/electron`
Diffstat (limited to 'pkgs/development/tools')
-rw-r--r-- | pkgs/development/tools/electron/default.nix | 78 |
1 files changed, 52 insertions, 26 deletions
diff --git a/pkgs/development/tools/electron/default.nix b/pkgs/development/tools/electron/default.nix index 7c8315859560..e789370d5858 100644 --- a/pkgs/development/tools/electron/default.nix +++ b/pkgs/development/tools/electron/default.nix @@ -1,38 +1,64 @@ { stdenv, lib, libXScrnSaver, makeWrapper, fetchurl, unzip, atomEnv }: -stdenv.mkDerivation rec { - name = "electron-${version}"; +let version = "1.2.2"; + name = "electron-${version}"; - src = fetchurl { - url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-linux-x64.zip"; - sha256 = "0jqzs1297f6w7s4j9pd7wyyqbidb0c61yjz47raafslg6nljgp1c"; - name = "${name}.zip"; + meta = with stdenv.lib; { + description = "Cross platform desktop application shell"; + homepage = https://github.com/electron/electron; + license = licenses.mit; + maintainers = [ maintainers.travisbhartwell ]; + platforms = [ "x86_64-darwin" "x86_64-linux" ]; }; - buildInputs = [ unzip makeWrapper ]; + linux = { + inherit name version meta; - buildCommand = '' - mkdir -p $out/lib/electron $out/bin - unzip -d $out/lib/electron $src - ln -s $out/lib/electron/electron $out/bin + src = fetchurl { + url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-linux-x64.zip"; + sha256 = "0jqzs1297f6w7s4j9pd7wyyqbidb0c61yjz47raafslg6nljgp1c"; + name = "${name}.zip"; + }; - fixupPhase + buildInputs = [ unzip makeWrapper ]; - patchelf \ - --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ - --set-rpath "${atomEnv.libPath}:$out/lib/electron" \ - $out/lib/electron/electron + buildCommand = '' + mkdir -p $out/lib/electron $out/bin + unzip -d $out/lib/electron $src + ln -s $out/lib/electron/electron $out/bin - wrapProgram $out/lib/electron/electron \ - --prefix LD_PRELOAD : ${stdenv.lib.makeLibraryPath [ libXScrnSaver ]}/libXss.so.1 - ''; + fixupPhase - meta = with stdenv.lib; { - description = "Cross platform desktop application shell"; - homepage = https://github.com/electron/electron; - license = licenses.mit; - maintainers = [ maintainers.travisbhartwell ]; - platforms = [ "x86_64-linux" ]; + patchelf \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ + --set-rpath "${atomEnv.libPath}:$out/lib/electron" \ + $out/lib/electron/electron + + wrapProgram $out/lib/electron/electron \ + --prefix LD_PRELOAD : ${stdenv.lib.makeLibraryPath [ libXScrnSaver ]}/libXss.so.1 + ''; }; -} + + darwin = { + inherit name version meta; + + src = fetchurl { + url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-darwin-x64.zip"; + sha256 = "0rqlpj3400qjsfj8k4lwajrwv5l6f8mhrpvsma7p36fw5qjbwp1z"; + name = "${name}.zip"; + }; + + 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) |