diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-09-11 07:25:23 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-09-11 10:09:16 +0100 |
| commit | 8959161c34fdd21cce715715a11f6a52e9a39f58 (patch) | |
| tree | 9829cec6dbae350acac32ce46ecb0286c9b5cd92 | |
| parent | ea7aa01e1e2d89fb00c758943b135dc56cd7c1fc (diff) | |
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.
| -rw-r--r-- | flake.nix | 20 |
1 files changed, 12 insertions, 8 deletions
| @@ -44,12 +44,10 @@ | |||
| 44 | ''; | 44 | ''; |
| 45 | }; | 45 | }; |
| 46 | # Create packages for each binary defined in Cargo.toml | 46 | # Create packages for each binary defined in Cargo.toml |
| 47 | packages = lib.listToAttrs (map (bin: { | 47 | packages.default = pkgs.rustPlatform.buildRustPackage { |
| 48 | inherit (bin) name; | 48 | pname = manifest.package.name; |
| 49 | value = pkgs.rustPlatform.buildRustPackage { | ||
| 50 | pname = bin.name; | ||
| 51 | version = manifest.package.version; | 49 | version = manifest.package.version; |
| 52 | src = bin.path; | 50 | src = ./.; |
| 53 | cargoLock = { | 51 | cargoLock = { |
| 54 | lockFile = ./Cargo.lock; | 52 | lockFile = ./Cargo.lock; |
| 55 | outputHashes = { | 53 | outputHashes = { |
| @@ -58,11 +56,17 @@ | |||
| 58 | }; | 56 | }; |
| 59 | }; | 57 | }; |
| 60 | buildInputs = [ | 58 | buildInputs = [ |
| 61 | pkgs.pkg-config | 59 | pkg-config # required by git2 |
| 62 | pkgs.openssl | 60 | openssl |
| 63 | ]; | 61 | ]; |
| 62 | nativeBuildInputs = [ | ||
| 63 | pkg-config # required by git2 | ||
| 64 | openssl | ||
| 65 | ]; | ||
| 66 | shellHook = '' | ||
| 67 | export PKG_CONFIG_PATH="${pkgs.openssl.dev}/lib/pkgconfig" | ||
| 68 | ''; | ||
| 64 | }; | 69 | }; |
| 65 | }) manifest.bin); | ||
| 66 | } | 70 | } |
| 67 | ); | 71 | ); |
| 68 | } \ No newline at end of file | 72 | } \ No newline at end of file |