From c5342ed3feda6f6f427fdea65a24f1ac86b3c2cc Mon Sep 17 00:00:00 2001 From: Serge Bazanski Date: Fri, 1 Jan 2021 22:13:39 +0100 Subject: Switch to callPackage --- back/default.nix | 18 +++++++++++++----- default.nix | 11 +++++++++++ front/default.nix | 9 ++++++--- maps/default.nix | 6 +++++- messages/default.nix | 18 +++++++++++++----- pusher/default.nix | 21 ++++++++++++++++----- uploader/default.nix | 9 ++++++++- 7 files changed, 72 insertions(+), 20 deletions(-) create mode 100644 default.nix diff --git a/back/default.nix b/back/default.nix index e634467..5a5a973 100644 --- a/back/default.nix +++ b/back/default.nix @@ -1,18 +1,26 @@ -with (import { }); let - workadventure-messages = import ../messages; +{ stdenv +, autoPatchelfHook +, fetchFromGitHub +, fetchzip +, makeWrapper +, nodejs-14_x +, workadventure-messages +, yarn2nix-moretea +, ... }: +let node-abi = "83"; - node-grpc-precompiled = pkgs.fetchzip { + node-grpc-precompiled = fetchzip { name = "node-grpc-precompiled-node-${node-abi}"; url = "https://node-precompiled-binaries.grpc.io/grpc/v1.24.4/node-v${node-abi}-linux-x64-glibc.tar.gz"; sha256 = "119rhhk1jpi2vwyim7byq3agacasc4q25c26wyzfmy8vk2ih6ndj"; }; - node-grpc-patched = pkgs.stdenv.mkDerivation { + node-grpc-patched = stdenv.mkDerivation { name = "node-grpc"; buildInputs = [ stdenv.cc.cc ]; - nativeBuildInputs = [ pkgs.autoPatchelfHook ]; + nativeBuildInputs = [ autoPatchelfHook ]; dontUnpack = true; # spams console dontStrip = true; diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..c77e02c --- /dev/null +++ b/default.nix @@ -0,0 +1,11 @@ +with import {}; +lib.fix (self: let + callPackage = lib.callPackageWith self; +in pkgs // { + workadventure-back = callPackage ./back {}; + workadventure-pusher = callPackage ./pusher {}; + workadventure-messages = callPackage ./messages {}; + workadventure-front = callPackage ./front {}; + workadventure-uploader = callPackage ./uploader {}; + workadventure-maps = callPackage ./maps {}; +}) diff --git a/front/default.nix b/front/default.nix index 786384f..057855e 100644 --- a/front/default.nix +++ b/front/default.nix @@ -1,6 +1,9 @@ -with (import { }); let - workadventure-messages = import ../messages; -in +{ stdenv +, fetchFromGitHub +, makeWrapper +, workadventure-messages +, yarn2nix-moretea +, ... }: yarn2nix-moretea.mkYarnPackage rec { pname = "workadventurefront"; version = "unstable"; diff --git a/maps/default.nix b/maps/default.nix index cf56782..245a8c3 100644 --- a/maps/default.nix +++ b/maps/default.nix @@ -1,4 +1,8 @@ -with (import { }); +{ stdenv +, fetchFromGitHub +, makeWrapper +, yarn2nix-moretea +, ... }: yarn2nix-moretea.mkYarnPackage rec { pname = "workadventuremaps"; diff --git a/messages/default.nix b/messages/default.nix index 4b1e734..f397b1d 100644 --- a/messages/default.nix +++ b/messages/default.nix @@ -1,14 +1,22 @@ -with (import { }); let - node-protoc-precompiled = pkgs.fetchzip { +{ stdenv +, autoPatchelfHook +, fetchFromGitHub +, fetchzip +, gcc-unwrapped +, yarn2nix-moretea +, ... }: + +let + node-protoc-precompiled = fetchzip { name = "node-protoc-precompiled"; url = "https://node-precompiled-binaries.grpc.io/grpc-tools/v1.10.0/linux-x64.tar.gz"; sha256 = "0dl1anpw3610q58mxf7r9dcp768krwvpa4053cjxn5r8b5xfbh4l"; }; - node-protoc-patched = pkgs.stdenv.mkDerivation { + node-protoc-patched = stdenv.mkDerivation { name = "node-protoc"; - buildInputs = [ pkgs.gcc-unwrapped.lib ]; - nativeBuildInputs = [ pkgs.autoPatchelfHook ]; + buildInputs = [ gcc-unwrapped.lib ]; + nativeBuildInputs = [ autoPatchelfHook ]; dontAutoPatchelf = true; dontUnpack = true; # protoc: symbol lookup error: /nix/store/...-node-protoc/bin/protoc: undefined symbol: , version diff --git a/pusher/default.nix b/pusher/default.nix index 57c1456..a5b84d5 100644 --- a/pusher/default.nix +++ b/pusher/default.nix @@ -1,18 +1,29 @@ -with (import { }); let - workadventure-messages = import ../messages; +{ stdenv +, autoPatchelfHook +, makeWrapper +, fetchzip +, fetchFromGitHub + +, nodejs-14_x +, yarn2nix-moretea + +, workadventure-messages +}: + +let node-abi = "83"; - node-grpc-precompiled = pkgs.fetchzip { + node-grpc-precompiled = fetchzip { name = "node-grpc-precompiled-node-${node-abi}"; url = "https://node-precompiled-binaries.grpc.io/grpc/v1.24.4/node-v${node-abi}-linux-x64-glibc.tar.gz"; sha256 = "119rhhk1jpi2vwyim7byq3agacasc4q25c26wyzfmy8vk2ih6ndj"; }; - node-grpc-patched = pkgs.stdenv.mkDerivation { + node-grpc-patched = stdenv.mkDerivation { name = "node-grpc"; buildInputs = [ stdenv.cc.cc ]; - nativeBuildInputs = [ pkgs.autoPatchelfHook ]; + nativeBuildInputs = [ autoPatchelfHook ]; dontUnpack = true; # spams console dontStrip = true; diff --git a/uploader/default.nix b/uploader/default.nix index 55694c2..a50683b 100644 --- a/uploader/default.nix +++ b/uploader/default.nix @@ -1,4 +1,11 @@ -with (import { }); +{ stdenv +, fetchFromGitHub +, makeWrapper +, mkYarnPackage +, nodejs-14_x +, workadventure-messages +, yarn2nix-moretea +, ... }: yarn2nix-moretea.mkYarnPackage rec { pname = "workadventureuploader"; -- cgit v1.2.3