!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

698 Members
Rust158 Servers

Load older messages


SenderMessageTime
25 Mar 2025
@emilazy:matrix.orgemily which would meet the "no upstream Cargo.lock" use case and ~obsolete importCargoLock 14:08:53
@tomasajt:matrix.orgTomaI guess very much like with fetchYarnDeps14:09:44
@tomasajt:matrix.orgToma but for historical reasons almost everyone uses ${src}/yarn.lock instead of inherit src there (it's not IFD, since it only uses that in the build process) 14:10:37
@emilazy:matrix.orgemily

https://github.com/NixOS/nixpkgs/blob/15f3d37c73c8c1090f8fef7b8508675c9260eab6/pkgs/build-support/rust/import-cargo-lock.nix

  • https://github.com/NixOS/nixpkgs/blob/15f3d37c73c8c1090f8fef7b8508675c9260eab6/pkgs/build-support/rust/replace-workspace-values.py

isn't a trivial maintenance burden, so if 25.05 is doing breaking changes anyway, it might be best to eliminate it

14:11:05
@emilazy:matrix.orgemily * https://github.com/NixOS/nixpkgs/blob/15f3d37c73c8c1090f8fef7b8508675c9260eab6/pkgs/build-support/rust/import-cargo-lock.nix + https://github.com/NixOS/nixpkgs/blob/15f3d37c73c8c1090f8fef7b8508675c9260eab6/pkgs/build-support/rust/replace-workspace-values.py isn't a trivial maintenance burden, so if 25.05 is doing breaking changes anyway, it might be best to eliminate it 14:11:09
@emilazy:matrix.orgemily ah I guess we use the latter in fetchCargoVendor too 14:11:34
@emilazy:matrix.orgemilyso it's not so bad14:11:35
@emilazy:matrix.orgemilybut it still seems better to just consolidate14:11:45
@tomasajt:matrix.orgTomaif still thinking of how we could replace depsExtraArgs with a better alterative14:12:27
@tomasajt:matrix.orgToma* if still thinking of how we could replace depsExtraArgs with a better alterative (semi related)14:13:03
@emilazy:matrix.orgemily it looks like we could add lockFileContents ? null and lockFile ? null to fetchCargoVendor, and simply replace ./Cargo.lock with ${if lockFile != null then "${lockFile}" else if lockFileContents != null then writeText … else "./Cargo.lock"} 14:13:47
@emilazy:matrix.orgemilyI guess the downside is for "local" flakes with Rust packages though14:14:20
@emilazy:matrix.orgemilyso maybe it is not a good idea, even if it is better for Nixpkgs14:14:32
@tomasajt:matrix.orgTomabtw we're still using replace-workspace-values.py in fetchCargoVendor14:14:42
@emilazy:matrix.orgemilyyeah I saw :)14:14:48
@emilazy:matrix.orgemilyanyway, ok, this is a distraction. if we want to do that we can do it another release anyway14:15:16
@emilazy:matrix.orgemilybut I think we should do this now before we forget :P14:15:26
@emilazy:matrix.orgemily I'm reproducing system-syzygy before merging 14:15:38
@emilazy:matrix.orgemily fwiw, the thing about supporting old lock files isn't so much about existing packages but the fact that I find it hard to imagine a PR to add a new one that we'd want to accept 14:19:04
@emilazy:matrix.orgemily so given the existence of a fallback path in the form of importCargoLock it seems bad to add any complexity to our current infrastructure for it 14:19:31
@tomasajt:matrix.orgTomayeah, not worth rebuilding so many packages for those14:24:01
@tomasajt:matrix.orgTomaI know i've already sent this in a few times, but: https://github.com/NixOS/nixpkgs/pull/39017114:25:49
@emilazy:matrix.orgemilynot sure I understand this PR enough to approve it without reading up more on the issue14:27:52
@emilazy:matrix.orgemily Toma: are you up for doing this or would you like me to have a go at it? 15:13:08
@tomasajt:matrix.orgTomaI will be away thursday-sunday when I won't really be able to respond, so I'd appreciate if someone else did it15:14:19
@marie:marie.cologneMarie changed their display name from Marie to Marie Ramlow.17:42:02
@marie:marie.cologneMarie changed their display name from Marie Ramlow to Marie.17:44:37
@djacu:matrix.orgdjacu

What's the desired avenue for discussing and submitting problems found within rustPlatform? I have found a few issues when dealing with private registries. I can provide more complete details but I'll share a short summary for now.

  1. The fetchCrate function in import-cargo-lock.nix assumes that all registry platforms follow the same URL path schema. Sadly not all do and some don't even expose tar.gz files. I have a fix that changes how the function works so users must define the url path, naming scheme, etc.
  2. The mkCrate function generally works for private registries, but it will not work for git dependencies that have a dependency in a private registry. In the beginning of the runCommand instructions are two calls to cargo metadata that are pointed at the source Cargo.toml but will not find the .cargo/config.toml and therefore cannot find information about the registry-index.
18:05:21
@djacu:matrix.orgdjacu *

What's the desired avenue for discussing and submitting problems/fixes found within rustPlatform? I have found a few issues when dealing with private registries. I can provide more complete details but I'll share a short summary for now.

  1. The fetchCrate function in import-cargo-lock.nix assumes that all registry platforms follow the same URL path schema. Sadly not all do and some don't even expose tar.gz files. I have a fix that changes how the function works so users must define the url path, naming scheme, etc.
  2. The mkCrate function generally works for private registries, but it will not work for git dependencies that have a dependency in a private registry. In the beginning of the runCommand instructions are two calls to cargo metadata that are pointed at the source Cargo.toml but will not find the .cargo/config.toml and therefore cannot find information about the registry-index.
18:05:32
@tomasajt:matrix.orgToma

IMO opening an nixpkgs issue with some details is fine

btw I had a TODO for fetchCargoVendor to add a way to deduce the download URL schema from the registry url.
I think there is some dl key that can be fetched through some API.

(but first we have to figure out how under what directory should we store files fetched from non-standard registries)

19:01:23

Show newer messages


Back to Room ListRoom Version: 6