-
Notifications
You must be signed in to change notification settings - Fork 49
/
flake.nix
104 lines (86 loc) · 2.99 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
depot-js.url = "github:cognitive-engineering-lab/depot";
};
outputs = { self, nixpkgs, flake-utils, rust-overlay, depot-js }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
depotjs = depot-js.packages.${system}.default;
ci-check = pkgs.writeScriptBin "ci-check" ''
cargo fmt --check
cargo insta test -- --skip container_
cd crates/mdbook-aquascope/test-book && mdbook build && cd ../../../
cd frontend && depot test && cd ..
'';
ci-install = pkgs.writeScriptBin "ci-install" ''
cargo make init-bindings
cd frontend && depot build && cd ..
cargo install --path crates/aquascope_front --debug --locked
cargo install --path crates/mdbook-aquascope --debug --locked
'';
ci-publish-crates = pkgs.writeScriptBin "ci-publish-crates" ''
cargo build
cargo ws publish --from-git --allow-dirty --yes --token "$1"
'';
ci-build-standalone = pkgs.writeScriptBin "ci-build-standalone" ''
cd frontend && depot build
'';
ci-publish-full-pages = pkgs.writeScriptBin "ci-update-frontend" ''
cargo doc --lib
cd frontend && depot build
mv ../target/doc ./packages/aquascope-standalone/dist/doc
'';
minimalFrontendDeps = [
depotjs
pkgs.nodejs_22
pkgs.nodePackages.pnpm
ci-build-standalone
];
in {
devShells = {
# Used only for building the frontend with
# depot and publishing the standalone site
minimal = pkgs.mkShell {
buildInputs = minimalFrontendDeps;
};
fullstack = with pkgs; mkShell {
buildInputs = minimalFrontendDeps ++ [
ci-check
ci-install
ci-publish-crates
ci-publish-full-pages
llvmPackages_latest.llvm
llvmPackages_latest.lld
libiconv
cargo-insta
cargo-make
cargo-watch
rust-analyzer
mdbook
toolchain
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.SystemConfiguration
];
shellHook = ''
export RUSTC_PATH=$(which rustc);
export SYSROOT=$(rustc --print sysroot)
export MIRI_SYSROOT=$(cargo miri setup --print-sysroot)
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$(rustc --print target-libdir)"
'';
RUSTC_LINKER = "${llvmPackages.clangUseLLVM}/bin/clang";
# NOTE: the version of playwright-driver must match the version of
# playwright in the embed and standalone packages.
PLAYWRIGHT_BROWSERS_PATH="${playwright-driver.browsers}";
};
default = self.devShells.${system}.fullstack;
};
});
}