2020-04-23 18:19:12 +00:00
|
|
|
#
|
|
|
|
# This fetches nimbus source from local folder or GitHub and
|
|
|
|
# loads the derivation defined in the `nix/default.nix` in the repo.
|
|
|
|
#
|
|
|
|
|
|
|
|
{ config, lib, stdenv, callPackage, fetchFromGitHub }:
|
2020-01-21 07:19:49 +00:00
|
|
|
|
|
|
|
let
|
2020-04-23 18:19:12 +00:00
|
|
|
inherit (lib) getConfig attrByPath strings traceValFn;
|
2020-01-21 07:19:49 +00:00
|
|
|
|
|
|
|
repo = "nimbus";
|
|
|
|
|
2020-04-23 18:19:12 +00:00
|
|
|
localPath = getConfig "nimbus.src-override" "";
|
|
|
|
localSrc =
|
|
|
|
# We use builtins.path so that we can name the resulting derivation.
|
|
|
|
# Name would be taken from the checkout directory, and wouldn't be deterministic.
|
|
|
|
builtins.path rec {
|
|
|
|
path = traceValFn (path: ''
|
|
|
|
Using local ${repo} sources from ${path}
|
|
|
|
'') localPath;
|
|
|
|
name = "${repo}-source-local";
|
|
|
|
filter =
|
|
|
|
# Keep this filter as restrictive as possible in order to
|
|
|
|
# avoid unnecessary rebuilds and limit closure size
|
|
|
|
lib.mkFilter {
|
|
|
|
root = path;
|
|
|
|
include = [
|
|
|
|
"nix.*" "wrappers.*" "vendor.*"
|
|
|
|
"Makefile" "nim.cfg" "nimbus.nimble" "default.nix"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
ghSrc = fetchFromGitHub rec {
|
|
|
|
inherit repo;
|
|
|
|
name = "${repo}-source-${strings.substring 0 7 rev}";
|
|
|
|
rev = "73278f20d0bf27fb7c6c331b515abb765814f1cc";
|
|
|
|
owner = "status-im";
|
|
|
|
sha256 = "0myq234zqnpmqsc2452xygnyc6sjs8x1blyrpa4bi9v2cwbyap5c";
|
|
|
|
fetchSubmodules = true;
|
2020-01-21 07:19:49 +00:00
|
|
|
};
|
|
|
|
|
2020-04-23 18:19:12 +00:00
|
|
|
src = if localPath != "" then localSrc else ghSrc;
|
|
|
|
|
2020-01-21 07:19:49 +00:00
|
|
|
nimbusDeriv = import "${src}/nix/default.nix";
|
|
|
|
|
|
|
|
in nimbusDeriv
|