From 8e8285d9ca9ceb511d538bc2dd754e1017b1442e Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Mon, 3 Feb 2020 17:45:01 -0600 Subject: [PATCH 1/2] electron*: refactor 4+ to common expression, add 7, updates * print-hashes.nix uses upstream-provided SHA256SUMS file * electron_4: 4.2.8 -> 4.2.12 * electron_5: 5.0.8 -> 5.0.13 * electron_6: 6.0.1 -> 6.1.7 * electron_7:: init at 7.1.10 FWIW: electron_4 previously did not include at-spi2-core, only at-spi2-atk. Both are now included, matching other versions for a slightly simpler expression. --- pkgs/development/tools/electron/5.x.nix | 86 ------------- pkgs/development/tools/electron/default.nix | 116 +++++------------- .../tools/electron/{6.x.nix => generic.nix} | 58 ++++----- .../tools/electron/print-hashes.sh | 14 ++- pkgs/top-level/all-packages.nix | 7 +- 5 files changed, 71 insertions(+), 210 deletions(-) delete mode 100644 pkgs/development/tools/electron/5.x.nix rename pkgs/development/tools/electron/{6.x.nix => generic.nix} (53%) diff --git a/pkgs/development/tools/electron/5.x.nix b/pkgs/development/tools/electron/5.x.nix deleted file mode 100644 index 0b993ccf2a77..000000000000 --- a/pkgs/development/tools/electron/5.x.nix +++ /dev/null @@ -1,86 +0,0 @@ -{ 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) diff --git a/pkgs/development/tools/electron/default.nix b/pkgs/development/tools/electron/default.nix index 2efd97ebb1ce..0e2ebd27f15c 100644 --- a/pkgs/development/tools/electron/default.nix +++ b/pkgs/development/tools/electron/default.nix @@ -1,86 +1,38 @@ -{ stdenv, libXScrnSaver, makeWrapper, fetchurl, wrapGAppsHook, gtk3, unzip, atomEnv, libuuid, at-spi2-atk }: +{ stdenv, libXScrnSaver, makeWrapper, fetchurl, wrapGAppsHook, gtk3, unzip, atomEnv, libuuid, at-spi2-atk, at-spi2-core }@args: let - version = "4.2.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 = "1sikxr0pfpi3wrf1d7fia1vhb1gacsy9pr7qc0fycgnzsy2nvf8n"; - }; - x86_64-linux = fetchurl { - url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-linux-x64.zip"; - sha256 = "0wc954cjc13flvdh8rkmnifdx6nirf273v1n76lsklbsq6c73i4h"; - }; - armv7l-linux = fetchurl { - url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-linux-armv7l.zip"; - sha256 = "0370ygpsm42drm70gj12i6mg960wchhqis7zz8i9is2ax1b2xjp5"; - }; - aarch64-linux = fetchurl { - url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-linux-arm64.zip"; - sha256 = "0vl90lsjcsgcxivbaq526ffbx3lsh6axfmpkfxl8cj2jlbsg593k"; - }; - }.${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 ]}:$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 = "083v8k17b596fa63a7qrwyn2k8pd5vmg9yijbqbnpfcg4ja3bjx9"; - }; - - 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 - ''; - }; + mkElectron = import ./generic.nix args; in +{ + electron_4 = mkElectron "4.2.12" { + x86_64-linux = "72c5319c92baa7101bea3254a036c0cd3bcf257f4a03a0bb153668b7292ee2dd"; + x86_64-darwin = "89b0e16bb9b7072ed7ed1906fccd08540acdd9f42dd8a29c97fa17d811b8c5e5"; + i686-linux = "bf96b1736141737bb064e48bdb543302fd259de634b1790b7cf930525f47859f"; + armv7l-linux = "2d970b3020627e5381fd4916dd8fa50ca9556202c118ab4cba09c293960689e9"; + aarch64-linux = "938b7cc5f917247a120920df30374f86414b0c06f9f3dc7ab02be1cadc944e55"; + }; - stdenv.mkDerivation (if stdenv.isDarwin then darwin else linux) + electron_5 = mkElectron "5.0.13" { + x86_64-linux = "8ded43241c4b7a6f04f2ff21c75ae10e4e6db1794e8b1b4f7656c0ed21667f8f"; + x86_64-darwin = "589834815fb9667b3c1c1aa6ccbd87d50e5660ecb430f6b475168b772b9857cd"; + i686-linux = "ccf4a5ed226928a30bd3ea830913d99853abb089bd4a6299ffa9fa0daa8d026a"; + armv7l-linux = "96ad83802bc61d87bb952027d49e5dd297f58e4493e66e393b26e51e09065add"; + aarch64-linux = "01f0fd313b060fb28a1022d68fb224d415fa22986e2a8f4aded6424b65e35add"; + }; + + electron_6 = mkElectron "6.1.7" { + x86_64-linux = "7fe94fc1edebe2f5645056a4300fc642c04155e55da8dd4ee058a0c0ef835ae8"; + x86_64-darwin = "1c790a4cbda05f1c136d18fa6a09bdb09a1941f521207466756a3e95e343c485"; + i686-linux = "1afd8ea79acb2b4782fb459e084549ed4cd4ead779764829b1d862148359eae5"; + armv7l-linux = "14f2ea0459f0dda8c566b0fa4a2fe755f4220bbae313ea0c453861ac2f803196"; + aarch64-linux = "80e05c1a0b51c335483666e959c1631a089246986b7fc3a4f9ee1288a57a602a"; + }; + + electron_7 = mkElectron "7.1.10" { + x86_64-linux = "296f034ac9a00afa4dc99ed145410c015af3f59cd7e9becc7709d70a4f8a9ebf"; + x86_64-darwin = "10eb453c2b19948777a6f404fbdbdd48464a4cd63db16bd3ce66b60dda016724"; + i686-linux = "681b6440d4f0f7ffa29a34610ef41103d72937d6e524d81fd2d0fa8d9eb67936"; + armv7l-linux = "2c09e9a77f1da152d766dc2e43719e2852b70f917229466a2ac457416d1374f7"; + aarch64-linux = "1dad780b872bbc069eb1cac9ff4ec8f0b8d200153ab7f51397e27219094db1f0"; + }; +} diff --git a/pkgs/development/tools/electron/6.x.nix b/pkgs/development/tools/electron/generic.nix similarity index 53% rename from pkgs/development/tools/electron/6.x.nix rename to pkgs/development/tools/electron/generic.nix index 5d412848d2d6..b2ce076933dd 100644 --- a/pkgs/development/tools/electron/6.x.nix +++ b/pkgs/development/tools/electron/generic.nix @@ -1,11 +1,9 @@ { stdenv, libXScrnSaver, makeWrapper, fetchurl, wrapGAppsHook, gtk3, unzip, atomEnv, libuuid, at-spi2-atk, at-spi2-core}: +version: hashes: let - version = "6.0.1"; 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; @@ -14,27 +12,28 @@ let 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 = "0ly6mjcljw0axkkrz7dsvfywmjb3pmspalfk2259gyqqxj8a37pb"; - }; - x86_64-linux = fetchurl { - url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-linux-x64.zip"; - sha256 = "0l8k6v16ynikf6x59w5byzhji0d6mqp2q0kjlrby56546qzyfkh6"; - }; - armv7l-linux = fetchurl { - url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-linux-armv7l.zip"; - sha256 = "0c2xl8dm9fmj0d92w53zbn2np2fiwr88hw0dqjdn1rwczhw7zqss"; - }; - aarch64-linux = fetchurl { - url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-linux-arm64.zip"; - sha256 = "0iyq229snm7z411xxfsv7f0bqg6hbw2l8y6ymys110f83hp01f8a"; - }; - }.${stdenv.hostPlatform.system} or throwSystem; + fetcher = vers: tag: hash: fetchurl { + url = "https://github.com/electron/electron/releases/download/v${vers}/electron-v${vers}-${tag}.zip"; + sha256 = hash; + }; + tags = { + i686-linux = "linux-ia32"; + x86_64-linux = "linux-x64"; + armv7l-linux = "linux-armv7l"; + aarch64-linux = "linux-arm64"; + x86_64-darwin = "darwin-x64"; + }; + + get = as: platform: as.${platform.system} or + "Unsupported system: ${platform.system}"; + + common = platform: { + inherit name version meta; + src = fetcher version (get tags platform) (get hashes platform); + }; + + linux = { buildInputs = [ gtk3 ]; nativeBuildInputs = [ @@ -64,13 +63,6 @@ let }; darwin = { - inherit name version meta; - - src = fetchurl { - url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-darwin-x64.zip"; - sha256 = "0m8v5fs69kanrd1yk6smbmaaj9gb5j3q487z3wicifry0xn381i2"; - }; - buildInputs = [ unzip ]; buildCommand = '' @@ -82,5 +74,7 @@ let ''; }; in - - stdenv.mkDerivation (if stdenv.isDarwin then darwin else linux) + stdenv.mkDerivation ( + (common stdenv.hostPlatform) // + (if stdenv.isDarwin then darwin else linux) + ) diff --git a/pkgs/development/tools/electron/print-hashes.sh b/pkgs/development/tools/electron/print-hashes.sh index 203e5a4dfec6..45656a8f7b2b 100755 --- a/pkgs/development/tools/electron/print-hashes.sh +++ b/pkgs/development/tools/electron/print-hashes.sh @@ -19,11 +19,15 @@ SYSTEMS=( [x86_64-darwin]=darwin-x64 ) +hashfile="$(nix-prefetch-url --print-path "https://github.com/electron/electron/releases/download/v${VERSION}/SHASUMS256.txt" 2>/dev/null | tail -n1)" + +echo "Entry similar to the following goes in default.nix:" +echo +echo " electron_${VERSION%%.*} = mkElectron \"${VERSION}\" {" + for S in "${!SYSTEMS[@]}"; do - HASHES["$S"]=$(nix-prefetch-url "https://github.com/electron/electron/releases/download/v${VERSION}/electron-v${VERSION}-${SYSTEMS[$S]}.zip") + hash="$(grep " *electron-v${VERSION}-${SYSTEMS[$S]}.zip$" "$hashfile"|cut -f1 -d' ')" + echo " $S = \"$hash\";" done -for S in "${!HASHES[@]}"; do - echo "$S" - echo "sha256 = \"${HASHES[$S]}\";" -done +echo " };" diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a8bf22e01c74..03ded8350769 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9669,11 +9669,8 @@ in aws-adfs = with python3Packages; toPythonApplication aws-adfs; - electron_6 = callPackage ../development/tools/electron/6.x.nix { }; - - electron_5 = callPackage ../development/tools/electron/5.x.nix { }; - - electron_4 = callPackage ../development/tools/electron { }; + inherit (callPackages ../development/tools/electron { }) + electron_4 electron_5 electron_6 electron_7; electron_3 = callPackage ../development/tools/electron/3.x.nix { }; electron = electron_4; From ed8c6393d01778a661db08a8e797ac11fb8cb1ed Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Mon, 3 Feb 2020 22:37:52 -0600 Subject: [PATCH 2/2] electron_8: init at 8.0.0 --- pkgs/development/tools/electron/default.nix | 8 ++++++++ pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs/development/tools/electron/default.nix b/pkgs/development/tools/electron/default.nix index 0e2ebd27f15c..d23c5a663e62 100644 --- a/pkgs/development/tools/electron/default.nix +++ b/pkgs/development/tools/electron/default.nix @@ -35,4 +35,12 @@ in armv7l-linux = "2c09e9a77f1da152d766dc2e43719e2852b70f917229466a2ac457416d1374f7"; aarch64-linux = "1dad780b872bbc069eb1cac9ff4ec8f0b8d200153ab7f51397e27219094db1f0"; }; + + electron_8 = mkElectron "8.0.0" { + x86_64-linux = "b457a2ece83bb8a2efea42e75403740cbba051a64e325288760046b8999dd1c9"; + x86_64-darwin = "3f96dfa1d4e0313d11b9e5c66e2df161cfdb30685ee9dadcc779bcad2fb3876e"; + i686-linux = "0633ac2b6b6d00302e0e5df224d0e808e4ea9ecc14643e8534027e49b20436fb"; + armv7l-linux = "8d1f3daa86c77e7aceb8c8e4491c094e789951c7d475fc536b85fe7d279794bf"; + aarch64-linux = "484c04204478e8594d66f8bd332529c0c5eecfd71ee1705cc0478fa59c6818ee"; + }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 03ded8350769..cadc14be9f55 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9670,7 +9670,7 @@ in aws-adfs = with python3Packages; toPythonApplication aws-adfs; inherit (callPackages ../development/tools/electron { }) - electron_4 electron_5 electron_6 electron_7; + electron_4 electron_5 electron_6 electron_7 electron_8; electron_3 = callPackage ../development/tools/electron/3.x.nix { }; electron = electron_4;