Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

atuin: make cargoHash the same on Linux and Darwin #371272

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 30 additions & 6 deletions pkgs/by-name/at/atuin/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
installShellFiles,
rustPlatform,
nixosTests,
jq,
moreutils,
}:

rustPlatform.buildRustPackage rec {
Expand All @@ -18,12 +20,34 @@ rustPlatform.buildRustPackage rec {
hash = "sha256-P/q4XYhpXo9kwiltA0F+rQNSlqI+s8TSi5v5lFJWJ/4=";
};

# TODO: unify this to one hash because updater do not support this
cargoHash =
if stdenv.hostPlatform.isLinux then
"sha256-JDm7HWMaLSodpOhrR7rm6ZS/ATX/q8fRK+OJ/EKqg3U="
else
"sha256-mrsqaqJHMyNi3yFDIyAXFBS+LY71VWXE8O7mjvgI6lo=";
# the interim crate contains both README.md and readme.md,
# which causes a hash mismatch on systems with a case-insensitive filesystem.
# This removes the readme files and updates cargo's checksum file accordingly
depsExtraArgs = {
nativeBuildInputs = [
jq
moreutils
];

postBuild = ''
pushd $name/interim

if [ -e readme.md ]; then
rm --force --verbose README.md readme.md
jq 'del(.files."README.md") | del(.files."readme.md")' \
.cargo-checksum.json -c \
| sponge .cargo-checksum.json

popd
else
echo "ERROR: the interim crate has been updated"
echo "When you see this message, please remove the workaround for the interim crate from the atuin nix expression"
exit 1
fi
'';
};

cargoHash = "sha256-l8DsQwEJZL9kr9UIpZzebDSRYET2WM8VFwk+O1Qk9oQ=";

# atuin's default features include 'check-updates', which do not make sense
# for distribution builds. List all other default features.
Expand Down