diff --git a/pkgs/by-name/at/atuin/package.nix b/pkgs/by-name/at/atuin/package.nix index 266ae4b0d5b07..ba46f7d97944c 100644 --- a/pkgs/by-name/at/atuin/package.nix +++ b/pkgs/by-name/at/atuin/package.nix @@ -5,6 +5,8 @@ installShellFiles, rustPlatform, nixosTests, + jq, + moreutils, }: rustPlatform.buildRustPackage rec { @@ -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.