Skip to content

Commit

Permalink
atuin: make cargoHash the same on Linux and Darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
r-vdp committed Jan 5, 2025
1 parent 81874bf commit 53d915d
Showing 1 changed file with 30 additions and 6 deletions.
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

0 comments on commit 53d915d

Please sign in to comment.