-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
100 lines (84 loc) · 2.6 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
{ nixpkgs ? null
, rustVersion ? {
track = "stable";
version = "1.60.0";
}
, holonixArgs ? {
inherit rustVersion;
}
}:
# This is an example of what downstream consumers of holonix should do
# This is also used to dogfood as many commands as possible for holonix
# For example the release process for holonix uses this file
let
# point this to your local config.nix file for this project
# example.config.nix shows and documents a lot of the options
config = import ./config.nix;
sources = import ./nix/sources.nix;
# START HOLONIX IMPORT BOILERPLATE
holonixPath = config.holonix.pathFn { };
holonix = config.holonix.importFn holonixArgs;
# END HOLONIX IMPORT BOILERPLATE
overlays = [
(self: super: {
inherit holonix holonixPath;
hcToplevelDir = builtins.toString ./.;
nixEnvPrefixEval = ''
if [[ -n "$NIX_ENV_PREFIX" ]]; then
# don't touch it
:
elif test -w "$PWD"; then
export NIX_ENV_PREFIX="$PWD"
elif test -d "${builtins.toString self.hcToplevelDir}" &&
test -w "${builtins.toString self.hcToplevelDir}"; then
export NIX_ENV_PREFIX="${builtins.toString self.hcToplevelDir}"
elif test -d "$HOME" && test -w "$HOME"; then
export NIX_ENV_PREFIX="$HOME/.cache/holochain-dev"
mkdir -p "$NIX_ENV_PREFIX"
else
export NIX_ENV_PREFIX="$(${self.coreutils}/bin/mktemp -d)"
fi
'';
rustPlatform = self.makeRustPlatform {
rustc = holonix.pkgs.custom_rustc;
cargo = holonix.pkgs.custom_rustc;
};
crate2nix = import sources.crate2nix.outPath { };
cargo-nextest = self.rustPlatform.buildRustPackage {
name = "cargo-nextest";
src = sources.nextest.outPath;
cargoSha256 = "sha256-E25P/vasIBQp4m3zGii7ZotzJ7b2kT6ma9glvmQXcnM=";
cargoTestFlags = [
# TODO: investigate some more why these tests fail in nix
"--"
"--skip=tests_integration::test_relocated_run"
"--skip=tests_integration::test_run"
"--skip=tests_integration::test_run_after_build"
];
};
})
];
nixpkgs' = import (nixpkgs.path or holonix.pkgs.path) { inherit overlays; };
inherit (nixpkgs') callPackage;
pkgs = callPackage ./nix/pkgs/default.nix { };
in
{
inherit
nixpkgs'
holonix
pkgs
;
# TODO: refactor when we start releasing again
# releaseHooks = callPackages ./nix/release {
# inherit
# config
# nixpkgs
# ;
# };
shells = callPackage ./nix/shells.nix {
inherit
holonix
pkgs
;
};
}