Skip to content

Commit a9a7f9a

Browse files
authored
yaak: added darwin support; fix version (#409672)
2 parents fd2e900 + 69c0260 commit a9a7f9a

File tree

1 file changed

+40
-19
lines changed

1 file changed

+40
-19
lines changed

pkgs/by-name/ya/yaak/package.nix

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
perl,
2020
makeWrapper,
2121
nix-update-script,
22+
stdenv,
2223
}:
2324

2425
rustPlatform.buildRustPackage (finalAttrs: {
@@ -54,33 +55,48 @@ rustPlatform.buildRustPackage (finalAttrs: {
5455
makeWrapper
5556
];
5657

57-
buildInputs = [
58-
glib
59-
gtk3
60-
openssl
61-
webkitgtk_4_1
62-
pango
63-
cairo
64-
pixman
65-
];
58+
buildInputs =
59+
[
60+
glib
61+
gtk3
62+
openssl
63+
pango
64+
cairo
65+
pixman
66+
]
67+
++ lib.optionals stdenv.hostPlatform.isLinux [
68+
webkitgtk_4_1
69+
];
6670

6771
env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
6872

6973
postPatch = ''
7074
substituteInPlace src-tauri/tauri.conf.json \
71-
--replace-fail '"createUpdaterArtifacts": "v1Compatible"' '"createUpdaterArtifacts": false'
75+
--replace-fail '"createUpdaterArtifacts": "v1Compatible"' '"createUpdaterArtifacts": false' \
76+
--replace-fail '"0.0.0"' '"${finalAttrs.version}"'
7277
substituteInPlace package.json \
7378
--replace-fail '"bootstrap:vendor-node": "node scripts/vendor-node.cjs",' "" \
7479
--replace-fail '"bootstrap:vendor-protoc": "node scripts/vendor-protoc.cjs",' ""
7580
'';
7681

77-
preBuild = ''
78-
mkdir -p src-tauri/vendored/node
79-
ln -s ${nodejs}/bin/node src-tauri/vendored/node/yaaknode-x86_64-unknown-linux-gnu
80-
mkdir -p src-tauri/vendored/protoc
81-
ln -s ${protobuf}/bin/protoc src-tauri/vendored/protoc/yaakprotoc-x86_64-unknown-linux-gnu
82-
ln -s ${protobuf}/include src-tauri/vendored/protoc/include
83-
'';
82+
preBuild =
83+
let
84+
archPlatforms =
85+
{
86+
"aarch64-darwin" = "aarch64-apple-darwin";
87+
"x86_64-darwin" = "x86_64-apple-darwin";
88+
"aarch64-linux" = "aarch64-unknown-linux-gnu";
89+
"x86_64-linux" = "x86_64-unknown-linux-gnu";
90+
}
91+
.${stdenv.hostPlatform.system};
92+
in
93+
''
94+
mkdir -p src-tauri/vendored/node
95+
ln -s ${nodejs}/bin/node src-tauri/vendored/node/yaaknode-${archPlatforms}
96+
mkdir -p src-tauri/vendored/protoc
97+
ln -s ${protobuf}/bin/protoc src-tauri/vendored/protoc/yaakprotoc-${archPlatforms}
98+
ln -s ${protobuf}/include src-tauri/vendored/protoc/include
99+
'';
84100

85101
# Permission denied (os error 13)
86102
# write to src-tauri/vendored/protoc/include
@@ -90,7 +106,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
90106

91107
postInstall = "popd";
92108

93-
postFixup = ''
109+
postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
94110
wrapProgram $out/bin/yaak-app \
95111
--inherit-argv0 \
96112
--set-default WEBKIT_DISABLE_DMABUF_RENDERER 1
@@ -105,6 +121,11 @@ rustPlatform.buildRustPackage (finalAttrs: {
105121
license = lib.licenses.mit;
106122
maintainers = with lib.maintainers; [ redyf ];
107123
mainProgram = "yaak";
108-
platforms = [ "x86_64-linux" ];
124+
platforms = [
125+
"x86_64-linux"
126+
"aarch64-linux"
127+
"x86_64-darwin"
128+
"aarch64-darwin"
129+
];
109130
};
110131
})

0 commit comments

Comments
 (0)