From 18b124840feaf69c7cff3914d9258cc2a2b0ce25 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Sun, 5 May 2024 12:34:40 +0200 Subject: [PATCH] kiwitalk: use pnpm.fetchDeps Signed-off-by: Sefa Eyeoglu --- pkgs/by-name/ki/kiwitalk/package.nix | 60 +++++----------------------- pkgs/top-level/all-packages.nix | 2 + 2 files changed, 12 insertions(+), 50 deletions(-) diff --git a/pkgs/by-name/ki/kiwitalk/package.nix b/pkgs/by-name/ki/kiwitalk/package.nix index 2a581feb2684..23e87bdb43c3 100644 --- a/pkgs/by-name/ki/kiwitalk/package.nix +++ b/pkgs/by-name/ki/kiwitalk/package.nix @@ -2,7 +2,6 @@ , fetchFromGitHub , copyDesktopItems , stdenv -, stdenvNoCC , rustc , rustPlatform , cargo @@ -12,20 +11,18 @@ , webkitgtk , pkg-config , makeDesktopItem -, jq -, moreutils -, nodePackages -, cacert +, pnpm +, nodejs }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "kiwitalk"; version = "0.5.1"; src = fetchFromGitHub { owner = "KiwiTalk"; repo = "KiwiTalk"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; hash = "sha256-Th8q+Zbc102fIk2v7O3OOeSriUV/ydz60QwxzmS7AY8="; }; @@ -34,43 +31,9 @@ stdenv.mkDerivation rec { --replace "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1" ''; - pnpm-deps = stdenvNoCC.mkDerivation { - pname = "${pname}-pnpm-deps"; - inherit src version; - - nativeBuildInputs = [ - jq - moreutils - nodePackages.pnpm - cacert - ]; - - installPhase = '' - export HOME=$(mktemp -d) - pnpm config set store-dir $out - # This version of the package has different versions of esbuild as a dependency. - # You can use the command below to get esbuild binaries for a specific platform and calculate hashes for that platforms. (linux, darwin for os, and x86, arm64, ia32 for cpu) - # cat package.json | jq '.pnpm.supportedArchitectures += { "os": ["linux"], "cpu": ["arm64"] }' | sponge package.json - pnpm install --frozen-lockfile --ignore-script - - # Remove timestamp and sort the json files. - rm -rf $out/v3/tmp - for f in $(find $out -name "*.json"); do - sed -i -E -e 's/"checkedAt":[0-9]+,//g' $f - jq --sort-keys . $f | sponge $f - done - ''; - - dontBuild = true; - dontFixup = true; - outputHashMode = "recursive"; - outputHash = { - x86_64-linux = "sha256-LJPjWNpVfdUu8F5BMhAzpTo/h6ax7lxY2EESHj5P390="; - aarch64-linux = "sha256-N1K4pV5rbWmO/KonvYegzBoWa6TYQIqhQyxH/sWjOJQ="; - i686-linux = "sha256-/Q7VZahYhLdKVFB25CanROYxD2etQOcRg+4bXZUMqTc="; - x86_64-darwin = "sha256-9biFAbFD7Bva7KPKztgCvcaoX8E6AlJBKkjlDQdP6Zw="; - aarch64-darwin = "sha256-to5Y0R9tm9b7jUQAK3eBylLhpu+w5oDd63FbBCBAvd8="; - }.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}"); + pnpmDeps = pnpm.fetchDeps { + inherit (finalAttrs) pname version src; + hash = "sha256-gf3vmKUta8KksUOxyhQS4UO6ycAJDfEicyXVGMW8+4c="; }; cargoDeps = rustPlatform.importCargoLock { @@ -86,7 +49,8 @@ stdenv.mkDerivation rec { cargo rustc cargo-tauri - nodePackages.pnpm + nodejs + pnpm.configHook copyDesktopItems pkg-config ]; @@ -98,10 +62,6 @@ stdenv.mkDerivation rec { ]; preBuild = '' - export HOME=$(mktemp -d) - pnpm config set store-dir ${pnpm-deps} - pnpm install --offline --frozen-lockfile --ignore-script - pnpm rebuild cargo tauri build -b deb ''; @@ -131,4 +91,4 @@ stdenv.mkDerivation rec { platforms = platforms.linux ++ platforms.darwin; mainProgram = "kiwi-talk"; }; - } +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 82ba984341b3..f50e956b7794 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -32126,6 +32126,8 @@ with pkgs; kitsas = libsForQt5.callPackage ../applications/office/kitsas { }; + kiwitalk = callPackage ../by-name/ki/kiwitalk/package.nix { pnpm = pnpm_8; }; + kiwix = libsForQt5.callPackage ../applications/misc/kiwix { }; kiwix-tools = callPackage ../applications/misc/kiwix/tools.nix { };