-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
77 lines (75 loc) · 2.51 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
{
description = "Social bill tracker and civil engagement platform";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.flake-compat.url = "github:edolstra/flake-compat";
inputs.flake-compat.flake = false;
inputs.rust-overlay.url = "github:oxalica/rust-overlay";
outputs = { self, nixpkgs, flake-utils, flake-compat, rust-overlay }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [(import rust-overlay)];
pkgs = import nixpkgs { inherit system overlays; };
rustToolchain = pkgs.rust-bin.stable.latest.minimal.override {
extensions = [ "rustfmt" "clippy" "llvm-tools-preview" "rust-src" ];
targets = [ "wasm32-unknown-unknown" ];
};
nightlyToolchain = pkgs.rust-bin.nightly."2022-11-01".minimal.override {
extensions = ["rustfmt" "clippy" "llvm-tools-preview" "rust-src" ];
targets = [ "wasm32-unknown-unknown" ];
};
nixWithFlakes = pkgs.writeShellScriptBin "nix" ''
exec ${pkgs.nixVersions.stable}/bin/nix --experimental-features "nix-command flakes" "$@"
'';
devPkgs = with pkgs;
[
postgresql
];
rustDeps = with pkgs;
[
openssl
bash
curl
cargo-llvm-cov
cargo-sort
wasm-pack
openssl
binaryen
clang
] ++ lib.optionals stdenv.isDarwin [
# required to build some crates on MacOS
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.CoreFoundation
];
nodeDeps = with pkgs;
[
nodejs
];
in {
devShell = pkgs.mkShell {
buildInputs = with pkgs;
[
nixWithFlakes
git
rustToolchain
] ++ devPkgs ++ rustDeps ++ nodeDeps;
shellHook = "export CC=${pkgs.clang}/bin/clang";
OPENSSL_INCLUDE_DIR = "${pkgs.openssl.dev}/include";
OPENSSL_LIB_DIR = "${pkgs.openssl.out}/lib";
RUST_LOG = "info";
RUST_BACKTRACE = "1";
};
devShells = {
nightlyShell = pkgs.mkShell {
buildInputs = with pkgs;
[
nixWithFlakes
nightlyToolchain
cargo-expand
] ++ devPkgs ++ rustDeps ++ nodeDeps ;
RUST_LOG = "info";
RUST_BACKTRACE = "1";
};
};
}
);
}