-
Notifications
You must be signed in to change notification settings - Fork 3
/
flake.nix
88 lines (81 loc) · 2.46 KB
/
flake.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
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
rainix.url = "github:rainprotocol/rainix";
};
outputs = { self, flake-utils, rainix }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = rainix.pkgs.${system};
in rec {
packages = {
build-bin = (pkgs.makeRustPlatform{
rustc = rainix.rust-toolchain.${system};
cargo = rainix.rust-toolchain.${system};
}).buildRustPackage {
src = ./.;
doCheck = false;
name = "dotrain";
cargoLock.lockFile = ./Cargo.lock;
# allows for git deps to be resolved without the need to specify their outputHash
cargoLock.allowBuiltinFetchGit = true;
buildPhase = ''
cargo build --release --bin dotrain --features cli
'';
installPhase = ''
mkdir -p $out/bin
cp target/release/dotrain $out/bin/
'';
buildInputs = with pkgs; [
openssl
];
nativeBuildInputs = with pkgs; [
pkg-config
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.SystemConfiguration
];
};
build-js-bindings = rainix.mkTask.${system} {
name = "build-js-bindings";
body = ''
set -euxo pipefail
npm install
npm run build
'';
};
test-js-bindings = rainix.mkTask.${system} {
name = "test-js-bindings";
body = ''
set -euxo pipefail
npm test
'';
};
js-bindings-docs = rainix.mkTask.${system} {
name = "js-bindings-docs";
body = ''
set -euxo pipefail
npm run docgen
'';
};
} // rainix.packages.${system};
# # For `nix build` & `nix run`:
defaultPackage = packages.build-bin;
# For `nix develop`:
devShells.default = pkgs.mkShell {
packages = [
packages.build-js-bindings
packages.test-js-bindings
packages.js-bindings-docs
packages.rainix-rs-prelude
packages.rainix-rs-static
packages.rainix-rs-test
packages.rainix-rs-artifacts
];
buildInputs = rainix.devShells.${system}.default.buildInputs;
nativeBuildInputs = rainix.devShells.${system}.default.nativeBuildInputs ++ (with pkgs; [
wasm-bindgen-cli
]);
};
}
);
}