-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
65 lines (60 loc) · 1.96 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
{
description = "Flake utils demo";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
flake-utils.url = "github:numtide/flake-utils";
fenix.url = "github:nix-community/fenix";
fenix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, flake-utils, ... }@inputs:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
fenix = inputs.fenix.packages.${system};
rust-release = "stable";
rust-targets = [
"x86_64-unknown-linux-gnu"
"x86_64-unknown-linux-musl"
"aarch64-unknown-linux-musl"
"wasm32-unknown-unknown"
"wasm32-wasi"
"thumbv6m-none-eabi"
];
toolchain = fenix.combine ([
fenix.${rust-release}.cargo
fenix.${rust-release}.clippy
fenix.${rust-release}.rustc
fenix.${rust-release}.rust-src
] ++ (builtins.map
(target: fenix.targets.${target}.${rust-release}.rust-std)
rust-targets));
in
rec {
packages.lwsk =
let
lwskToml = builtins.fromTOML (builtins.readFile ./lwsk/Cargo.toml);
in
pkgs.rustPlatform.buildRustPackage {
pname = lwskToml.package.name;
version = lwskToml.package.version;
src = ./lwsk;
cargoLock = {
lockFile = ./lwsk/Cargo.lock;
};
};
packages.lwsk-no_std = packages.lwsk.overrideAttrs (_: { buildNoDefaultFeatures = true; });
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
toolchain
fenix.rust-analyzer
fenix.latest.rustfmt
wabt
# ep in C
bear # can auto-generate a compile_commands.json
llvmPackages.clang-unwrapped # provides clang
llvmPackages.bintools-unwrapped # provides wasm-ld
];
};
}
);
}