lrcget: use cargo-tauri.hook (#407144)

authored by

Toma and committed by
GitHub
a859279b 3ed788d7

+71 -68
+58 -68
pkgs/by-name/lr/lrcget/package.nix
··· 1 1 { 2 - dbus, 3 - openssl, 4 - gtk3, 5 - webkitgtk_4_1, 6 - pkg-config, 7 - wrapGAppsHook3, 8 - fetchFromGitHub, 9 - buildNpmPackage, 10 - rustPlatform, 11 2 lib, 12 3 stdenv, 13 - copyDesktopItems, 14 - makeDesktopItem, 4 + rustPlatform, 5 + 6 + fetchFromGitHub, 7 + fetchNpmDeps, 8 + 9 + cargo-tauri, 10 + makeBinaryWrapper, 11 + nodejs, 12 + npmHooks, 13 + pkg-config, 14 + wrapGAppsHook3, 15 + 15 16 alsa-lib, 17 + openssl, 18 + webkitgtk_4_1, 19 + 16 20 nix-update-script, 17 21 }: 22 + 18 23 rustPlatform.buildRustPackage rec { 19 24 pname = "lrcget"; 20 25 version = "0.9.3"; ··· 22 27 src = fetchFromGitHub { 23 28 owner = "tranxuanthang"; 24 29 repo = "lrcget"; 25 - rev = "${version}"; 30 + tag = version; 26 31 hash = "sha256-3dBjQ1fO1q8JCQFvvV8LWBCD8cKFkFmm8ufC/Xihmj4="; 27 32 }; 28 33 29 - sourceRoot = "${src.name}/src-tauri"; 34 + patches = [ 35 + # needed to not attempt codesigning on darwin 36 + ./remove-signing-identity.patch 37 + ]; 38 + 39 + cargoRoot = "src-tauri"; 40 + buildAndTestSubdir = "src-tauri"; 30 41 31 42 useFetchCargoVendor = true; 32 43 cargoHash = "sha256-Nu1N96OrLG/D2/1vbU229jLVNZuKIiCSwDJA25hlqFM="; 33 44 34 - frontend = buildNpmPackage { 35 - inherit version src; 36 - pname = "lrcget-ui"; 37 - # FIXME: This is a workaround, because we have a git dependency node_modules/lrc-kit contains install scripts 38 - # but has no lockfile, which is something that will probably break. 39 - forceGitDeps = true; 40 - distPhase = "true"; 41 - dontInstall = true; 42 - # To fix `npm ERR! Your cache folder contains root-owned files` 43 - makeCacheWritable = true; 44 - 45 - npmDepsHash = "sha256-N48+C3NNPYg/rOpnRNmkZfZU/ZHp8imrG/tiDaMGsCE="; 45 + # FIXME: This is a workaround, because we have a git dependency node_modules/lrc-kit contains install scripts 46 + # but has no lockfile, which is something that will probably break. 47 + forceGitDeps = true; 46 48 47 - postBuild = '' 48 - cp -r dist/ $out 49 - ''; 49 + npmDeps = fetchNpmDeps { 50 + name = "lrcget-${version}-npm-deps"; 51 + inherit src forceGitDeps; 52 + hash = "sha256-N48+C3NNPYg/rOpnRNmkZfZU/ZHp8imrG/tiDaMGsCE="; 50 53 }; 51 54 52 - # copy the frontend static resources to final build directory 53 - # Also modify tauri.conf.json so that it expects the resources at the new location 54 - postPatch = '' 55 - cp -r $frontend ./frontend 56 - 57 - substituteInPlace tauri.conf.json \ 58 - --replace-fail '"frontendDist": "../dist"' '"frontendDist": "./frontend"' 59 - ''; 60 - 61 - nativeBuildInputs = [ 62 - pkg-config 63 - wrapGAppsHook3 64 - copyDesktopItems 65 - rustPlatform.bindgenHook 66 - ]; 67 - 68 - buildInputs = 55 + nativeBuildInputs = 69 56 [ 70 - dbus 71 - openssl 72 - gtk3 57 + cargo-tauri.hook 58 + nodejs 59 + npmHooks.npmConfigHook 60 + rustPlatform.bindgenHook 73 61 ] 74 62 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ 75 - webkitgtk_4_1 76 - alsa-lib 63 + pkg-config 64 + wrapGAppsHook3 65 + ] 66 + ++ lib.optionals stdenv.hostPlatform.isDarwin [ 67 + makeBinaryWrapper 77 68 ]; 78 69 70 + buildInputs = lib.optionals (!stdenv.hostPlatform.isDarwin) [ 71 + alsa-lib 72 + openssl 73 + webkitgtk_4_1 74 + ]; 75 + 76 + # To fix `npm ERR! Your cache folder contains root-owned files` 77 + makeCacheWritable = true; 78 + 79 79 # Disable checkPhase, since the project doesn't contain tests 80 80 doCheck = false; 81 81 82 - postInstall = '' 83 - install -DT icons/128x128@2x.png $out/share/icons/hicolor/128x128@2/apps/lrcget.png 84 - install -DT icons/128x128.png $out/share/icons/hicolor/128x128/apps/lrcget.png 85 - install -DT icons/32x32.png $out/share/icons/hicolor/32x32/apps/lrcget.png 82 + # make the binary also runnable from the shell 83 + postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' 84 + makeWrapper "$out/Applications/LRCGET.app/Contents/MacOS/LRCGET" "$out/bin/LRCGET" 86 85 ''; 87 86 88 - # WEBKIT_DISABLE_COMPOSITING_MODE essential in NVIDIA + compositor https://github.com/NixOS/nixpkgs/issues/212064#issuecomment-1400202079 89 - postFixup = '' 90 - wrapProgram "$out/bin/lrcget" \ 87 + preFixup = lib.optionalString (!stdenv.hostPlatform.isDarwin) '' 88 + gappsWrapperArgs+=( 89 + # WEBKIT_DISABLE_COMPOSITING_MODE essential in NVIDIA + compositor https://github.com/NixOS/nixpkgs/issues/212064#issuecomment-1400202079 91 90 --set WEBKIT_DISABLE_COMPOSITING_MODE 1 91 + ) 92 92 ''; 93 93 94 - desktopItems = [ 95 - (makeDesktopItem { 96 - name = "LRCGET"; 97 - exec = "lrcget"; 98 - icon = "lrcget"; 99 - desktopName = "LRCGET"; 100 - comment = meta.description; 101 - }) 102 - ]; 103 - 104 94 passthru.updateScript = nix-update-script { }; 105 95 106 96 meta = { ··· 112 102 anas 113 103 Scrumplex 114 104 ]; 115 - mainProgram = "lrcget"; 105 + mainProgram = "LRCGET"; 116 106 platforms = with lib.platforms; unix ++ windows; 117 107 }; 118 108 }
+13
pkgs/by-name/lr/lrcget/remove-signing-identity.patch
··· 1 + diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json 2 + index 92d43e7..6519fd0 100644 3 + --- a/src-tauri/tauri.conf.json 4 + +++ b/src-tauri/tauri.conf.json 5 + @@ -36,7 +36,7 @@ 6 + "exceptionDomain": "", 7 + "frameworks": [], 8 + "providerShortName": null, 9 + - "signingIdentity": "-" 10 + + "signingIdentity": null 11 + }, 12 + "resources": [], 13 + "shortDescription": "Utility for mass-downloading LRC synced lyrics for your offline music library.",