Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c4c1d979e997
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cae5a3ba99cb
Choose a head ref
  • 4 commits
  • 4 files changed
  • 2 contributors

Commits on Feb 18, 2018

  1. Copy the full SHA
    a88a712 View commit details
  2. Verified

    This commit was signed with the committer’s verified signature.
    yurrriq Eric Bailey
    Copy the full SHA
    e1bd5b3 View commit details
  3. nodejs: Add updater script

    adisbladis committed Feb 18, 2018
    Copy the full SHA
    43cf893 View commit details

Commits on Mar 6, 2018

  1. Merge pull request #35116 from adisbladis/nodejs-update-script

    nodejs: Add update script
    adisbladis authored Mar 6, 2018
    Copy the full SHA
    cae5a3b View commit details
776 changes: 776 additions & 0 deletions pkgs/development/web/nodejs/nodejs-release-keys.asc

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion pkgs/development/web/nodejs/nodejs.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{ stdenv, fetchurl, openssl, python2, zlib, libuv, utillinux, http-parser
, pkgconfig, which
# Updater dependencies
, writeScript, coreutils, gnugrep, jq, curl, common-updater-scripts, nix
, gnupg
, darwin ? null
}:

with stdenv.lib;

{ enableNpm ? true, version, sha256, patches }:
{ enableNpm ? true, version, sha256, patches } @args:

let

@@ -59,6 +62,8 @@ in

setupHook = ./setup-hook.sh;

pos = builtins.unsafeGetAttrPos "version" args;

inherit patches;

preBuild = optionalString stdenv.isDarwin ''
@@ -84,6 +89,12 @@ in
cp -r ${concatStringsSep " " copyLibHeaders} $out/include/node
'';

passthru.updateScript = import ./update.nix {
inherit writeScript coreutils gnugrep jq curl common-updater-scripts gnupg nix;
inherit (stdenv) lib;
majorVersion = with stdenv.lib; elemAt (splitString "." version) 0;
};

meta = {
description = "Event-driven I/O framework for the V8 JavaScript engine";
homepage = https://nodejs.org;
18 changes: 18 additions & 0 deletions pkgs/development/web/nodejs/update-keyring
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env nix-shell
#! nix-shell --pure -i bash -p coreutils findutils gnupg curl

# https://github.com/nodejs/node#release-team
HOME=`mktemp -d`
keyserver="pool.sks-keyservers.net"
cat << EOF | xargs -P 4 -n 1 gpg --keyserver $keyserver --recv-keys
94AE36675C464D64BAFA68DD7434390BDBE9B9C5
FD3A5288F042B6850C66B31F09FE44734EB7990E
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1
DD8F2338BAE7501E3DD5AC78C273792F7D83545D
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8
B9AE9905FFD7803F25714661B63B535A4C206CA9
56730D5401028683275BD23C23EFEFE93C4CFFFE
77984A986EBC2AA786BC0F66B01FBB92821C587A
EOF

gpg -a --export > nodejs-release-keys.asc
27 changes: 27 additions & 0 deletions pkgs/development/web/nodejs/update.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{ lib
, writeScript
, coreutils
, curl
, gnugrep
, jq
, gnupg
, common-updater-scripts
, majorVersion
, nix
}:

writeScript "update-nodejs" ''
PATH=${lib.makeBinPath [ common-updater-scripts coreutils curl gnugrep jq gnupg nix ]}
HOME=`mktemp -d`
cat ${./nodejs-release-keys.asc} | gpg --import
tags=`curl --silent https://api.github.com/repos/nodejs/node/git/refs/tags`
version=`echo $tags | jq -r '.[] | select(.ref | startswith("refs/tags/v${majorVersion}")) | .ref' | sort --version-sort | tail -1 | grep -oP "^refs/tags/v\K.*"`
curl --silent -o $HOME/SHASUMS256.txt.asc https://nodejs.org/dist/v''${version}/SHASUMS256.txt.asc
hash_hex=`gpgv --keyring=$HOME/.gnupg/pubring.kbx --output - $HOME/SHASUMS256.txt.asc | grep -oP "^([0-9a-f]{64})(?=\s+node-v''${version}.tar.xz$)"`
hash=`nix-hash --type sha256 --to-base32 ''${hash_hex}`
update-source-version nodejs-${majorVersion}_x "''${version}" "''${hash}"
''