commit
78e0e8e556
|
@ -1,7 +1,7 @@
|
||||||
{ stdenv, fetchurl, python, utillinux, openssl, http-parser, zlib, nightly ? false }:
|
{ stdenv, fetchurl, python, utillinux, openssl, http-parser, zlib, nightly ? false }:
|
||||||
|
|
||||||
let
|
let
|
||||||
version = if nightly then "1.2.1-nightly20150213f0296933f8" else "1.2.0";
|
version = if nightly then "1.2.1-nightly201502201bf91878e7" else "1.3.0";
|
||||||
inherit (stdenv.lib) optional maintainers licenses platforms;
|
inherit (stdenv.lib) optional maintainers licenses platforms;
|
||||||
in stdenv.mkDerivation {
|
in stdenv.mkDerivation {
|
||||||
name = "iojs-${version}";
|
name = "iojs-${version}";
|
||||||
|
@ -11,8 +11,8 @@ in stdenv.mkDerivation {
|
||||||
then "https://iojs.org/download/nightly/v${version}/iojs-v${version}.tar.gz"
|
then "https://iojs.org/download/nightly/v${version}/iojs-v${version}.tar.gz"
|
||||||
else "https://iojs.org/dist/v${version}/iojs-v${version}.tar.gz";
|
else "https://iojs.org/dist/v${version}/iojs-v${version}.tar.gz";
|
||||||
sha256 = if nightly
|
sha256 = if nightly
|
||||||
then "0v9njaggddi128v58rd34qknph8pn9c653gqd4y29l1mwjvqg62s"
|
then "1bk0jiha7n3s9xawj77d4q1navq28pq061w2wa6cs70lik7n6ri4"
|
||||||
else "17axqswpl252gliak1wjc2l9jk6n5jqdfa9f1vv7x9acj776yrik";
|
else "08g0kmz2978jrfx4551fi12ypcsv9p6vic89lfs08ki7ajw2yrgb";
|
||||||
};
|
};
|
||||||
|
|
||||||
prePatch = ''
|
prePatch = ''
|
||||||
|
|
49
pkgs/development/web/iojs/update-iojs
Executable file
49
pkgs/development/web/iojs/update-iojs
Executable file
|
@ -0,0 +1,49 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
#
|
||||||
|
# Fetch the latest io.js release (stable/nightly) and update
|
||||||
|
# `default.nix` in this directory.
|
||||||
|
#
|
||||||
|
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
latest() {
|
||||||
|
curl -s "$1" | grep 'href="v' \
|
||||||
|
| tail -1 | sed 's/.*href="v//;s/\/".*//'
|
||||||
|
}
|
||||||
|
|
||||||
|
latest_log() {
|
||||||
|
echo "Getting latest $1 version from $2" >&2
|
||||||
|
version=$(latest "$2")
|
||||||
|
echo " -> $version" >&2
|
||||||
|
echo "$version"
|
||||||
|
}
|
||||||
|
|
||||||
|
url() {
|
||||||
|
nix-instantiate -A "$1" 2> /dev/null | xargs cat \
|
||||||
|
| sed 's/.*"urls","//;s/".*//'
|
||||||
|
}
|
||||||
|
|
||||||
|
hash() {
|
||||||
|
nix-prefetch-url "$1" 2> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
hash_log() {
|
||||||
|
echo "Finding hash for $1" >&2
|
||||||
|
value=$(hash "$1")
|
||||||
|
echo " -> $value" >&2
|
||||||
|
echo "$value"
|
||||||
|
}
|
||||||
|
|
||||||
|
stable=$(latest_log stable 'https://iojs.org/dist/')
|
||||||
|
nightly=$(latest_log nightly 'https://iojs.org/download/nightly/')
|
||||||
|
|
||||||
|
sed -i \
|
||||||
|
"/version = if nightly/s/then.*/then \"$nightly\" else \"$stable\";/" \
|
||||||
|
default.nix
|
||||||
|
|
||||||
|
stableHash=$(hash_log "$(url iojs.src)")
|
||||||
|
nightlyHash=$(hash_log "$(url iojs-nightly.src)")
|
||||||
|
|
||||||
|
sed -i \
|
||||||
|
"/sha256 = if nightly/{N;s/\"[^\"]*\"/\"$nightlyHash\"/;N;s/\"[^\"]*\";/\"$stableHash\";/}" \
|
||||||
|
default.nix
|
Loading…
Reference in a new issue