-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
108 lines (96 loc) · 2.62 KB
/
Copy pathflake.nix
File metadata and controls
108 lines (96 loc) · 2.62 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
{
description = "Frontend app for reciperium";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
gitignore.url = "github:hercules-ci/gitignore.nix";
gitignore.inputs.nixpkgs.follows = "nixpkgs";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs@{
flake-parts,
nixpkgs,
gitignore,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
debug = true;
systems = [
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
perSystem =
{
pkgs,
inputs',
...
}:
let
nodejs = pkgs.nodejs_24;
fenix = inputs'.fenix.packages;
rustChannel = "stable";
rustToolchain = (
fenix.combine [
fenix.${rustChannel}.toolchain
# https://doc.rust-lang.org/rustc/platform-support.html
# For more targets add:
# fenix.targets.aarch64-linux-android."${rustChannel}".rust-std
fenix.targets.wasm32-unknown-unknown."${rustChannel}".rust-std
]
);
in
{
packages.recipe-parser-wasm = pkgs.rustPlatform.buildRustPackage {
name = "recipe-parser-wasm";
src = gitignore.lib.gitignoreSource ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
doCheck = false;
# used at build time
nativeBuildInputs = with pkgs; [
just
wasm-pack
wasm-bindgen-cli
nodejs
llvmPackages.bintools
binaryen
];
configurePhase = ''
# NPM writes cache directories etc to $HOME.
export HOME=$TMP
'';
buildPhase = ''
just build
'';
installPhase = ''
mv out $out
'';
};
devShells.default = pkgs.mkShell {
name = "recipe-parser-wasm";
packages =
with pkgs;
[
just
wasm-pack
nodejs
rustToolchain
]
++ lib.optionals stdenv.isDarwin [
libiconv
darwin.apple_sdk_11_0.frameworks.Cocoa
darwin.apple_sdk_11_0.frameworks.CoreServices
darwin.apple_sdk_11_0.frameworks.Security
];
shellHook = ''
just --list
'';
};
};
};
}