Skip to content

Commit c54b05a

Browse files
committed
feat: add generic crate overrides for wasm and unstable-opts
1 parent 6888dc0 commit c54b05a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

nix/crate-overrides.nix

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
1-
{ self, ... }:
1+
{ lib, self, ... }:
22
{
33
flake.overlays.crateOverrides = final: prev: {
44
defaultCrateOverrides = prev.defaultCrateOverrides
55
// self.tools.${prev.system}.crateOverrides;
66
};
77
perSystem = { pkgs, ... }: {
88
tools.crateOverrides = {
9+
wasm-crate = attrs: {
10+
target = lib.systems.examples.wasm32-unknown-none;
11+
globalRustcOpts = [ "-C" "panic=abort" ];
12+
postInstall = (attrs.postInstall or "") + ''
13+
mkdir -p $out
14+
cp -r target/lib/*.wasm $out/
15+
'';
16+
};
17+
unstable-opts-crate = attrs: {
18+
extraRustcOpts = (attrs.extraRustcOpts or []) ++ [
19+
"-Z" "unstable-options"
20+
];
21+
};
922
openssl-sys = attrs: {
1023
nativeBuildInputs = [ pkgs.pkg-config ];
1124
buildInputs = [ pkgs.openssl ];

0 commit comments

Comments
 (0)