I’m attempting to build a Rust workspace that depends on the openssl-sys crate using this flake:
{
description = "tf2ultimate";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
crane.url = "github:ipetkov/crane";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, crane, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
craneLib = crane.mkLib pkgs;
tf2ultimate-apps = craneLib.buildPackage {
buildInputs = with pkgs; [ dbus openssl ];
nativeBuildInputs = with pkgs; [ pkg-config ];
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.unions [
./Cargo.toml
./Cargo.lock
./backpacktf-common
./backpacktf-listing-freshener
./backpacktf-ws-db-writer
./stntrading-api
./stntrading-listing-freshener
./tf2-db-common
./tf2-db-migrator
./tf2-schema
./tf2-schema-updater
];
};
};
in
{
packages.tf2ultimate = tf2ultimate-apps;
});
}
However, when trying to build the flake I get this error:
The system library `openssl` required by crate `openssl-sys` was not found.
The file `openssl.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent dir>
PKG_CONFIG_PATH contains the following:
- /nix/store/yv8ksqj4pmpxcq8878hn07nirh6mn5d4-zstd-1.5.6-dev/lib/pkgconfig
- /nix/store/qj94g4g6i5z2m99pfjvjgwgqx0vy216q-dbus-1.14.10-dev/lib/pkgconfig
- /nix/store/cyccwyjsfqkg5p2k096wvd274nv80q0l-expat-2.6.2-dev/lib/pkgconfig
HINT: you may need to install a package such as openssl, openssl-dev or openssl-devel.
After researching other cases of similar problems, I have tried setting PKG_CONFIG_PATH="${pkgs.openssl.dev}/lib/pkgconfig"
, as well as setting OPENSSL_DIR="${pkgs.openssl.dev}"
, to no avail.
Is there something else I’m missing? Any help would be appreciated, thank you!