-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
70 lines (65 loc) · 2.4 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
{
description = "leptos by example website";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
flake-utils.follows = "flake-utils";
};
};
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, rust-overlay, nixpkgs, flake-utils, crane }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
inherit (pkgs) lib;
rustToolchain = pkgs.rust-bin.selectLatestNightlyWith(
toolchain: toolchain.default.override
{
# Set the build targets supported by the toolchain,
# wasm32-unknown-unknown is required for trunk.
targets = [ "wasm32-unknown-unknown" ];
}
);
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
CARGO_BUILD_TARGET = "wasm32-unknown-unknown";
in
{
checks = {};
packages = {
default = craneLib.buildTrunkPackage {
nativeBuildInputs = [
(pkgs.wasm-bindgen-cli.override {
version = "0.2.87";
hash = "sha256-0u9bl+FkXEK2b54n7/l9JOCtKo+pb42GF9E1EnAUQa0=";
cargoHash = "sha256-AsZBtE2qHJqQtuCt/wCAgOoxYMfvDh8IzBPAOkYSYko=";
})
];
inherit CARGO_BUILD_TARGET;
src=./.;
pname = "leptos-by-example";
trunkIndexPath = "./index.html";
trunkExtraBuildArgs = "--public-url=/leptos-by-example";
};
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
rustToolchain
binaryen
openssl
pkg-config
trunk
rust-analyzer
];
};
}
);
}