From c89016b00630495698cd23177c6fe26ed989cbe4 Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 5 Apr 2018 16:36:12 +0200 Subject: go: fix build on 18.03 --- krebs/5pkgs/simple/go-shortener/default.nix | 35 +++++------ krebs/5pkgs/simple/go-shortener/node-packages.nix | 76 +++++++++++++++++++++++ krebs/5pkgs/simple/go-shortener/packages.nix | 44 ------------- krebs/5pkgs/simple/go-shortener/pkgs.json | 4 ++ krebs/5pkgs/simple/go-shortener/update.sh | 2 + 5 files changed, 99 insertions(+), 62 deletions(-) create mode 100644 krebs/5pkgs/simple/go-shortener/node-packages.nix delete mode 100644 krebs/5pkgs/simple/go-shortener/packages.nix create mode 100644 krebs/5pkgs/simple/go-shortener/pkgs.json create mode 100755 krebs/5pkgs/simple/go-shortener/update.sh (limited to 'krebs') diff --git a/krebs/5pkgs/simple/go-shortener/default.nix b/krebs/5pkgs/simple/go-shortener/default.nix index 996f7072a..4d1bef2be 100644 --- a/krebs/5pkgs/simple/go-shortener/default.nix +++ b/krebs/5pkgs/simple/go-shortener/default.nix @@ -1,25 +1,26 @@ -{ stdenv, makeWrapper, callPackage, lib, buildEnv, fetchgit, nodePackages, nodejs }: +{ stdenv, makeWrapper, lib, buildEnv, fetchgit, nodejs-8_x, pkgs }: with lib; let - np = (callPackage ) { - generated = ./packages.nix; - self = np; + nodeEnv = import { + inherit (pkgs) stdenv python2 utillinux runCommand writeTextFile; + nodejs = nodejs-8_x; + libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; }; - node_env = buildEnv { - name = "node_env"; - paths = [ - np.redis - np."formidable" - ]; - pathsToLink = [ "/lib" ]; - ignoreCollisions = true; + node_env = pkgs.buildEnv { + name = "go-node_env"; + paths = attrValues (import ./node-packages.nix { + inherit (pkgs) fetchurl fetchgit; + inherit nodeEnv; + }); }; -in np.buildNodePackage { +in stdenv.mkDerivation { + packageName = "go"; name = "go-shortener"; + version = "0.0.0"; src = fetchgit { url = "http://cgit.lassul.us/go/"; @@ -32,10 +33,8 @@ in np.buildNodePackage { "installPhase" ]; - deps = (filter (v: nixType v == "derivation") (attrValues np)); - buildInputs = [ - nodejs + nodejs-8_x makeWrapper ]; @@ -44,14 +43,14 @@ in np.buildNodePackage { cp index.js $out/ cat > $out/go << EOF - ${nodejs}/bin/node $out/index.js + ${nodejs-8_x}/bin/node $out/index.js EOF chmod +x $out/go wrapProgram $out/go \ --prefix NODE_PATH : ${node_env}/lib/node_modules - ln -s $out/go /$out/bin/go + ln -s $out/go /$out/bin/go ''; } diff --git a/krebs/5pkgs/simple/go-shortener/node-packages.nix b/krebs/5pkgs/simple/go-shortener/node-packages.nix new file mode 100644 index 000000000..526cd5a11 --- /dev/null +++ b/krebs/5pkgs/simple/go-shortener/node-packages.nix @@ -0,0 +1,76 @@ +# This file has been generated by node2nix 1.5.3. Do not edit! + +{nodeEnv, fetchurl, fetchgit, globalBuildInputs ? []}: + +let + sources = { + "double-ended-queue-2.1.0-0" = { + name = "double-ended-queue"; + packageName = "double-ended-queue"; + version = "2.1.0-0"; + src = fetchurl { + url = "https://registry.npmjs.org/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz"; + sha1 = "103d3527fd31528f40188130c841efdd78264e5c"; + }; + }; + "redis-commands-1.3.5" = { + name = "redis-commands"; + packageName = "redis-commands"; + version = "1.3.5"; + src = fetchurl { + url = "https://registry.npmjs.org/redis-commands/-/redis-commands-1.3.5.tgz"; + sha512 = "2q8pai3gf0dczb03jjig3mpaz4j2kvw8icpgf8hp4fryr3d6c0mjkvxxdmlyhainybx4zhgqsw9ghc9p986alzdzd2n2p4cxvr8b0by"; + }; + }; + "redis-parser-2.6.0" = { + name = "redis-parser"; + packageName = "redis-parser"; + version = "2.6.0"; + src = fetchurl { + url = "https://registry.npmjs.org/redis-parser/-/redis-parser-2.6.0.tgz"; + sha1 = "52ed09dacac108f1a631c07e9b69941e7a19504b"; + }; + }; + }; +in +{ + formidable = nodeEnv.buildNodePackage { + name = "formidable"; + packageName = "formidable"; + version = "1.2.1"; + src = fetchurl { + url = "https://registry.npmjs.org/formidable/-/formidable-1.2.1.tgz"; + sha512 = "1x0n2rfaiasdjbw1mm7s29z84f68c7iji7lb1gkxvpknvv6q7bwns7z55ijcf4vkh4kvis12rbgaaih49jf9lj53s30mllb1d35bkqn"; + }; + buildInputs = globalBuildInputs; + meta = { + description = "A node.js module for parsing form data, especially file uploads."; + homepage = https://github.com/felixge/node-formidable; + license = "MIT"; + }; + production = true; + bypassCache = true; + }; + redis = nodeEnv.buildNodePackage { + name = "redis"; + packageName = "redis"; + version = "2.8.0"; + src = fetchurl { + url = "https://registry.npmjs.org/redis/-/redis-2.8.0.tgz"; + sha512 = "3a3044ax6qdvss83xgjfx10h5q91ls0mwgs3wpsnxcdsiipq3cnmqzsh6glyq0r7vsmpw49jp84c2jnfrhi2bgycrkd9hhhf6ia8lrk"; + }; + dependencies = [ + sources."double-ended-queue-2.1.0-0" + sources."redis-commands-1.3.5" + sources."redis-parser-2.6.0" + ]; + buildInputs = globalBuildInputs; + meta = { + description = "Redis client library"; + homepage = https://github.com/NodeRedis/node_redis; + license = "MIT"; + }; + production = true; + bypassCache = true; + }; +} \ No newline at end of file diff --git a/krebs/5pkgs/simple/go-shortener/packages.nix b/krebs/5pkgs/simple/go-shortener/packages.nix deleted file mode 100644 index 9acfd7658..000000000 --- a/krebs/5pkgs/simple/go-shortener/packages.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ self, fetchurl, fetchgit ? null, lib }: - -{ - by-spec."formidable"."*" = - self.by-version."formidable"."1.0.17"; - by-version."formidable"."1.0.17" = self.buildNodePackage { - name = "formidable-1.0.17"; - version = "1.0.17"; - bin = false; - src = fetchurl { - url = "http://registry.npmjs.org/formidable/-/formidable-1.0.17.tgz"; - name = "formidable-1.0.17.tgz"; - sha1 = "ef5491490f9433b705faa77249c99029ae348559"; - }; - deps = { - }; - optionalDependencies = { - }; - peerDependencies = []; - os = [ ]; - cpu = [ ]; - }; - "formidable" = self.by-version."formidable"."1.0.17"; - by-spec."redis"."*" = - self.by-version."redis"."2.1.0"; - by-version."redis"."2.1.0" = self.buildNodePackage { - name = "redis-2.1.0"; - version = "2.1.0"; - bin = false; - src = fetchurl { - url = "http://registry.npmjs.org/redis/-/redis-2.1.0.tgz"; - name = "redis-2.1.0.tgz"; - sha1 = "38acb208f90750250f9451219b73ff08ae907f94"; - }; - deps = { - }; - optionalDependencies = { - }; - peerDependencies = []; - os = [ ]; - cpu = [ ]; - }; - "redis" = self.by-version."redis"."2.1.0"; -} diff --git a/krebs/5pkgs/simple/go-shortener/pkgs.json b/krebs/5pkgs/simple/go-shortener/pkgs.json new file mode 100644 index 000000000..f53ce3745 --- /dev/null +++ b/krebs/5pkgs/simple/go-shortener/pkgs.json @@ -0,0 +1,4 @@ +[ + "formidable", + "redis" +] diff --git a/krebs/5pkgs/simple/go-shortener/update.sh b/krebs/5pkgs/simple/go-shortener/update.sh new file mode 100755 index 000000000..0c1ecc58c --- /dev/null +++ b/krebs/5pkgs/simple/go-shortener/update.sh @@ -0,0 +1,2 @@ +node2nix -8 -i pkgs.json -c combine.nix +rm node-env.nix combine.nix -- cgit v1.2.3