Skip to content

buildRustPackage: allow passing in cargoDeps#340798

Open
SuperSandro2000 wants to merge 1 commit intoNixOS:masterfrom
SuperSandro2000:build-rust-package-cargoLock
Open

buildRustPackage: allow passing in cargoDeps#340798
SuperSandro2000 wants to merge 1 commit intoNixOS:masterfrom
SuperSandro2000:build-rust-package-cargoLock

Conversation

@SuperSandro2000
Copy link
Member

@SuperSandro2000 SuperSandro2000 commented Sep 9, 2024

Description of changes

Since roughly a week or so the following overlay fails and I couldn't so far figure out why because the changes done in the last ~3 months or so look rather innocent.

  # TODO: upstream into nixpkgs
  wezterm-headless = rustPlatform.buildRustPackage {
    pname = "${wezterm.pname}-headless";
    inherit (wezterm) version src postPatch;
    inherit (wezterm.passthru) cargoLock;

    nativeBuildInputs = [ pkg-config ];

    buildInputs = [ openssl ];

    cargoBuildFlags = [
      "--package" "wezterm"
      "--package" "wezterm-mux-server"
    ];

    doCheck = false;

    postInstall = /* bash */ ''
      install -Dm644 assets/shell-integration/wezterm.sh -t $out/etc/profile.d
      sed -e 's|hash wezterm 2>/dev/null|command type -P wezterm &>/dev/null|g' \
        -e 's|hash base64 2>/dev/null|command type -P base64 &>/dev/null|g' \
        -e 's|hash hostname 2>/dev/null|command type -P hostname &>/dev/null|g' \
        -e 's|hash hostnamectl 2>/dev/null|command type -P hostnamectl &>/dev/null|g' \
        -i $out/etc/profile.d/wezterm.sh

      install -Dm644 ${wezterm.terminfo}/share/terminfo/w/wezterm -t $out/share/terminfo/w
    '';
  };

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added the 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. label Sep 9, 2024
@ofborg ofborg bot added 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. labels Sep 9, 2024
Copy link
Member

@winterqt winterqt left a comment

Choose a reason for hiding this comment

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

The overlay you show has never worked; we've never exposed cargoLock in passthru, only cargoDeps. Are you sure you don't mean to use wezterm.cargoDeps (or wezterm.passthru.cargoDeps) in it?

@SuperSandro2000
Copy link
Member Author

Derp 🤦🏼 I found the commit which I dropped by accident while rebasing 4f4c193

Are you sure you don't mean to use wezterm.cargoDeps (or wezterm.passthru.cargoDeps) in it?

In essence I want this but it fails on https://github.com/nixos/nixpkgs/blob/bcbfad30628c60e310e5f7c95436de2f0c05921e/pkgs/build-support/rust/build-rust-package/default.nix#L62-L64

Maybe that should be extended instead?

@SuperSandro2000 SuperSandro2000 changed the title build-rust-package: add passthru.cargoLock back build-rust-package: allow passing in cargoDeps Sep 12, 2024
@SuperSandro2000 SuperSandro2000 changed the title build-rust-package: allow passing in cargoDeps buildRustPackage: allow passing in cargoDeps Sep 12, 2024
This is useful when constructing overlays and trying to copy a
buildRustPackage from a different package
@SuperSandro2000 SuperSandro2000 force-pushed the build-rust-package-cargoLock branch from bcbfad3 to 7243e1b Compare September 12, 2024 10:02
@ofborg ofborg bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. and removed 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. labels Sep 12, 2024
@SuperSandro2000
Copy link
Member Author

@winterqt ping

@TomaSajt
Copy link
Contributor

Probably superseded by #354999

@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Dec 10, 2024
@nixpkgs-ci nixpkgs-ci bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants