-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
06ebfab
commit 9ba4afb
Showing
2 changed files
with
96 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,108 @@ | ||
{ | ||
appimageTools, | ||
lib, | ||
fetchurl, | ||
cargo-tauri, | ||
cargo-tauri_1, | ||
fetchFromGitHub, | ||
glib-networking, | ||
libayatana-appindicator, | ||
libsoup_2_4, | ||
libsoup_3, | ||
nodejs, | ||
openssl, | ||
perl, | ||
pkg-config, | ||
pnpm, | ||
protobuf, | ||
rustPlatform, | ||
stdenv, | ||
webkitgtk_4_0, | ||
webkitgtk_4_1, | ||
wrapGAppsHook4, | ||
|
||
# This package provides can be built using tauri v1 or v2. | ||
# Try legacy (v1) version if main (v2) doesn't work. | ||
app-type ? "main", # main or legacy | ||
}: | ||
let | ||
pname = "rquickshare"; | ||
app-type-either = | ||
arg1: arg2: | ||
if app-type == "main" then | ||
arg1 | ||
else if app-type == "legacy" then | ||
arg2 | ||
else | ||
throw "Wrong argument for app-type in rquickshare package"; | ||
|
||
proper-cargo-tauri = app-type-either cargo-tauri cargo-tauri_1; | ||
in | ||
rustPlatform.buildRustPackage rec { | ||
pname = "rquickshare" + (app-type-either "" "-legacy"); | ||
version = "0.11.2"; | ||
src = fetchurl { | ||
url = "https://github.com/Martichou/rquickshare/releases/download/v${version}/r-quick-share-main_v${version}_glibc-2.39_amd64.AppImage"; | ||
hash = "sha256-7w1zybCPRg4RK5bKHoHLDUDXVDQL23ox/6wh8H9vTPg="; | ||
|
||
src = fetchFromGitHub { | ||
owner = "Martichou"; | ||
repo = "rquickshare"; | ||
tag = "v${version}"; | ||
hash = "sha256-MYhM6FB3zfvMFnLMecbn4Ismvk8AAykIvhPBnFcNjdI="; | ||
}; | ||
appimageContents = appimageTools.extractType2 { inherit pname version src; }; | ||
in | ||
appimageTools.wrapType2 { | ||
inherit pname version src; | ||
extraInstallCommands = '' | ||
install -Dm444 ${appimageContents}/rquickshare.desktop -t $out/share/applications | ||
substituteInPlace $out/share/applications/rquickshare.desktop \ | ||
--replace-fail 'Exec=rquickshare' 'Exec=rquickshare %u' | ||
cp -r ${appimageContents}/usr/share/icons $out/share | ||
|
||
# from https://github.com/NixOS/nixpkgs/blob/04e40bca2a68d7ca85f1c47f00598abb062a8b12/pkgs/by-name/ca/cargo-tauri/test-app.nix#L23-L26 | ||
postPatch = lib.optionalString stdenv.hostPlatform.isLinux '' | ||
substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \ | ||
--replace "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1" | ||
''; | ||
|
||
pnpmRoot = "app/${app-type}"; | ||
pnpmDeps = pnpm.fetchDeps { | ||
inherit pname version src; | ||
|
||
sourceRoot = "${src.name}/app/${app-type}"; | ||
hash = app-type-either "sha256-VPb2idEiBruVCwz5lDojFmD2C5CfXYSe5mPWBwCGeJs=" "sha256-sDHysaKMdNcbL1szww7/wg0bGHOnEKsKoySZJJCcPik="; | ||
}; | ||
|
||
useFetchCargoVendor = true; | ||
cargoRoot = "app/${app-type}/src-tauri"; | ||
buildAndTestSubdir = cargoRoot; | ||
cargoHash = app-type-either "sha256-5vGXMHar9E25jVseXR2uI82DtZXyPaHgDD8QkqoRhhY=" "sha256-kkbDEV4k+4EiUi4+EsZdmgm9/vMC0m5L5lpyCn7Zzb0="; | ||
|
||
nativeBuildInputs = [ | ||
proper-cargo-tauri.hook | ||
|
||
# Setup pnpm | ||
nodejs | ||
pnpm.configHook | ||
|
||
# Make sure we can find our libraries | ||
perl | ||
pkg-config | ||
protobuf | ||
wrapGAppsHook4 | ||
]; | ||
|
||
buildInputs = | ||
[ openssl ] | ||
++ lib.optionals stdenv.hostPlatform.isLinux [ | ||
glib-networking # Most Tauri apps need networking | ||
libayatana-appindicator | ||
] | ||
++ lib.optionals (app-type == "main") [ | ||
webkitgtk_4_1 | ||
libsoup_3 | ||
] | ||
++ lib.optionals (app-type == "legacy") [ | ||
webkitgtk_4_0 | ||
libsoup_2_4 | ||
]; | ||
|
||
meta = { | ||
description = "Rust implementation of NearbyShare/QuickShare from Android for Linux"; | ||
description = "Rust implementation of NearbyShare/QuickShare from Android for Linux and macOS"; | ||
homepage = "https://github.com/Martichou/rquickshare"; | ||
changelog = "https://github.com/Martichou/rquickshare/blob/v${version}/CHANGELOG.md"; | ||
license = lib.licenses.gpl3Plus; | ||
maintainers = [ lib.maintainers.luftmensch-luftmensch ]; | ||
platforms = [ "x86_64-linux" ]; | ||
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; | ||
mainProgram = "rquickshare"; | ||
mainProgram = app-type-either "rquickshare" "r-quick-share"; | ||
maintainers = with lib.maintainers; [ | ||
perchun | ||
luftmensch-luftmensch | ||
]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters