Skip to content

rustPlatform.buildRustPackage: fix cargoDeps inherited attribute overriding#435239

Open
ShamrockLee wants to merge 1 commit intoNixOS:masterfrom
ShamrockLee:build-rust-package-overriding-pre
Open

rustPlatform.buildRustPackage: fix cargoDeps inherited attribute overriding#435239
ShamrockLee wants to merge 1 commit intoNixOS:masterfrom
ShamrockLee:build-rust-package-overriding-pre

Conversation

@ShamrockLee
Copy link
Contributor

@ShamrockLee ShamrockLee commented Aug 20, 2025

Make .cargoDeps reference the overridden .src and other attributes.

Make Rust package overriding possible before making further design decisions about the <pkg>.overrideAttrs interface.

This is an initial effort to fixe #415397

This PR depends on:

After rebasing onto it, this PR should cause no rebuild.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. labels Aug 20, 2025
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/is-it-possible-to-override-cargosha256-in-buildrustpackage/4393/28

@ShamrockLee ShamrockLee changed the title rustPlatform.buildRustPackage: fix cargoDeps inherited attribute over… rustPlatform.buildRustPackage: fix cargoDeps inherited attribute overriding Aug 20, 2025
@ShamrockLee
Copy link
Contributor Author

@ofborg build lixStatic
@ofborg build nnd
@ofborg build scuba
@ofborg build tests.fetchtorrent.http-link-rqbit tests.fetchtorrent.http-link-rqbit-flattened
tests.fetchtorrent.http-link-rqbit-unflattened tests.fetchtorrent.magnet-link-rqbit tests.fetchtorrent.magnet-link-rqbit-flattened tests.fetchtorrent.magnet-link-rqbit-unflattened

@ShamrockLee
Copy link
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 435239
Commit: eb0312ede099f36e2a390c4f85ff940950c3bf2c


x86_64-linux

❌ 2 packages failed to build:
  • lixStatic
  • lixStatic.dev
✅ 7 packages built:
  • nnd
  • scuba
  • scuba.dist
  • tests.fetchtorrent.http-link-rqbit (tests.fetchtorrent.http-link-rqbit-flattened)
  • tests.fetchtorrent.http-link-rqbit-unflattened
  • tests.fetchtorrent.magnet-link-rqbit (tests.fetchtorrent.magnet-link-rqbit-flattened)
  • tests.fetchtorrent.magnet-link-rqbit-unflattened

Error logs: `x86_64-linux`
lixStatic
collect2: error: ld returned 1 exit status
[321/325] x86_64-unknown-linux-musl-g++ -Itests/unit/liblixmain-tests.p -Itests/unit -I../tests/unit -Isrc/libmain -I../src/libmain -Isrc/libexpr -I../src/libexpr -Isrc/libutil -I../src/libutil -Isrc/libstore -I../src/libstore -fdiagnostics-color=always -fpch-preprocess -include precompiled-headers.hh -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++2a -O2 -g -DLOWDOWN_SEPARATE_TERM_OPTS -include config.h -Wno-deprecated-declarations -Wimplicit-fallthrough -Werror=switch -Werror=switch-enum -Werror=unused-result -Wdeprecated-copy -Wignored-qualifiers -Werror=suggest-override -D_GLIBCXX_ASSERTIONS=1 -fsanitize=signed-integer-overflow -fsanitize-undefined-trap-on-error -ffile-prefix-map=../src=src -DBOOST_CONTAINER_STATIC_LINK=1 -DBOOST_ALL_NO_LIB -DGTEST_HAS_PTHREAD=1 -MD -MQ tests/unit/liblixmain-tests.p/libmain_progress-bar.cc.o -MF tests/unit/liblixmain-tests.p/libmain_progress-bar.cc.o.d -o tests/unit/liblixmain-tests.p/libmain_progress-bar.cc.o -c ../tests/unit/libmain/progress-bar.cc
In file included from ../src/libutil/types.hh:4,
                 from ../src/libexpr/symbol-table.hh:8,
                 from ../src/libexpr/value.hh:11,
                 from ../src/libexpr/nixexpr.hh:7,
                 from ../src/libexpr/attr-set.hh:4,
                 from ../src/libexpr/eval.hh:4,
                 from ../tests/unit/libmain/progress-bar.cc:3:
../src/libutil/ref.hh:28:20: warning: template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor]
   28 |     explicit ref(const std::shared_ptr & p)
      |                    ^
../src/libutil/ref.hh:28:20: note: remove the '< >'
../src/libutil/ref.hh:35:21: warning: template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor]
   35 |     explicit ref(T * p)
      |                     ^
../src/libutil/ref.hh:35:21: note: remove the '< >'
[322/325] x86_64-unknown-linux-musl-g++  -o tests/unit/liblixstore-tests tests/unit/liblixstore-tests.p/libstore_common-protocol.cc.o tests/unit/liblixstore-tests.p/libstore_derivation.cc.o tests/unit/liblixstore-tests.p/libstore_derived-path.cc.o tests/unit/liblixstore-tests.p/libstore_downstream-placeholder.cc.o tests/unit/liblixstore-tests.p/libstore_filetransfer.cc.o tests/unit/liblixstore-tests.p/libstore_machines.cc.o tests/unit/liblixstore-tests.p/libstore_nar-info-disk-cache.cc.o tests/unit/liblixstore-tests.p/libstore_outputs-spec.cc.o tests/unit/liblixstore-tests.p/libstore_path.cc.o tests/unit/liblixstore-tests.p/libstore_references.cc.o tests/unit/liblixstore-tests.p/libstore_serve-protocol.cc.o tests/unit/liblixstore-tests.p/libstore_worker-protocol.cc.o -Wl,--as-needed -Wl,--no-undefined -Wl,--whole-archive -Wl,--start-group src/liblibasanoptions.a src/libstore/liblixstore.a -Wl,--no-whole-archive -fsanitize=signed-integer-overflow -fsanitize-undefined-trap-on-error -pthread -Wl,--no-copy-dt-needed-entries tests/unit/liblixstore-test-support.a tests/unit/liblixutil-test-support.a src/libutil/liblixutil.a src/libexpr/liblixexpr.a src/libfetchers/liblixfetchers.a -lrapidcheck /nix/store/9j1ng3qx0hwahp6hglkbc0c4m9pc7vnc-gtest-static-x86_64-unknown-linux-musl-1.17.0/lib/libgtest.a /nix/store/9j1ng3qx0hwahp6hglkbc0c4m9pc7vnc-gtest-static-x86_64-unknown-linux-musl-1.17.0/lib/libgtest_main.a /nix/store/9j1ng3qx0hwahp6hglkbc0c4m9pc7vnc-gtest-static-x86_64-unknown-linux-musl-1.17.0/lib/libgmock.a /nix/store/9j1ng3qx0hwahp6hglkbc0c4m9pc7vnc-gtest-static-x86_64-unknown-linux-musl-1.17.0/lib/libgmock_main.a -lrapidcheck /nix/store/xalxwybk1gn1gmi7mi45qrdvpkidndb0-boehm-gc-static-x86_64-unknown-linux-musl-8.2.8/lib/libgc.a -lpthread -ldl -lrapidcheck /nix/store/mmgd3ff3bkzqp1v25w9mw0hzrb77nql5-boost-static-x86_64-unknown-linux-musl-1.87.0/lib/libboost_container.a /nix/store/w9024j0i1l2p1wp0zlxzmcn9zcs203ic-libcpuid-static-x86_64-unknown-linux-musl-0.8.0/lib/libcpuid.a /nix/store/g12lm22lmymf4rdj5v1h9irwr95pqk77-libseccomp-static-x86_64-unknown-linux-musl-2.6.0-lib/lib/libseccomp.a /nix/store/b5r4hw3gsb9db785l867mr8ckflkchjg-libarchive-static-x86_64-unknown-linux-musl-3.8.1-lib/lib/libarchive.a /nix/store/sp6d6xjc541vd0dvyi7h4wy1fx1yy2q1-openssl-static-x86_64-unknown-linux-musl-3.5.1/lib/libcrypto.a /nix/store/x4hsb41rjhfxsl2s22mdni3g69ig17w2-xz-static-x86_64-unknown-linux-musl-5.8.1/lib/liblzma.a /nix/store/54qzw5h35186a8bb02fb3x8nalszhpi5-libxml2-static-x86_64-unknown-linux-musl-2.14.4-unstable-2025-06-20/lib/libxml2.a -lm -L/nix/store/sp6d6xjc541vd0dvyi7h4wy1fx1yy2q1-openssl-static-x86_64-unknown-linux-musl-3.5.1/lib -L/nix/store/b5r4hw3gsb9db785l867mr8ckflkchjg-libarchive-static-x86_64-unknown-linux-musl-3.8.1-lib/lib -L/nix/store/x4hsb41rjhfxsl2s22mdni3g69ig17w2-xz-static-x86_64-unknown-linux-musl-5.8.1/lib -L/nix/store/54qzw5h35186a8bb02fb3x8nalszhpi5-libxml2-static-x86_64-unknown-linux-musl-2.14.4-unstable-2025-06-20/lib -lacl -lzstd -lbz2 -lz /nix/store/623b15b6p3qi3x0b7lrmz3invd57qix4-brotli-static-x86_64-unknown-linux-musl-1.1.0-lib/lib/libbrotlicommon.a /nix/store/623b15b6p3qi3x0b7lrmz3invd57qix4-brotli-static-x86_64-unknown-linux-musl-1.1.0-lib/lib/libbrotlidec.a /nix/store/623b15b6p3qi3x0b7lrmz3invd57qix4-brotli-static-x86_64-unknown-linux-musl-1.1.0-lib/lib/libbrotlienc.a -L/nix/store/sp6d6xjc541vd0dvyi7h4wy1fx1yy2q1-openssl-static-x86_64-unknown-linux-musl-3.5.1/lib -L/nix/store/b5r4hw3gsb9db785l867mr8ckflkchjg-libarchive-static-x86_64-unknown-linux-musl-3.8.1-lib/lib -L/nix/store/x4hsb41rjhfxsl2s22mdni3g69ig17w2-xz-static-x86_64-unknown-linux-musl-5.8.1/lib -L/nix/store/54qzw5h35186a8bb02fb3x8nalszhpi5-libxml2-static-x86_64-unknown-linux-musl-2.14.4-unstable-2025-06-20/lib -lacl -lzstd -lbz2 -lz /nix/store/3ckxla4d8hsx7mb4mdn5y0chg8d7qzy3-sqlite-static-x86_64-unknown-linux-musl-3.50.2/lib/libsqlite3.a -L/nix/store/3ckxla4d8hsx7mb4mdn5y0chg8d7qzy3-sqlite-static-x86_64-unknown-linux-musl-3.50.2/lib -lz /nix/store/z9n2156vfm07nycrcd7z04sjgdypijkf-libsodium-static-x86_64-unknown-linux-musl-1.0.20/lib/libsodium.a /nix/store/qiamim7zrjv4dj1pwx4gmpyr52xsf2l7-curl-static-x86_64-unknown-linux-musl-8.14.1/lib/libcurl.a /nix/store/xs5z9i17ns2na47kfyv3x7la3kqyachz-nghttp2-static-x86_64-unknown-linux-musl-1.65.0-lib/lib/libnghttp2.a /nix/store/a83k8yhkk5r77bw7590j9vc1lg06l1w8-libidn2-static-x86_64-unknown-linux-musl-2.3.8/lib/libidn2.a /nix/store/mvdkgbwcac1k0p1zqqaq6v3apm4sp2bq-libssh2-static-x86_64-unknown-linux-musl-1.11.1/lib/libssh2.a /nix/store/17xy7m7lh883jx5xpm1ld0zhgp8w71c6-libpsl-static-x86_64-unknown-linux-musl-0.21.5/lib/libpsl.a /nix/store/sp6d6xjc541vd0dvyi7h4wy1fx1yy2q1-openssl-static-x86_64-unknown-linux-musl-3.5.1/lib/libssl.a /nix/store/40kja02wfnw1gdlrcyh75c7x7iibrwvn-zstd-static-x86_64-unknown-linux-musl-1.5.7/lib/libzstd.a /nix/store/8r4xf3v70mqdl8f3jy1y5zjgwrd4x4ym-zlib-static-x86_64-unknown-linux-musl-1.3.1/lib/libz.a -L/nix/store/8r4xf3v70mqdl8f3jy1y5zjgwrd4x4ym-zlib-static-x86_64-unknown-linux-musl-1.3.1/lib -L/nix/store/40kja02wfnw1gdlrcyh75c7x7iibrwvn-zstd-static-x86_64-unknown-linux-musl-1.5.7/lib -L/nix/store/qiamim7zrjv4dj1pwx4gmpyr52xsf2l7-curl-static-x86_64-unknown-linux-musl-8.14.1/lib -L/nix/store/sp6d6xjc541vd0dvyi7h4wy1fx1yy2q1-openssl-static-x86_64-unknown-linux-musl-3.5.1/lib -L/nix/store/17xy7m7lh883jx5xpm1ld0zhgp8w71c6-libpsl-static-x86_64-unknown-linux-musl-0.21.5/lib -L/nix/store/a83k8yhkk5r77bw7590j9vc1lg06l1w8-libidn2-static-x86_64-unknown-linux-musl-2.3.8/lib -L/nix/store/xs5z9i17ns2na47kfyv3x7la3kqyachz-nghttp2-static-x86_64-unknown-linux-musl-1.65.0-lib/lib -L/nix/store/mvdkgbwcac1k0p1zqqaq6v3apm4sp2bq-libssh2-static-x86_64-unknown-linux-musl-1.11.1/lib -L/nix/store/rr598iz9x2p5ll8l97mm7pkgdbqmcsl9-libssh2-static-x86_64-unknown-linux-musl-1.11.1-dev/lib -lunistring -Wl,--end-group
[323/325] x86_64-unknown-linux-musl-g++  -o tests/unit/liblixexpr-tests tests/unit/liblixexpr-tests.p/libexpr_derived-path.cc.o tests/unit/liblixexpr-tests.p/libexpr_error_traces.cc.o tests/unit/liblixexpr-tests.p/libexpr_flakeref.cc.o tests/unit/liblixexpr-tests.p/libexpr_json.cc.o tests/unit/liblixexpr-tests.p/libexpr_primops.cc.o tests/unit/liblixexpr-tests.p/libexpr_search-path.cc.o tests/unit/liblixexpr-tests.p/libexpr_trivial.cc.o tests/unit/liblixexpr-tests.p/libexpr_expr-print.cc.o tests/unit/liblixexpr-tests.p/libexpr_value_context.cc.o tests/unit/liblixexpr-tests.p/libexpr_value_print.cc.o -Wl,--as-needed -Wl,--no-undefined -Wl,--whole-archive -Wl,--start-group src/liblibasanoptions.a src/libstore/liblixstore.a src/libexpr/liblixexpr.a src/libfetchers/liblixfetchers.a -Wl,--no-whole-archive -fsanitize=signed-integer-overflow -fsanitize-undefined-trap-on-error -pthread -Wl,--no-copy-dt-needed-entries tests/unit/liblixexpr-test-support.a tests/unit/liblixstore-test-support.a tests/unit/liblixutil-test-support.a src/libutil/liblixutil.a -lrapidcheck /nix/store/xalxwybk1gn1gmi7mi45qrdvpkidndb0-boehm-gc-static-x86_64-unknown-linux-musl-8.2.8/lib/libgc.a -lpthread -ldl /nix/store/9j1ng3qx0hwahp6hglkbc0c4m9pc7vnc-gtest-static-x86_64-unknown-linux-musl-1.17.0/lib/libgtest.a /nix/store/9j1ng3qx0hwahp6hglkbc0c4m9pc7vnc-gtest-static-x86_64-unknown-linux-musl-1.17.0/lib/libgtest_main.a /nix/store/9j1ng3qx0hwahp6hglkbc0c4m9pc7vnc-gtest-static-x86_64-unknown-linux-musl-1.17.0/lib/libgmock.a /nix/store/9j1ng3qx0hwahp6hglkbc0c4m9pc7vnc-gtest-static-x86_64-unknown-linux-musl-1.17.0/lib/libgmock_main.a -lrapidcheck -lrapidcheck -lrapidcheck /nix/store/mmgd3ff3bkzqp1v25w9mw0hzrb77nql5-boost-static-x86_64-unknown-linux-musl-1.87.0/lib/libboost_container.a /nix/store/w9024j0i1l2p1wp0zlxzmcn9zcs203ic-libcpuid-static-x86_64-unknown-linux-musl-0.8.0/lib/libcpuid.a /nix/store/g12lm22lmymf4rdj5v1h9irwr95pqk77-libseccomp-static-x86_64-unknown-linux-musl-2.6.0-lib/lib/libseccomp.a /nix/store/b5r4hw3gsb9db785l867mr8ckflkchjg-libarchive-static-x86_64-unknown-linux-musl-3.8.1-lib/lib/libarchive.a /nix/store/sp6d6xjc541vd0dvyi7h4wy1fx1yy2q1-openssl-static-x86_64-unknown-linux-musl-3.5.1/lib/libcrypto.a /nix/store/x4hsb41rjhfxsl2s22mdni3g69ig17w2-xz-static-x86_64-unknown-linux-musl-5.8.1/lib/liblzma.a /nix/store/54qzw5h35186a8bb02fb3x8nalszhpi5-libxml2-static-x86_64-unknown-linux-musl-2.14.4-unstable-2025-06-20/lib/libxml2.a -lm -L/nix/store/sp6d6xjc541vd0dvyi7h4wy1fx1yy2q1-openssl-static-x86_64-unknown-linux-musl-3.5.1/lib -L/nix/store/b5r4hw3gsb9db785l867mr8ckflkchjg-libarchive-static-x86_64-unknown-linux-musl-3.8.1-lib/lib -L/nix/store/x4hsb41rjhfxsl2s22mdni3g69ig17w2-xz-static-x86_64-unknown-linux-musl-5.8.1/lib -L/nix/store/54qzw5h35186a8bb02fb3x8nalszhpi5-libxml2-static-x86_64-unknown-linux-musl-2.14.4-unstable-2025-06-20/lib -lacl -lzstd -lbz2 -lz /nix/store/623b15b6p3qi3x0b7lrmz3invd57qix4-brotli-static-x86_64-unknown-linux-musl-1.1.0-lib/lib/libbrotlicommon.a /nix/store/623b15b6p3qi3x0b7lrmz3invd57qix4-brotli-static-x86_64-unknown-linux-musl-1.1.0-lib/lib/libbrotlidec.a /nix/store/623b15b6p3qi3x0b7lrmz3invd57qix4-brotli-static-x86_64-unknown-linux-musl-1.1.0-lib/lib/libbrotlienc.a -L/nix/store/sp6d6xjc541vd0dvyi7h4wy1fx1yy2q1-openssl-static-x86_64-unknown-linux-musl-3.5.1/lib -L/nix/store/b5r4hw3gsb9db785l867mr8ckflkchjg-libarchive-static-x86_64-unknown-linux-musl-3.8.1-lib/lib -L/nix/store/x4hsb41rjhfxsl2s22mdni3g69ig17w2-xz-static-x86_64-unknown-linux-musl-5.8.1/lib -L/nix/store/54qzw5h35186a8bb02fb3x8nalszhpi5-libxml2-static-x86_64-unknown-linux-musl-2.14.4-unstable-2025-06-20/lib -lacl -lzstd -lbz2 -lz /nix/store/3ckxla4d8hsx7mb4mdn5y0chg8d7qzy3-sqlite-static-x86_64-unknown-linux-musl-3.50.2/lib/libsqlite3.a -L/nix/store/3ckxla4d8hsx7mb4mdn5y0chg8d7qzy3-sqlite-static-x86_64-unknown-linux-musl-3.50.2/lib -lz /nix/store/z9n2156vfm07nycrcd7z04sjgdypijkf-libsodium-static-x86_64-unknown-linux-musl-1.0.20/lib/libsodium.a /nix/store/qiamim7zrjv4dj1pwx4gmpyr52xsf2l7-curl-static-x86_64-unknown-linux-musl-8.14.1/lib/libcurl.a /nix/store/xs5z9i17ns2na47kfyv3x7la3kqyachz-nghttp2-static-x86_64-unknown-linux-musl-1.65.0-lib/lib/libnghttp2.a /nix/store/a83k8yhkk5r77bw7590j9vc1lg06l1w8-libidn2-static-x86_64-unknown-linux-musl-2.3.8/lib/libidn2.a /nix/store/mvdkgbwcac1k0p1zqqaq6v3apm4sp2bq-libssh2-static-x86_64-unknown-linux-musl-1.11.1/lib/libssh2.a /nix/store/17xy7m7lh883jx5xpm1ld0zhgp8w71c6-libpsl-static-x86_64-unknown-linux-musl-0.21.5/lib/libpsl.a /nix/store/sp6d6xjc541vd0dvyi7h4wy1fx1yy2q1-openssl-static-x86_64-unknown-linux-musl-3.5.1/lib/libssl.a /nix/store/40kja02wfnw1gdlrcyh75c7x7iibrwvn-zstd-static-x86_64-unknown-linux-musl-1.5.7/lib/libzstd.a /nix/store/8r4xf3v70mqdl8f3jy1y5zjgwrd4x4ym-zlib-static-x86_64-unknown-linux-musl-1.3.1/lib/libz.a -L/nix/store/8r4xf3v70mqdl8f3jy1y5zjgwrd4x4ym-zlib-static-x86_64-unknown-linux-musl-1.3.1/lib -L/nix/store/40kja02wfnw1gdlrcyh75c7x7iibrwvn-zstd-static-x86_64-unknown-linux-musl-1.5.7/lib -L/nix/store/qiamim7zrjv4dj1pwx4gmpyr52xsf2l7-curl-static-x86_64-unknown-linux-musl-8.14.1/lib -L/nix/store/sp6d6xjc541vd0dvyi7h4wy1fx1yy2q1-openssl-static-x86_64-unknown-linux-musl-3.5.1/lib -L/nix/store/17xy7m7lh883jx5xpm1ld0zhgp8w71c6-libpsl-static-x86_64-unknown-linux-musl-0.21.5/lib -L/nix/store/a83k8yhkk5r77bw7590j9vc1lg06l1w8-libidn2-static-x86_64-unknown-linux-musl-2.3.8/lib -L/nix/store/xs5z9i17ns2na47kfyv3x7la3kqyachz-nghttp2-static-x86_64-unknown-linux-musl-1.65.0-lib/lib -L/nix/store/mvdkgbwcac1k0p1zqqaq6v3apm4sp2bq-libssh2-static-x86_64-unknown-linux-musl-1.11.1/lib -L/nix/store/rr598iz9x2p5ll8l97mm7pkgdbqmcsl9-libssh2-static-x86_64-unknown-linux-musl-1.11.1-dev/lib -lunistring -Wl,--end-group
ninja: build stopped: subcommand failed.

@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented Aug 20, 2025

lixStatic build failed on my machine

[320/325] x86_64-unknown-linux-musl-g++  -o src/nix/nix src/nix/nix.p/add-to-store.cc.o src/nix/nix.p/app.cc.o src/nix/nix.p/build.cc.o src/nix/nix.p/bundle.cc.o src/nix/nix.p/cat.cc.o src/nix/nix.p/copy.cc.o src/nix/nix.p/daemon.cc.o src/nix/nix.p/derivation-add.cc.o src/nix/nix.p/derivation-show.cc.o src/nix/nix.p/derivation.cc.o src/nix/nix.p/develop.cc.o src/nix/nix.p/diff-closures.cc.o src/nix/nix.p/doctor.cc.o src/nix/nix.p/dump-path.cc.o src/nix/nix.p/edit.cc.o src/nix/nix.p/eval.cc.o src/nix/nix.p/flake.cc.o src/nix/nix.p/fmt.cc.o src/nix/nix.p/hash.cc.o src/nix/nix.p/log.cc.o src/nix/nix.p/ls.cc.o src/nix/nix.p/main.cc.o src/nix/nix.p/make-content-addressed.cc.o src/nix/nix.p/nar.cc.o src/nix/nix.p/optimise-store.cc.o src/nix/nix.p/path-from-hash-part.cc.o src/nix/nix.p/path-info.cc.o src/nix/nix.p/ping-store.cc.o src/nix/nix.p/prefetch.cc.o src/nix/nix.p/profile.cc.o src/nix/nix.p/realisation.cc.o src/nix/nix.p/registry.cc.o src/nix/nix.p/repl.cc.o src/nix/nix.p/run.cc.o src/nix/nix.p/search.cc.o src/nix/nix.p/config.cc.o src/nix/nix.p/sigs.cc.o src/nix/nix.p/store-copy-log.cc.o src/nix/nix.p/store-delete.cc.o src/nix/nix.p/store-gc.cc.o src/nix/nix.p/store-repair.cc.o src/nix/nix.p/store.cc.o src/nix/nix.p/upgrade-nix.cc.o src/nix/nix.p/verify.cc.o src/nix/nix.p/why-depends.cc.o src/nix/nix.p/.._build-remote_build-remote.cc.o src/nix/nix.p/.._nix-build_nix-build.cc.o src/nix/nix.p/.._nix-channel_nix-channel.cc.o src/nix/nix.p/.._nix-collect-garbage_nix-collect-garbage.cc.o src/nix/nix.p/.._nix-copy-closure_nix-copy-closure.cc.o src/nix/nix.p/.._nix-env_nix-env.cc.o src/nix/nix.p/.._nix-env_user-env.cc.o src/nix/nix.p/.._nix-instantiate_nix-instantiate.cc.o src/nix/nix.p/.._nix-store_dotgraph.cc.o src/nix/nix.p/.._nix-store_graphml.cc.o src/nix/nix.p/.._nix-store_nix-store.cc.o -Wl,--as-needed -Wl,--no-undefined -Wl,--whole-archive -Wl,--start-group src/liblibasanoptions.a src/libutil/liblixutil.a src/libstore/liblixstore.a src/libexpr/liblixexpr.a src/libfetchers/liblixfetchers.a -Wl,--no-whole-archive -fsanitize=signed-integer-overflow -fsanitize-undefined-trap-on-error -pthread -Wl,--no-copy-dt-needed-entries -Wl,-rpath,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX src/libcmd/liblixcmd.a src/libmain/liblixmain.a /nix/store/xalxwybk1gn1gmi7mi45qrdvpkidndb0-boehm-gc-static-x86_64-unknown-linux-musl-8.2.8/lib/libgc.a -lpthread -ldl /nix/store/xvwkab4bym338r29hqabhnh45ab6lp9c-editline-static-x86_64-unknown-linux-musl-1.17.1/lib/libeditline.a /nix/store/i571p6fapdkp2mlarjbkfqcpgbcjr4fq-lowdown-static-x86_64-unknown-linux-musl-2.0.2-lib/lib/liblowdown.a -lm -llix_doc /nix/store/mmgd3ff3bkzqp1v25w9mw0hzrb77nql5-boost-static-x86_64-unknown-linux-musl-1.87.0/lib/libboost_container.a /nix/store/w9024j0i1l2p1wp0zlxzmcn9zcs203ic-libcpuid-static-x86_64-unknown-linux-musl-0.8.0/lib/libcpuid.a /nix/store/g12lm22lmymf4rdj5v1h9irwr95pqk77-libseccomp-static-x86_64-unknown-linux-musl-2.6.0-lib/lib/libseccomp.a /nix/store/b5r4hw3gsb9db785l867mr8ckflkchjg-libarchive-static-x86_64-unknown-linux-musl-3.8.1-lib/lib/libarchive.a /nix/store/sp6d6xjc541vd0dvyi7h4wy1fx1yy2q1-openssl-static-x86_64-unknown-linux-musl-3.5.1/lib/libcrypto.a /nix/store/x4hsb41rjhfxsl2s22mdni3g69ig17w2-xz-static-x86_64-unknown-linux-musl-5.8.1/lib/liblzma.a /nix/store/54qzw5h35186a8bb02fb3x8nalszhpi5-libxml2-static-x86_64-unknown-linux-musl-2.14.4-unstable-2025-06-20/lib/libxml2.a -L/nix/store/sp6d6xjc541vd0dvyi7h4wy1fx1yy2q1-openssl-static-x86_64-unknown-linux-musl-3.5.1/lib -L/nix/store/b5r4hw3gsb9db785l867mr8ckflkchjg-libarchive-static-x86_64-unknown-linux-musl-3.8.1-lib/lib -L/nix/store/x4hsb41rjhfxsl2s22mdni3g69ig17w2-xz-static-x86_64-unknown-linux-musl-5.8.1/lib -L/nix/store/54qzw5h35186a8bb02fb3x8nalszhpi5-libxml2-static-x86_64-unknown-linux-musl-2.14.4-unstable-2025-06-20/lib -lacl -lzstd -lbz2 -lz /nix/store/623b15b6p3qi3x0b7lrmz3invd57qix4-brotli-static-x86_64-unknown-linux-musl-1.1.0-lib/lib/libbrotlicommon.a /nix/store/623b15b6p3qi3x0b7lrmz3invd57qix4-brotli-static-x86_64-unknown-linux-musl-1.1.0-lib/lib/libbrotlidec.a /nix/store/623b15b6p3qi3x0b7lrmz3invd57qix4-brotli-static-x86_64-unknown-linux-musl-1.1.0-lib/lib/libbrotlienc.a -L/nix/store/sp6d6xjc541vd0dvyi7h4wy1fx1yy2q1-openssl-static-x86_64-unknown-linux-musl-3.5.1/lib -L/nix/store/b5r4hw3gsb9db785l867mr8ckflkchjg-libarchive-static-x86_64-unknown-linux-musl-3.8.1-lib/lib -L/nix/store/x4hsb41rjhfxsl2s22mdni3g69ig17w2-xz-static-x86_64-unknown-linux-musl-5.8.1/lib -L/nix/store/54qzw5h35186a8bb02fb3x8nalszhpi5-libxml2-static-x86_64-unknown-linux-musl-2.14.4-unstable-2025-06-20/lib -lacl -lzstd -lbz2 -lz /nix/store/3ckxla4d8hsx7mb4mdn5y0chg8d7qzy3-sqlite-static-x86_64-unknown-linux-musl-3.50.2/lib/libsqlite3.a -L/nix/store/3ckxla4d8hsx7mb4mdn5y0chg8d7qzy3-sqlite-static-x86_64-unknown-linux-musl-3.50.2/lib -lz /nix/store/z9n2156vfm07nycrcd7z04sjgdypijkf-libsodium-static-x86_64-unknown-linux-musl-1.0.20/lib/libsodium.a /nix/store/qiamim7zrjv4dj1pwx4gmpyr52xsf2l7-curl-static-x86_64-unknown-linux-musl-8.14.1/lib/libcurl.a /nix/store/xs5z9i17ns2na47kfyv3x7la3kqyachz-nghttp2-static-x86_64-unknown-linux-musl-1.65.0-lib/lib/libnghttp2.a /nix/store/a83k8yhkk5r77bw7590j9vc1lg06l1w8-libidn2-static-x86_64-unknown-linux-musl-2.3.8/lib/libidn2.a /nix/store/mvdkgbwcac1k0p1zqqaq6v3apm4sp2bq-libssh2-static-x86_64-unknown-linux-musl-1.11.1/lib/libssh2.a /nix/store/17xy7m7lh883jx5xpm1ld0zhgp8w71c6-libpsl-static-x86_64-unknown-linux-musl-0.21.5/lib/libpsl.a /nix/store/sp6d6xjc541vd0dvyi7h4wy1fx1yy2q1-openssl-static-x86_64-unknown-linux-musl-3.5.1/lib/libssl.a /nix/store/40kja02wfnw1gdlrcyh75c7x7iibrwvn-zstd-static-x86_64-unknown-linux-musl-1.5.7/lib/libzstd.a /nix/store/8r4xf3v70mqdl8f3jy1y5zjgwrd4x4ym-zlib-static-x86_64-unknown-linux-musl-1.3.1/lib/libz.a -L/nix/store/8r4xf3v70mqdl8f3jy1y5zjgwrd4x4ym-zlib-static-x86_64-unknown-linux-musl-1.3.1/lib -L/nix/store/40kja02wfnw1gdlrcyh75c7x7iibrwvn-zstd-static-x86_64-unknown-linux-musl-1.5.7/lib -L/nix/store/qiamim7zrjv4dj1pwx4gmpyr52xsf2l7-curl-static-x86_64-unknown-linux-musl-8.14.1/lib -L/nix/store/sp6d6xjc541vd0dvyi7h4wy1fx1yy2q1-openssl-static-x86_64-unknown-linux-musl-3.5.1/lib -L/nix/store/17xy7m7lh883jx5xpm1ld0zhgp8w71c6-libpsl-static-x86_64-unknown-linux-musl-0.21.5/lib -L/nix/store/a83k8yhkk5r77bw7590j9vc1lg06l1w8-libidn2-static-x86_64-unknown-linux-musl-2.3.8/lib -L/nix/store/xs5z9i17ns2na47kfyv3x7la3kqyachz-nghttp2-static-x86_64-unknown-linux-musl-1.65.0-lib/lib -L/nix/store/mvdkgbwcac1k0p1zqqaq6v3apm4sp2bq-libssh2-static-x86_64-unknown-linux-musl-1.11.1/lib -L/nix/store/rr598iz9x2p5ll8l97mm7pkgdbqmcsl9-libssh2-static-x86_64-unknown-linux-musl-1.11.1-dev/lib -lunistring -Wl,--end-group
FAILED: src/nix/nix 
x86_64-unknown-linux-musl-g++  -o src/nix/nix src/nix/nix.p/add-to-store.cc.o src/nix/nix.p/app.cc.o src/nix/nix.p/build.cc.o src/nix/nix.p/bundle.cc.o src/nix/nix.p/cat.cc.o src/nix/nix.p/copy.cc.o src/nix/nix.p/daemon.cc.o src/nix/nix.p/derivation-add.cc.o src/nix/nix.p/derivation-show.cc.o src/nix/nix.p/derivation.cc.o src/nix/nix.p/develop.cc.o src/nix/nix.p/diff-closures.cc.o src/nix/nix.p/doctor.cc.o src/nix/nix.p/dump-path.cc.o src/nix/nix.p/edit.cc.o src/nix/nix.p/eval.cc.o src/nix/nix.p/flake.cc.o src/nix/nix.p/fmt.cc.o src/nix/nix.p/hash.cc.o src/nix/nix.p/log.cc.o src/nix/nix.p/ls.cc.o src/nix/nix.p/main.cc.o src/nix/nix.p/make-content-addressed.cc.o src/nix/nix.p/nar.cc.o src/nix/nix.p/optimise-store.cc.o src/nix/nix.p/path-from-hash-part.cc.o src/nix/nix.p/path-info.cc.o src/nix/nix.p/ping-store.cc.o src/nix/nix.p/prefetch.cc.o src/nix/nix.p/profile.cc.o src/nix/nix.p/realisation.cc.o src/nix/nix.p/registry.cc.o src/nix/nix.p/repl.cc.o src/nix/nix.p/run.cc.o src/nix/nix.p/search.cc.o src/nix/nix.p/config.cc.o src/nix/nix.p/sigs.cc.o src/nix/nix.p/store-copy-log.cc.o src/nix/nix.p/store-delete.cc.o src/nix/nix.p/store-gc.cc.o src/nix/nix.p/store-repair.cc.o src/nix/nix.p/store.cc.o src/nix/nix.p/upgrade-nix.cc.o src/nix/nix.p/verify.cc.o src/nix/nix.p/why-depends.cc.o src/nix/nix.p/.._build-remote_build-remote.cc.o src/nix/nix.p/.._nix-build_nix-build.cc.o src/nix/nix.p/.._nix-channel_nix-channel.cc.o src/nix/nix.p/.._nix-collect-garbage_nix-collect-garbage.cc.o src/nix/nix.p/.._nix-copy-closure_nix-copy-closure.cc.o src/nix/nix.p/.._nix-env_nix-env.cc.o src/nix/nix.p/.._nix-env_user-env.cc.o src/nix/nix.p/.._nix-instantiate_nix-instantiate.cc.o src/nix/nix.p/.._nix-store_dotgraph.cc.o src/nix/nix.p/.._nix-store_graphml.cc.o src/nix/nix.p/.._nix-store_nix-store.cc.o -Wl,--as-needed -Wl,--no-undefined -Wl,--whole-archive -Wl,--start-group src/liblibasanoptions.a src/libutil/liblixutil.a src/libstore/liblixstore.a src/libexpr/liblixexpr.a src/libfetchers/liblixfetchers.a -Wl,--no-whole-archive -fsanitize=signed-integer-overflow -fsanitize-undefined-trap-on-error -pthread -Wl,--no-copy-dt-needed-entries -Wl,-rpath,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX src/libcmd/liblixcmd.a src/libmain/liblixmain.a /nix/store/xalxwybk1gn1gmi7mi45qrdvpkidndb0-boehm-gc-static-x86_64-unknown-linux-musl-8.2.8/lib/libgc.a -lpthread -ldl /nix/store/xvwkab4bym338r29hqabhnh45ab6lp9c-editline-static-x86_64-unknown-linux-musl-1.17.1/lib/libeditline.a /nix/store/i571p6fapdkp2mlarjbkfqcpgbcjr4fq-lowdown-static-x86_64-unknown-linux-musl-2.0.2-lib/lib/liblowdown.a -lm -llix_doc /nix/store/mmgd3ff3bkzqp1v25w9mw0hzrb77nql5-boost-static-x86_64-unknown-linux-musl-1.87.0/lib/libboost_container.a /nix/store/w9024j0i1l2p1wp0zlxzmcn9zcs203ic-libcpuid-static-x86_64-unknown-linux-musl-0.8.0/lib/libcpuid.a /nix/store/g12lm22lmymf4rdj5v1h9irwr95pqk77-libseccomp-static-x86_64-unknown-linux-musl-2.6.0-lib/lib/libseccomp.a /nix/store/b5r4hw3gsb9db785l867mr8ckflkchjg-libarchive-static-x86_64-unknown-linux-musl-3.8.1-lib/lib/libarchive.a /nix/store/sp6d6xjc541vd0dvyi7h4wy1fx1yy2q1-openssl-static-x86_64-unknown-linux-musl-3.5.1/lib/libcrypto.a /nix/store/x4hsb41rjhfxsl2s22mdni3g69ig17w2-xz-static-x86_64-unknown-linux-musl-5.8.1/lib/liblzma.a /nix/store/54qzw5h35186a8bb02fb3x8nalszhpi5-libxml2-static-x86_64-unknown-linux-musl-2.14.4-unstable-2025-06-20/lib/libxml2.a -L/nix/store/sp6d6xjc541vd0dvyi7h4wy1fx1yy2q1-openssl-static-x86_64-unknown-linux-musl-3.5.1/lib -L/nix/store/b5r4hw3gsb9db785l867mr8ckflkchjg-libarchive-static-x86_64-unknown-linux-musl-3.8.1-lib/lib -L/nix/store/x4hsb41rjhfxsl2s22mdni3g69ig17w2-xz-static-x86_64-unknown-linux-musl-5.8.1/lib -L/nix/store/54qzw5h35186a8bb02fb3x8nalszhpi5-libxml2-static-x86_64-unknown-linux-musl-2.14.4-unstable-2025-06-20/lib -lacl -lzstd -lbz2 -lz /nix/store/623b15b6p3qi3x0b7lrmz3invd57qix4-brotli-static-x86_64-unknown-linux-musl-1.1.0-lib/lib/libbrotlicommon.a /nix/store/623b15b6p3qi3x0b7lrmz3invd57qix4-brotli-static-x86_64-unknown-linux-musl-1.1.0-lib/lib/libbrotlidec.a /nix/store/623b15b6p3qi3x0b7lrmz3invd57qix4-brotli-static-x86_64-unknown-linux-musl-1.1.0-lib/lib/libbrotlienc.a -L/nix/store/sp6d6xjc541vd0dvyi7h4wy1fx1yy2q1-openssl-static-x86_64-unknown-linux-musl-3.5.1/lib -L/nix/store/b5r4hw3gsb9db785l867mr8ckflkchjg-libarchive-static-x86_64-unknown-linux-musl-3.8.1-lib/lib -L/nix/store/x4hsb41rjhfxsl2s22mdni3g69ig17w2-xz-static-x86_64-unknown-linux-musl-5.8.1/lib -L/nix/store/54qzw5h35186a8bb02fb3x8nalszhpi5-libxml2-static-x86_64-unknown-linux-musl-2.14.4-unstable-2025-06-20/lib -lacl -lzstd -lbz2 -lz /nix/store/3ckxla4d8hsx7mb4mdn5y0chg8d7qzy3-sqlite-static-x86_64-unknown-linux-musl-3.50.2/lib/libsqlite3.a -L/nix/store/3ckxla4d8hsx7mb4mdn5y0chg8d7qzy3-sqlite-static-x86_64-unknown-linux-musl-3.50.2/lib -lz /nix/store/z9n2156vfm07nycrcd7z04sjgdypijkf-libsodium-static-x86_64-unknown-linux-musl-1.0.20/lib/libsodium.a /nix/store/qiamim7zrjv4dj1pwx4gmpyr52xsf2l7-curl-static-x86_64-unknown-linux-musl-8.14.1/lib/libcurl.a /nix/store/xs5z9i17ns2na47kfyv3x7la3kqyachz-nghttp2-static-x86_64-unknown-linux-musl-1.65.0-lib/lib/libnghttp2.a /nix/store/a83k8yhkk5r77bw7590j9vc1lg06l1w8-libidn2-static-x86_64-unknown-linux-musl-2.3.8/lib/libidn2.a /nix/store/mvdkgbwcac1k0p1zqqaq6v3apm4sp2bq-libssh2-static-x86_64-unknown-linux-musl-1.11.1/lib/libssh2.a /nix/store/17xy7m7lh883jx5xpm1ld0zhgp8w71c6-libpsl-static-x86_64-unknown-linux-musl-0.21.5/lib/libpsl.a /nix/store/sp6d6xjc541vd0dvyi7h4wy1fx1yy2q1-openssl-static-x86_64-unknown-linux-musl-3.5.1/lib/libssl.a /nix/store/40kja02wfnw1gdlrcyh75c7x7iibrwvn-zstd-static-x86_64-unknown-linux-musl-1.5.7/lib/libzstd.a /nix/store/8r4xf3v70mqdl8f3jy1y5zjgwrd4x4ym-zlib-static-x86_64-unknown-linux-musl-1.3.1/lib/libz.a -L/nix/store/8r4xf3v70mqdl8f3jy1y5zjgwrd4x4ym-zlib-static-x86_64-unknown-linux-musl-1.3.1/lib -L/nix/store/40kja02wfnw1gdlrcyh75c7x7iibrwvn-zstd-static-x86_64-unknown-linux-musl-1.5.7/lib -L/nix/store/qiamim7zrjv4dj1pwx4gmpyr52xsf2l7-curl-static-x86_64-unknown-linux-musl-8.14.1/lib -L/nix/store/sp6d6xjc541vd0dvyi7h4wy1fx1yy2q1-openssl-static-x86_64-unknown-linux-musl-3.5.1/lib -L/nix/store/17xy7m7lh883jx5xpm1ld0zhgp8w71c6-libpsl-static-x86_64-unknown-linux-musl-0.21.5/lib -L/nix/store/a83k8yhkk5r77bw7590j9vc1lg06l1w8-libidn2-static-x86_64-unknown-linux-musl-2.3.8/lib -L/nix/store/xs5z9i17ns2na47kfyv3x7la3kqyachz-nghttp2-static-x86_64-unknown-linux-musl-1.65.0-lib/lib -L/nix/store/mvdkgbwcac1k0p1zqqaq6v3apm4sp2bq-libssh2-static-x86_64-unknown-linux-musl-1.11.1/lib -L/nix/store/rr598iz9x2p5ll8l97mm7pkgdbqmcsl9-libssh2-static-x86_64-unknown-linux-musl-1.11.1-dev/lib -lunistring -Wl,--end-group
/nix/store/0adymgz38j1xgca61fgg14lvaq0iwq1b-x86_64-unknown-linux-musl-binutils-2.44/bin/x86_64-unknown-linux-musl-ld: /nix/store/xvwkab4bym338r29hqabhnh45ab6lp9c-editline-static-x86_64-unknown-linux-musl-1.17.1/lib/libeditline.a(libeditline_la-editline.o): in function `rl_reset_terminal':
(.text+0x3211): undefined reference to `tgetent'
/nix/store/0adymgz38j1xgca61fgg14lvaq0iwq1b-x86_64-unknown-linux-musl-binutils-2.44/bin/x86_64-unknown-linux-musl-ld: (.text+0x32bf): undefined reference to `tgetstr'
/nix/store/0adymgz38j1xgca61fgg14lvaq0iwq1b-x86_64-unknown-linux-musl-binutils-2.44/bin/x86_64-unknown-linux-musl-ld: (.text+0x32e6): undefined reference to `tgetnum'
/nix/store/0adymgz38j1xgca61fgg14lvaq0iwq1b-x86_64-unknown-linux-musl-binutils-2.44/bin/x86_64-unknown-linux-musl-ld: (.text+0x32f8): undefined reference to `tgetnum'
collect2: error: ld returned 1 exit status

@ShamrockLee
Copy link
Contributor Author

lixStatic already fails to build on the master branch with the same error message, so this is not a regression.

@ShamrockLee ShamrockLee marked this pull request as ready for review August 20, 2025 13:07
@nix-owners nix-owners bot requested review from figsoda, winterqt and zowoq August 20, 2025 13:09
@nixpkgs-ci nixpkgs-ci bot added 9.needs: reviewer This PR currently has no reviewers requested and needs attention. and removed 9.needs: reviewer This PR currently has no reviewers requested and needs attention. labels Aug 20, 2025
@ShamrockLee ShamrockLee marked this pull request as draft August 20, 2025 14:25
Copy link
Member

@axelkar axelkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, I haven't tested it though.

RUSTFLAGS = "-C split-debuginfo=packed " + (args.RUSTFLAGS or "");
}
// {
name = args.name or "${finalAttrs.pname}-${finalAttrs.version}";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it would be possible to just skip this?

Suggested change
name = args.name or "${finalAttrs.pname}-${finalAttrs.version}";
# empty, effectively same as: `inherit (finalAttrs) name;`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. We should let stdenv.mkDerivation handle the name-related attributes whenever pissible.

Copy link
Contributor Author

@ShamrockLee ShamrockLee Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update:

No. We need it to define cargoName's default value.

The path changing of scuba and nnd reminds me of the glitches. They both uses pkgsStatic or pkgsCross, which appends platform names to name if specified and pname otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second update:

You are right. Let's inherit name, pname and version from the main package's finalAttrs and specify custom name for cargoDeps only when cargoDepsName is specified non-null.

Copy link
Contributor Author

@ShamrockLee ShamrockLee Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path change turns out to be inevitable due to how rustPlatform.fetchCargoVendor handle the names. It needs to add prefixes to its name, and changing this behavior results in mass rebuilds.

Luckly, we can keep our current simplification.

@nixpkgs-ci nixpkgs-ci bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Oct 14, 2025
@nixpkgs-ci nixpkgs-ci bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 24, 2025
@jian-lin
Copy link
Contributor

@ShamrockLee What is the state of this PR? Why is it a draft?

This PR looks reasonable to me.

I think it is pretty close to fixing #415397. On the basis of this PR, just changing args.cargoHash to finalAttrs.cargoHash is enough:

let
  pkgs = import <nixpkgs> { config = { }; overlays = [ ]; };
in
{
  kanataBumped = pkgs.kanata.overrideAttrs (old: {
    version = assert old.version != "1.10.1"; "1.10.1";
    src = old.src.overrideAttrs {
      hash = "sha256-jzTK/ZK9UrXTP/Ow662ENBv3cim6klA8+DQv4DLVSNU=";
    };
    cargoHash = "sha256-qYFt/oHokR+EznugEaE/ZEn26IFVLXePgoYGxoPRi+g=";
  });
}

@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented Dec 18, 2025

What is the state of this PR? Why is it a draft?

I was waiting for the depending PR, and forgot to mark it ready for review after rebasing.

Edit: It turns out I haven't rebased it yet.

Update: Rebased.

@ShamrockLee ShamrockLee force-pushed the build-rust-package-overriding-pre branch from eb0312e to a1d15dc Compare December 18, 2025 10:51
@ShamrockLee
Copy link
Contributor Author

GitHub connection seems somewhat unstable currently. CI checks in some of my PRs fail due to network issues.

@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. and removed 2.status: merge conflict This PR has merge conflicts with the target branch 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. labels Dec 18, 2025
@ShamrockLee ShamrockLee marked this pull request as ready for review December 18, 2025 10:59
@ShamrockLee ShamrockLee added the backport release-25.11 Backport PR automatically label Dec 18, 2025
…riding

Make `<rust-package>.cargoDeps` reference the overridden
`<rust-package>.src` and other attributes.

Let `stdenv.mkDerivation` handle the name of `<rust-package>.cargoDeps`.

Make Rust package overriding *possible*
before making further design decisions about the
`<pkg>.overrideAttrs` interface.
@ShamrockLee ShamrockLee force-pushed the build-rust-package-overriding-pre branch from a1d15dc to 04c3e0d Compare December 18, 2025 11:24
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. and removed 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Dec 18, 2025
Copy link
Member

@axelkar axelkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks looks great, but I haven't tested it.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/overriding-version-cant-find-new-cargohash/31502/10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person. backport release-25.11 Backport PR automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants