I would like to package the following project for NixOS:
However, it’s sort of a monorepo of 3 rust crates (only the 1st has an actual binary that’s interesting):
vhdl_ls
vhdl_lang
vhdl_libraries
The 1st problem is that no Cargo.lock
is tracked in the repository. I hoped that I could get away with that using fetchCrate
with pname = "vhdl_ls
- the subproject of interest, however running it fails with:
thread 'main' panicked at 'Couldn't find installed libraries at ../vhdl_libraries, ../../vhdl_libraries, /usr/lib/rust_hdl/vhdl_libraries.', /build/vhdl_ls-0.64.0-vendor.tar.gz/vhdl_lang/src/config.rs:237:9
I think I can add a Cargo.lock
patch for the mono repo, but even then I’m not sure what would buildRustPackage
will do exactly - which project it will build? Perhaps I can negotiate with upstream to start track the Cargo.lock
? But I’m not sure it’s justified (I’m not a rust developer).
My current progress is at this PR.
Help will be appreciated!
You would need to create your own Cargo.lock
{ lib
, rustPlatform
, fetchFromGitHub
}:
rustPlatform.buildRustPackage rec {
pname = "rust-hdl";
version = "0.64.0";
src = fetchFromGitHub {
owner = "VHDL-LS";
repo = "rust_hdl";
rev = "v${version}";
hash = "sha256-j5WRJJBUPKW3W+kY5hdqdZxxGkIAoEcW+A2pp23MX6Q=";
};
cargoLock = {
lockFile = ./Cargo.lock;
};
postPatch = ''
ln -s ${./Cargo.lock} Cargo.lock
'';
meta = with lib; {
description = "A VHDL language server";
homepage = "https://github.com/VHDL-LS/rust_hdl";
license = licenses.mpl20;
maintainers = with maintainers; [ ];
};
}
nix-init helps make this process easier, though I would still recommend suggesting upstream to include Cargo.lock
in the repository
OK I guess there is no choice… I’m happy to learn at least that adding a Cargo.lock
manually like that doesn’t require also a cargoHash
. Thanks for the help!
The compilation did got better, but apparently there is still the "vhdl_libraries
not found" error, as in the my first comment…
Oh wait, this is easily fixable… Now PR is not a draft. Thanks for the help!