Jakub Sokołowski 42fb40476c
nix: reafactoring of status-go builds
Changes:
- Fixed `nix/status-go/desktop` builds
- Dropped nimbus wrapper for `status-go` for now
- Split `status-go` builds into subfolders: `mobile`, `desktop`
- Fixed shells for desktop builds: `linux`,`macos`,`windows`
- Added `make status-go-*` targets for building them
- Moved source management to `nix/status-go/source.nix`
- Moved `nix/status-go/build.nix` into `nix/status-go/mobile`
- Moved `nix/desktop/cmake/qtkeychain` to `nix/pkgs/qtkeychain-src`
- Moved `nix/desktop/linux/linuxdeployqt` to `nix/pkgs`
- Moved `nix/desktop/linux/appimagekit` to `nix/pkgs`
- Dropped `nix/tools/mkShell.nix` since it did almost nothing
- Dropped `nix/desktop/cmake/snorenotify` since it's broken
- Moved setup from `nix/tools/mkShell.nix` to `nix/shells.nix`
- Simplified `nix/mobile/ios/status-go-shell.nix`
- Simplified `nix/status-go/default.nix`
- Updated the `nix/DETAILS.md` and `nix/README.md`
- Moved known issues to `nix/KNOWN_ISSUES.md`
- Improved output of `nix/scripts/build.sh`

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-05-04 20:55:07 +02:00

60 lines
2.0 KiB
Nix

{ config, utils, lib, callPackage, fetchFromGitHub }:
let
inherit (lib) strings traceValFn attrByPath importJSON;
srcOverride = attrByPath [ "status-im" "status-go" "src-override" ] null config;
# Warning message about using local sources
localSrcWarn = (path: "Using local status-go sources from ${path}");
localSrc = rec {
owner = "status-im";
repo = "status-go";
rev = "unknown";
shortRev = rev;
rawVersion = "develop";
cleanVersion = rawVersion;
goPackagePath = "github.com/${owner}/${repo}";
# We use builtins.path so that we can name the resulting derivation,
# Normally the name would not be deterministic, taken from the checkout directory.
src = builtins.path rec {
path = traceValFn localSrcWarn srcOverride;
name = "${repo}-source-${shortRev}";
# Keep this filter as restrictive as possible in order
# to avoid unnecessary rebuilds and limit closure size
filter = lib.mkFilter {
root = path;
include = [ ".*" ];
exclude = [
".*/[.]git.*" ".*[.]md" ".*[.]yml" ".*/.*_test.go$"
"_assets/.*" "build/.*"
".*/.*LICENSE.*" ".*/CONTRIB.*" ".*/AUTHOR.*"
];
};
};
};
githubSrc = let
# TODO: Simplify this path search with lib.locateDominatingFile
versionJSON = importJSON ../../status-go-version.json;
sha256 = versionJSON.src-sha256;
in rec {
inherit (versionJSON) owner repo version;
rev = versionJSON.commit-sha1;
shortRev = strings.substring 0 7 rev;
rawVersion = versionJSON.version;
cleanVersion = utils.sanitizeVersion versionJSON.version;
goPackagePath = "github.com/${owner}/${repo}";
src = fetchFromGitHub {
inherit rev owner repo sha256;
name = "${repo}-${shortRev}-source";
};
};
in
if srcOverride != null
# If config.status-im.status-go.src-override is defined,
# instruct Nix to use that path to build status-go
then localSrc
# Otherwise grab it from the location defined by status-go-version.json
else githubSrc