diff --git a/nix/devShell/default.nix b/nix/devShell/default.nix index 4191d05..6eff918 100644 --- a/nix/devShell/default.nix +++ b/nix/devShell/default.nix @@ -1,5 +1,5 @@ { pkgs, rust-wasm }: with pkgs; mkShell { - buildInputs = (if stdenv.isDarwin then [ pkgs.darwin.apple_sdk.frameworks.Security ] else [ ]) ++ (with pkgs; [wasm-bindgen-cli wasm-pack llvm clang rust-wasm]); + buildInputs = (lib.darwin-sdk pkgs) ++ (with pkgs; [wasm-bindgen-cli wasm-pack llvm clang rust-wasm]); } \ No newline at end of file diff --git a/nix/kitchen/default.nix b/nix/kitchen/default.nix index 2c2b7c3..691bd01 100644 --- a/nix/kitchen/default.nix +++ b/nix/kitchen/default.nix @@ -1,3 +1,6 @@ +let + lib = import ../lib/lib.nix; +in {pkgs ? (import ) {}, # Because it's a workspace we need the other crates available as source root, @@ -12,11 +15,7 @@ with pkgs; inherit version; buildInputs = [ rust-wasm libclang ]; # However the crate we are building has it's root in specific crate. - nativeBuildInputs = (if stdenv.isDarwin then (with pkgs.darwin.apple_sdk.frameworks; [ - xcbuild - Security - fixDarwinDylibNames - ]) else [ ]) ++ [llvm clang rust-bindgen]; + nativeBuildInputs = (lib.darwin-sdk pkgs) ++ [llvm clang rust-bindgen]; src = root; cargoBuildOptions = opts: opts ++ ["-p" "${pname}" ]; postPatch = '' diff --git a/nix/lib/lib.nix b/nix/lib/lib.nix new file mode 100644 index 0000000..378f147 --- /dev/null +++ b/nix/lib/lib.nix @@ -0,0 +1,7 @@ +{ + darwin-sdk = pkgs: with pkgs; (if stdenv.isDarwin then (with darwin.apple_sdk.frameworks; [ + xcbuild + Security + fixDarwinDylibNames + ]) else [ ]); +} \ No newline at end of file