This repository has been archived by the owner on May 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
92 lines (80 loc) · 2.07 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
{
description = "A Nix-flake-based Rust + Node.js development environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-22.11";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs =
{ self
, nixpkgs
, flake-utils
, rust-overlay
}:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [
(import rust-overlay)
(self: super: rec {
nodejs = super.nodejs-18_x;
pnpm = super.nodePackages.pnpm;
yarn = (super.yarn.override { inherit nodejs; });
rustToolchain =
let
rust = super.rust-bin;
in
if builtins.pathExists ./rust-toolchain.toml then
rust.fromRustupToolchainFile ./rust-toolchain.toml
else if builtins.pathExists ./rust-toolchain then
rust.fromRustupToolchainFile ./rust-toolchain
else
rust.stable.latest.default;
})
];
pkgs = import nixpkgs { inherit system overlays; };
packages = with pkgs; [
rustToolchain
openssl
pkg-config
cargo-deny
cargo-edit
cargo-watch
rust-analyzer
node2nix
nodejs
pnpm
yarn
wasm-pack
];
allSystems = [
"aarch64-darwin"
"aarch64-linux"
"armv5tel-linux"
"armv6l-linux"
"armv7a-linux"
"armv7l-linux"
"i686-linux"
# "mipsel-linux" # Missing `busybox`.
"powerpc64le-linux"
"riscv64-linux"
"x86_64-darwin"
"x86_64-linux"
];
in
{
devShells = {
default = pkgs.mkShell {
packages = packages;
shellHook = ''
${pkgs.rustToolchain}/bin/cargo --version
'';
};
"x86_64-linux" = pkgs.mkShell {
packages = packages // [pkgs.darwin.apple_sdk.frameworks.AppKit];
shellHook = ''
${pkgs.rustToolchain}/bin/cargo --version
'';
};
};
});
}