-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
84 lines (76 loc) · 2.46 KB
/
flake.nix
File metadata and controls
84 lines (76 loc) · 2.46 KB
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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
systems,
nixpkgs,
treefmt-nix,
...
} @ inputs: let
eachSystem = f:
nixpkgs.lib.genAttrs (import systems) (
system:
f (
import nixpkgs {
inherit system;
overlays = [inputs.rust-overlay.overlays.default];
}
)
);
rustToolchain = eachSystem (pkgs: (pkgs.rust-bin.stable.latest.default.override {
extensions = ["rust-src"];
targets = ["wasm32-unknown-unknown"];
}));
treefmtEval = eachSystem (pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix);
in {
devShells = eachSystem (pkgs: {
default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
clang
# Use mold when we are runnning in Linux
(lib.optionals stdenv.isLinux mold)
];
buildInputs = with pkgs; [
nodejs
# You can set the major version of Node.js to a specific one instead
# of the default version
# pkgs.nodejs-22_x
# It is possible to use bun instead of node.
# pkgs.bun
# Optionally, you can add yarn or pnpm for package management for node.
# pkgs.nodePackages.pnpm
corepack
nodePackages.typescript
nodePackages.typescript-language-server
svelte-language-server
tailwindcss-language-server
prettierd
rustToolchain.${pkgs.system}
rust-analyzer-unwrapped
cargo
wasm-pack
wabt
];
RUST_SRC_PATH = "${rustToolchain.${pkgs.system}}/lib/rustlib/src/rust/library";
CC_wasm32_unknown_unknown = "${pkgs.llvmPackages_19.clang-unwrapped}/bin/clang";
AR_wasm32_unknown_unknown = "${pkgs.llvmPackages_19.bintools-unwrapped}/bin/llvm-ar";
CFLAGS_wasm32_unknown_unknown = "-I ${pkgs.llvmPackages_19.clang-unwrapped.lib}/lib/clang/19/include";
};
});
formatter = eachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
checks = eachSystem (pkgs: {
formatting = treefmtEval.${pkgs.system}.config.build.check self;
});
};
}