From 8959161c34fdd21cce715715a11f6a52e9a39f58 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 11 Sep 2024 07:25:23 +0100 Subject: build: fix nix binary references and build tools both binaries should be within the same package. `pkg-config` and `openssl` need to be in both `nativeBuildInputs` and `buildInputs` and dev shell `buildInputs` otherwise the build will fail. PKG_CONFIG_PATH ev also needs to be set. --- flake.nix | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/flake.nix b/flake.nix index d84d745..89906c2 100644 --- a/flake.nix +++ b/flake.nix @@ -44,12 +44,10 @@ ''; }; # Create packages for each binary defined in Cargo.toml - packages = lib.listToAttrs (map (bin: { - inherit (bin) name; - value = pkgs.rustPlatform.buildRustPackage { - pname = bin.name; + packages.default = pkgs.rustPlatform.buildRustPackage { + pname = manifest.package.name; version = manifest.package.version; - src = bin.path; + src = ./.; cargoLock = { lockFile = ./Cargo.lock; outputHashes = { @@ -58,11 +56,17 @@ }; }; buildInputs = [ - pkgs.pkg-config - pkgs.openssl + pkg-config # required by git2 + openssl ]; + nativeBuildInputs = [ + pkg-config # required by git2 + openssl + ]; + shellHook = '' + export PKG_CONFIG_PATH="${pkgs.openssl.dev}/lib/pkgconfig" + ''; }; - }) manifest.bin); } ); } \ No newline at end of file -- cgit v1.2.3