kitchen/nix/kitchen/default.nix
2022-09-01 14:26:43 -04:00

23 lines
670 B
Nix

{pkgs ? (import <nixpkgs>) {},
# Because it's a workspace we need the other crates available as source
root,
kitchenWasm,
version,
naersk-lib,
rust-wasm,
}:
with pkgs;
(naersk-lib.buildPackage rec {
pname = "kitchen";
inherit version;
buildInputs = [ rust-wasm ];
# However the crate we are building has it's root in specific crate.
src = root;
nativeBuildInputs = (if stdenv.isDarwin then [ xcbuild pkgs.darwin.apple_sdk.frameworks.Security ] else [ ]) ++ [llvm clang];
cargoBuildOptions = opts: opts ++ ["-p" "${pname}" ];
postPatch = ''
mkdir -p web/dist
cp -r ${kitchenWasm}/* web/dist/
ls web/dist/
'';
})