Skip to content

rustPlatform.importCargoLock: fix workspace_root detection#276072

Merged
K900 merged 1 commit intoNixOS:masterfrom
lilyinstarlight:fix/cargo-workspace-root-fixup-pls
Jan 1, 2024
Merged

rustPlatform.importCargoLock: fix workspace_root detection#276072
K900 merged 1 commit intoNixOS:masterfrom
lilyinstarlight:fix/cargo-workspace-root-fixup-pls

Conversation

@lilyinstarlight
Copy link
Copy Markdown
Member

@lilyinstarlight lilyinstarlight commented Dec 22, 2023

Description of changes

Prior to this change, the importCargoLock git dependency builder assumed that the workspace root that needed to be passed to replace-workspace-values will always be the root directory of the git repository

This is not always the case as independent workspace roots may be used from subdirectories, and packages be referenced as dependencies via paths. An example of this is in libcosmic, where the iced subdirectory is its own independent workspace, and workspace values for packages within it should be pulled from the iced subdirectory as the workspace root, not from the top-level of the fetched repository

Given the derivation I changed is not a FOD, I just did a nixpkgs-review and compared with current Hydra failures to ensure there were no regressed builds

Closes #274490

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.05 Release Notes (or backporting 23.05 and 23.11 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.
nixpkgs-review

Result of nixpkgs-review run on x86_64-linux 1

4 packages marked as broken and skipped:
  • python310Packages.dbt-bigquery
  • python310Packages.dbt-bigquery.dist
  • python311Packages.dbt-bigquery
  • python311Packages.dbt-bigquery.dist
15 packages failed to build:
335 packages built:
  • activitywatch
  • airshipper
  • ajour
  • alfis
  • alfis-nogui
  • amdgpu_top
  • anki
  • anki-sync-server
  • anki.dist
  • anki.doc
  • anki.man
  • ankisyncd
  • ante
  • anup
  • asciinema-agg
  • asusctl
  • aw-server-rust
  • aw-watcher-window-wayland
  • bandwhich
  • bcachefs-tools
  • cargo-edit
  • cargo-lambda
  • cargo-release
  • cargo-shuttle
  • catfs
  • cfdyndns
  • cicero-tui
  • ciel
  • cjdns
  • cloud-hypervisor
  • cloud-hypervisor.debug
  • conceal
  • cosmic-applets
  • cosmic-comp
  • cosmic-comp.debug
  • cosmic-edit
  • cosmic-greeter
  • cosmic-osd
  • cosmic-panel
  • cosmic-settings
  • cosmic-workspaces-epoch
  • cosmic-workspaces-epoch.debug
  • cotton
  • cyme
  • dbt (python311Packages.dbt-core)
  • dbt.dist (python311Packages.dbt-core.dist)
  • deltachat-cursed
  • deltachat-cursed.dist
  • deltachat-desktop
  • deltachat-repl
  • devpod-desktop
  • difftastic
  • dnspeep
  • documenso
  • dogdns
  • dogdns.man
  • done
  • edgedb
  • egglog
  • emblem
  • espanso
  • espanso-wayland
  • faircamp
  • fedigroups
  • findomain
  • firmware-manager
  • flare-floss
  • flare-floss.dist
  • flare-signal
  • fractal
  • framework-tool
  • freshfetch
  • gdrive3
  • genemichaels
  • geph.gui
  • ghostie
  • gifski
  • gir-rs
  • git-interactive-rebase-tool
  • git-ps-rs
  • gst_all_1.gst-plugins-rs
  • gst_all_1.gst-plugins-rs.dev
  • gurk-rs
  • habitat
  • halloy
  • hebbot
  • httm
  • humility
  • insulator2
  • ion
  • itm-tools
  • jrsonnet
  • jumpy
  • kafka-delta-ingest
  • kanidm
  • kile-wl
  • kubernix
  • lapce
  • lazymc
  • liana
  • libdeltachat
  • lightdm-mobile-greeter
  • lighthouse
  • lighthouse-steamvr
  • lipl
  • lldap
  • lychee
  • materialize
  • matrix-appservice-discord
  • matrix-appservice-irc
  • matrix-appservice-slack
  • matrix-conduit
  • matrix-hookshot
  • matrix-sdk-crypto-nodejs
  • matrix-sdk-crypto-nodejs-0_1_0-beta_3
  • mchprs
  • measureme
  • meilisearch
  • millet
  • mission-center
  • mitmproxy (python311Packages.mitmproxy)
  • mitmproxy.dist (python311Packages.mitmproxy.dist)
  • mitmproxy2swagger
  • mitmproxy2swagger.dist
  • mjolnir
  • mnemosyne
  • mnemosyne.dist
  • moonfire-nvr
  • mopidy
  • mopidy-bandcamp
  • mopidy-bandcamp.dist
  • mopidy-iris
  • mopidy-iris.dist
  • mopidy-jellyfin
  • mopidy-jellyfin.dist
  • mopidy-local
  • mopidy-local.dist
  • mopidy-moped
  • mopidy-moped.dist
  • mopidy-mopify
  • mopidy-mopify.dist
  • mopidy-mpd
  • mopidy-mpd.dist
  • mopidy-mpris
  • mopidy-mpris.dist
  • mopidy-muse
  • mopidy-muse.dist
  • mopidy-musicbox-webclient
  • mopidy-musicbox-webclient.dist
  • mopidy-notify
  • mopidy-notify.dist
  • mopidy-podcast
  • mopidy-podcast.dist
  • mopidy-scrobbler
  • mopidy-scrobbler.dist
  • mopidy-somafm
  • mopidy-somafm.dist
  • mopidy-soundcloud
  • mopidy-soundcloud.dist
  • mopidy-spotify
  • mopidy-spotify.dist
  • mopidy-subidy
  • mopidy-subidy.dist
  • mopidy-tidal
  • mopidy-tidal.dist
  • mopidy-tunein
  • mopidy-tunein.dist
  • mopidy-youtube
  • mopidy-youtube.dist
  • mopidy-ytmusic
  • mopidy-ytmusic.dist
  • mopidy.dist
  • mullvad
  • muzika
  • netease-cloud-music-gtk
  • newsflash
  • nickel
  • nickel.nls
  • nix-init
  • nix-unit
  • nls
  • noaa-apt
  • nurl
  • nym
  • onagre
  • openethereum
  • openobserve
  • owmods-cli
  • peek
  • php81Extensions.datadog_trace
  • php82Extensions.datadog_trace
  • php83Extensions.datadog_trace
  • pict-rs_0_3
  • pls
  • pods
  • polaris
  • polkadot
  • pomsky
  • pot
  • prettypst
  • prisma-engines
  • psst
  • pwvucontrol
  • python310Packages.dbt-core
  • python310Packages.dbt-core.dist
  • python310Packages.dbt-extractor
  • python310Packages.dbt-extractor.dist
  • python310Packages.dbt-postgres
  • python310Packages.dbt-postgres.dist
  • python310Packages.dbt-redshift
  • python310Packages.dbt-redshift.dist
  • python310Packages.dbt-snowflake
  • python310Packages.dbt-snowflake.dist
  • python310Packages.deltachat
  • python310Packages.deltachat.dist
  • python310Packages.json-stream
  • python310Packages.json-stream-rs-tokenizer
  • python310Packages.json-stream-rs-tokenizer.dist
  • python310Packages.json-stream.dist
  • python310Packages.mitmproxy
  • python310Packages.mitmproxy-rs
  • python310Packages.mitmproxy-rs.dist
  • python310Packages.mitmproxy.dist
  • python310Packages.polars
  • python310Packages.polars.dist
  • python310Packages.python-flirt
  • python310Packages.python-flirt.dist
  • python310Packages.skytemple-ssb-debugger
  • python310Packages.skytemple-ssb-debugger.dist
  • python310Packages.skytemple-ssb-emulator
  • python310Packages.skytemple-ssb-emulator.dist
  • python311Packages.dbt-extractor
  • python311Packages.dbt-extractor.dist
  • python311Packages.dbt-postgres
  • python311Packages.dbt-postgres.dist
  • python311Packages.dbt-redshift
  • python311Packages.dbt-redshift.dist
  • python311Packages.dbt-snowflake
  • python311Packages.dbt-snowflake.dist
  • python311Packages.deltachat
  • python311Packages.deltachat.dist
  • python311Packages.json-stream
  • python311Packages.json-stream-rs-tokenizer
  • python311Packages.json-stream-rs-tokenizer.dist
  • python311Packages.json-stream.dist
  • python311Packages.mitmproxy-rs
  • python311Packages.mitmproxy-rs.dist
  • python311Packages.polars
  • python311Packages.polars.dist
  • python311Packages.python-flirt
  • python311Packages.python-flirt.dist
  • python311Packages.skytemple-ssb-debugger
  • python311Packages.skytemple-ssb-debugger.dist
  • python311Packages.skytemple-ssb-emulator
  • python311Packages.skytemple-ssb-emulator.dist
  • qdrant
  • quill
  • radicle-cli
  • ripasso-cursive
  • ripgrep-all
  • rnote
  • rqbit
  • rtz
  • ruffle
  • rustdesk
  • rustdesk-server
  • rustpython
  • rye
  • salut
  • sapling
  • sapling.dist
  • scryer-prolog
  • silicon
  • skytemple
  • skytemple.dist
  • spade
  • sqld
  • stalwart-mail
  • stratisd
  • stratisd.initrd
  • surface-control
  • svix-server
  • symbolicator
  • syncstorage-rs
  • system-syzygy
  • system76-firmware
  • teleport
  • teleport.client
  • teleport_12
  • teleport_12.client
  • teleport_13
  • teleport_13.client
  • texture-synthesis
  • topiary
  • tunnelto
  • typst
  • typst-live
  • typst-lsp
  • typst-preview
  • typstfmt
  • ukmm
  • unimap
  • vector
  • veilid
  • veilid.dev
  • veilid.lib
  • vimPlugins.vim-clap
  • vimPluginsUpdater
  • volta
  • vrc-get
  • vscode-extensions.azdavis.millet
  • vscode-extensions.mgt19937.typst-preview
  • vscode-extensions.nvarner.typst-lsp
  • wapiti
  • wapiti.dist
  • watchmate
  • weylus
  • wezterm
  • wgpu-utils
  • windmill
  • wluma
  • worker-build
  • workstyle
  • wpaperd
  • xdg-desktop-portal-cosmic
  • xdg-desktop-portal-cosmic.debug
  • xplorer
  • yabridgectl
  • youtube-tui
  • zenith
  • zenith-nvidia
  • zerotierone
  • zerotierone.man
  • zpool-auto-expand-partitions
  • zz

Add a 👍 reaction to pull requests you find important.

Prior to this change, the `importCargoLock` git dependency builder
assumed that the workspace root that needed to be passed to
`replace-workspace-values` will always be the root directory of the git
repository.

This is not always the case as independent workspace roots may be used
from subdirectories, and packages be referenced via paths. An example of
this is [1], where the `iced` subdirectory is its own independent
workspace, and workspace values for packages within it should be pulled
from the `iced` subdirectory as the workspace root, not from the
top-level of the fetched repository.

[1]: https://github.com/pop-os/libcosmic/blob/b8f1a366dd030b90ed72e50f521e3da1d6a676ce/Cargo.toml
@github-actions github-actions bot added the 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. label Dec 22, 2023
@ofborg ofborg bot added 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. labels Dec 22, 2023
Copy link
Copy Markdown
Member

@nbdd0121 nbdd0121 left a comment

Choose a reason for hiding this comment

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

I can confirm that jq -r .workspace_root gives the expected value, and with this PR cosmic-* is able to build.

@delroth delroth added the 12.approvals: 1 This PR was reviewed and approved by one person. label Dec 26, 2023
@delroth delroth added 12.approvals: 2 This PR was reviewed and approved by two persons. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels Dec 26, 2023
@K900 K900 merged commit 6cbe554 into NixOS:master Jan 1, 2024
@lilyinstarlight lilyinstarlight deleted the fix/cargo-workspace-root-fixup-pls branch January 1, 2024 16:20
johnyob added a commit to jstz-dev/jstz that referenced this pull request Jul 15, 2024
Due to a bug in `replace-workspace-values`, we can no-longer use a cargo git dependency for tezos/tezos.
The issue is documented here: NixOS/nixpkgs#276072.
To fix, we simply update nixpkgs.
johnyob added a commit to jstz-dev/jstz that referenced this pull request Jul 15, 2024
Due to a bug in `replace-workspace-values`, we can no-longer use a cargo git dependency for tezos/tezos.
The issue is documented here: NixOS/nixpkgs#276072.
To fix, we simply update nixpkgs.
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: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. 12.approvals: 2 This PR was reviewed and approved by two persons.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rustPlatform: unsupported features causing build failure

5 participants