mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 04:35:41 +03:00
lrcget: use cargo-tauri.hook
This commit is contained in:
parent
851c8b9a53
commit
9887ab90ba
2 changed files with 71 additions and 68 deletions
|
@ -1,20 +1,25 @@
|
||||||
{
|
{
|
||||||
dbus,
|
|
||||||
openssl,
|
|
||||||
gtk3,
|
|
||||||
webkitgtk_4_1,
|
|
||||||
pkg-config,
|
|
||||||
wrapGAppsHook3,
|
|
||||||
fetchFromGitHub,
|
|
||||||
buildNpmPackage,
|
|
||||||
rustPlatform,
|
|
||||||
lib,
|
lib,
|
||||||
stdenv,
|
stdenv,
|
||||||
copyDesktopItems,
|
rustPlatform,
|
||||||
makeDesktopItem,
|
|
||||||
|
fetchFromGitHub,
|
||||||
|
fetchNpmDeps,
|
||||||
|
|
||||||
|
cargo-tauri,
|
||||||
|
makeBinaryWrapper,
|
||||||
|
nodejs,
|
||||||
|
npmHooks,
|
||||||
|
pkg-config,
|
||||||
|
wrapGAppsHook3,
|
||||||
|
|
||||||
alsa-lib,
|
alsa-lib,
|
||||||
|
openssl,
|
||||||
|
webkitgtk_4_1,
|
||||||
|
|
||||||
nix-update-script,
|
nix-update-script,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
rustPlatform.buildRustPackage rec {
|
rustPlatform.buildRustPackage rec {
|
||||||
pname = "lrcget";
|
pname = "lrcget";
|
||||||
version = "0.9.3";
|
version = "0.9.3";
|
||||||
|
@ -22,85 +27,70 @@ rustPlatform.buildRustPackage rec {
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "tranxuanthang";
|
owner = "tranxuanthang";
|
||||||
repo = "lrcget";
|
repo = "lrcget";
|
||||||
rev = "${version}";
|
tag = version;
|
||||||
hash = "sha256-3dBjQ1fO1q8JCQFvvV8LWBCD8cKFkFmm8ufC/Xihmj4=";
|
hash = "sha256-3dBjQ1fO1q8JCQFvvV8LWBCD8cKFkFmm8ufC/Xihmj4=";
|
||||||
};
|
};
|
||||||
|
|
||||||
sourceRoot = "${src.name}/src-tauri";
|
patches = [
|
||||||
|
# needed to not attempt codesigning on darwin
|
||||||
|
./remove-signing-identity.patch
|
||||||
|
];
|
||||||
|
|
||||||
|
cargoRoot = "src-tauri";
|
||||||
|
buildAndTestSubdir = "src-tauri";
|
||||||
|
|
||||||
useFetchCargoVendor = true;
|
useFetchCargoVendor = true;
|
||||||
cargoHash = "sha256-Nu1N96OrLG/D2/1vbU229jLVNZuKIiCSwDJA25hlqFM=";
|
cargoHash = "sha256-Nu1N96OrLG/D2/1vbU229jLVNZuKIiCSwDJA25hlqFM=";
|
||||||
|
|
||||||
frontend = buildNpmPackage {
|
# FIXME: This is a workaround, because we have a git dependency node_modules/lrc-kit contains install scripts
|
||||||
inherit version src;
|
# but has no lockfile, which is something that will probably break.
|
||||||
pname = "lrcget-ui";
|
forceGitDeps = true;
|
||||||
# FIXME: This is a workaround, because we have a git dependency node_modules/lrc-kit contains install scripts
|
|
||||||
# but has no lockfile, which is something that will probably break.
|
|
||||||
forceGitDeps = true;
|
|
||||||
distPhase = "true";
|
|
||||||
dontInstall = true;
|
|
||||||
# To fix `npm ERR! Your cache folder contains root-owned files`
|
|
||||||
makeCacheWritable = true;
|
|
||||||
|
|
||||||
npmDepsHash = "sha256-N48+C3NNPYg/rOpnRNmkZfZU/ZHp8imrG/tiDaMGsCE=";
|
npmDeps = fetchNpmDeps {
|
||||||
|
name = "lrcget-${version}-npm-deps";
|
||||||
postBuild = ''
|
inherit src forceGitDeps;
|
||||||
cp -r dist/ $out
|
hash = "sha256-N48+C3NNPYg/rOpnRNmkZfZU/ZHp8imrG/tiDaMGsCE=";
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# copy the frontend static resources to final build directory
|
nativeBuildInputs =
|
||||||
# Also modify tauri.conf.json so that it expects the resources at the new location
|
|
||||||
postPatch = ''
|
|
||||||
cp -r $frontend ./frontend
|
|
||||||
|
|
||||||
substituteInPlace tauri.conf.json \
|
|
||||||
--replace-fail '"frontendDist": "../dist"' '"frontendDist": "./frontend"'
|
|
||||||
'';
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
|
||||||
pkg-config
|
|
||||||
wrapGAppsHook3
|
|
||||||
copyDesktopItems
|
|
||||||
rustPlatform.bindgenHook
|
|
||||||
];
|
|
||||||
|
|
||||||
buildInputs =
|
|
||||||
[
|
[
|
||||||
dbus
|
cargo-tauri.hook
|
||||||
openssl
|
nodejs
|
||||||
gtk3
|
npmHooks.npmConfigHook
|
||||||
|
rustPlatform.bindgenHook
|
||||||
]
|
]
|
||||||
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
|
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
|
||||||
webkitgtk_4_1
|
pkg-config
|
||||||
alsa-lib
|
wrapGAppsHook3
|
||||||
|
]
|
||||||
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||||
|
makeBinaryWrapper
|
||||||
];
|
];
|
||||||
|
|
||||||
|
buildInputs = lib.optionals (!stdenv.hostPlatform.isDarwin) [
|
||||||
|
alsa-lib
|
||||||
|
openssl
|
||||||
|
webkitgtk_4_1
|
||||||
|
];
|
||||||
|
|
||||||
|
# To fix `npm ERR! Your cache folder contains root-owned files`
|
||||||
|
makeCacheWritable = true;
|
||||||
|
|
||||||
# Disable checkPhase, since the project doesn't contain tests
|
# Disable checkPhase, since the project doesn't contain tests
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
|
||||||
postInstall = ''
|
# make the binary also runnable from the shell
|
||||||
install -DT icons/128x128@2x.png $out/share/icons/hicolor/128x128@2/apps/lrcget.png
|
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||||
install -DT icons/128x128.png $out/share/icons/hicolor/128x128/apps/lrcget.png
|
makeWrapper "$out/Applications/LRCGET.app/Contents/MacOS/LRCGET" "$out/bin/LRCGET"
|
||||||
install -DT icons/32x32.png $out/share/icons/hicolor/32x32/apps/lrcget.png
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# WEBKIT_DISABLE_COMPOSITING_MODE essential in NVIDIA + compositor https://github.com/NixOS/nixpkgs/issues/212064#issuecomment-1400202079
|
preFixup = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
|
||||||
postFixup = ''
|
gappsWrapperArgs+=(
|
||||||
wrapProgram "$out/bin/lrcget" \
|
# WEBKIT_DISABLE_COMPOSITING_MODE essential in NVIDIA + compositor https://github.com/NixOS/nixpkgs/issues/212064#issuecomment-1400202079
|
||||||
--set WEBKIT_DISABLE_COMPOSITING_MODE 1
|
--set WEBKIT_DISABLE_COMPOSITING_MODE 1
|
||||||
|
)
|
||||||
'';
|
'';
|
||||||
|
|
||||||
desktopItems = [
|
|
||||||
(makeDesktopItem {
|
|
||||||
name = "LRCGET";
|
|
||||||
exec = "lrcget";
|
|
||||||
icon = "lrcget";
|
|
||||||
desktopName = "LRCGET";
|
|
||||||
comment = meta.description;
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
passthru.updateScript = nix-update-script { };
|
passthru.updateScript = nix-update-script { };
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
@ -112,7 +102,7 @@ rustPlatform.buildRustPackage rec {
|
||||||
anas
|
anas
|
||||||
Scrumplex
|
Scrumplex
|
||||||
];
|
];
|
||||||
mainProgram = "lrcget";
|
mainProgram = "LRCGET";
|
||||||
platforms = with lib.platforms; unix ++ windows;
|
platforms = with lib.platforms; unix ++ windows;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
13
pkgs/by-name/lr/lrcget/remove-signing-identity.patch
Normal file
13
pkgs/by-name/lr/lrcget/remove-signing-identity.patch
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
|
||||||
|
index 92d43e7..6519fd0 100644
|
||||||
|
--- a/src-tauri/tauri.conf.json
|
||||||
|
+++ b/src-tauri/tauri.conf.json
|
||||||
|
@@ -36,7 +36,7 @@
|
||||||
|
"exceptionDomain": "",
|
||||||
|
"frameworks": [],
|
||||||
|
"providerShortName": null,
|
||||||
|
- "signingIdentity": "-"
|
||||||
|
+ "signingIdentity": null
|
||||||
|
},
|
||||||
|
"resources": [],
|
||||||
|
"shortDescription": "Utility for mass-downloading LRC synced lyrics for your offline music library.",
|
Loading…
Add table
Add a link
Reference in a new issue