Skip to content

Commit e4ca168

Browse files
authored
Merge pull request #334347 from linj-fork/pr/kanata-unify-hash
kanata: fix hash mismatch on case-insensitive filesystems
2 parents 5088777 + 1756f4f commit e4ca168

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

pkgs/tools/system/kanata/default.nix

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
, darwin
44
, rustPlatform
55
, fetchFromGitHub
6+
, jq
7+
, moreutils
8+
, nix-update-script
69
, withCmd ? false
710
}:
811

@@ -17,10 +20,28 @@ rustPlatform.buildRustPackage rec {
1720
sha256 = "sha256-eDeGVmh1gI/DhiP6gxJyGH9G9LNH1NHW0+DNuOPUnBY=";
1821
};
1922

20-
cargoHash =
21-
if stdenv.isLinux
22-
then "sha256-gRJdfvb3Q+G7pXpOyKrgozrZPJJbDajC63Kk5QtgX00="
23-
else "sha256-i9eY8dvteOLYmM+ad1nw+fohec2SPGCGqColXNamEBo=";
23+
cargoHash = "sha256-Om9Thyr10wc39J6adSWgmXtvjckaEW0z68sWxUqa4wc=";
24+
25+
# the dependency native-windows-gui contains both README.md and readme.md,
26+
# which causes a hash mismatch on systems with a case-insensitive filesystem
27+
# this removes the readme files and updates cargo's checksum file accordingly
28+
depsExtraArgs = {
29+
nativeBuildInputs = [
30+
jq
31+
moreutils
32+
];
33+
34+
postBuild = ''
35+
pushd $name/native-windows-gui
36+
37+
rm --force --verbose README.md readme.md
38+
jq 'del(.files."README.md") | del(.files."readme.md")' \
39+
.cargo-checksum.json -c \
40+
| sponge .cargo-checksum.json
41+
42+
popd
43+
'';
44+
};
2445

2546
buildInputs = lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.IOKit ];
2647

@@ -30,6 +51,10 @@ rustPlatform.buildRustPackage rec {
3051
install -Dm 444 assets/kanata-icon.svg $out/share/icons/hicolor/scalable/apps/kanata.svg
3152
'';
3253

54+
passthru = {
55+
updateScript = nix-update-script { };
56+
};
57+
3358
meta = with lib; {
3459
description = "Tool to improve keyboard comfort and usability with advanced customization";
3560
homepage = "https://github.com/jtroo/kanata";

0 commit comments

Comments
 (0)