From ac34ebbf149ec51387ea69eea6b9d8e2a1b29e7f Mon Sep 17 00:00:00 2001 From: Zexin Yuan Date: Wed, 9 Apr 2025 19:12:57 +0800 Subject: [PATCH] gitmoji-cli: 9.0.0 -> 9.6.0, modernize --- pkgs/by-name/gi/gitmoji-cli/package.nix | 74 ++++++++----------------- 1 file changed, 23 insertions(+), 51 deletions(-) diff --git a/pkgs/by-name/gi/gitmoji-cli/package.nix b/pkgs/by-name/gi/gitmoji-cli/package.nix index d46464012331..96291cf3d626 100644 --- a/pkgs/by-name/gi/gitmoji-cli/package.nix +++ b/pkgs/by-name/gi/gitmoji-cli/package.nix @@ -1,83 +1,55 @@ { lib, - stdenv, + stdenvNoCC, fetchFromGitHub, fetchYarnDeps, - makeWrapper, + yarnConfigHook, + yarnBuildHook, + yarnInstallHook, nodejs, - fixup-yarn-lock, - yarn, - testers, + versionCheckHook, + nix-update-script, }: -stdenv.mkDerivation (finalAttrs: { +stdenvNoCC.mkDerivation (finalAttrs: { pname = "gitmoji-cli"; - version = "9.0.0"; + version = "9.6.0"; src = fetchFromGitHub { owner = "carloscuesta"; repo = "gitmoji-cli"; rev = "v${finalAttrs.version}"; - hash = "sha256-cIc0AaP1AwhoVJLnonC9qvDWNZW4L6/jsQ3Q6z5VXI0="; + hash = "sha256-LhqwC7F0745KFzGHw9WUkPYxhIkFEmCPTxS1fuZKVHQ="; }; offlineCache = fetchYarnDeps { yarnLock = "${finalAttrs.src}/yarn.lock"; - hash = "sha256-HXMRCTiUti/GZ1dzd+XbFOao3+QLC1t7H0TT9MS5lz4="; + hash = "sha256-/O+UMOYn3dBgy2uBBCeg4vHzC+fXA+7fj7Xk03miZSA="; }; nativeBuildInputs = [ - makeWrapper + yarnConfigHook + yarnBuildHook + yarnInstallHook + # Needed for executing package.json scripts nodejs - fixup-yarn-lock - yarn ]; - configurePhase = '' - runHook preConfigure + nativeInstallCheckInputs = [ versionCheckHook ]; + doInstallCheck = true; + versionCheckProgram = "${placeholder "out"}/bin/gitmoji"; - export HOME=$(mktemp -d) - yarn config --offline set yarn-offline-mirror $offlineCache - fixup-yarn-lock yarn.lock - yarn --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive install - patchShebangs node_modules - - runHook postConfigure - ''; - - buildPhase = '' - runHook preBuild - - yarn --offline build - - runHook postBuild - ''; - - installPhase = '' - runHook preInstall - - yarn --offline --production install - - mkdir -p "$out/lib/node_modules/gitmoji-cli" - cp -r lib node_modules package.json "$out/lib/node_modules/gitmoji-cli" - - makeWrapper "${nodejs}/bin/node" "$out/bin/gitmoji" \ - --add-flags "$out/lib/node_modules/gitmoji-cli/lib/cli.js" - - runHook postInstall - ''; - - passthru.tests = { - version = testers.testVersion { - package = finalAttrs.finalPackage; - }; - }; + passthru.updateScript = nix-update-script { }; meta = { description = "Gitmoji client for using emojis on commit messages"; homepage = "https://github.com/carloscuesta/gitmoji-cli"; + changelog = "https://github.com/carloscuesta/gitmoji-cli/releases/tag/v${finalAttrs.version}"; license = lib.licenses.mit; mainProgram = "gitmoji"; - maintainers = with lib.maintainers; [ nequissimus ]; + maintainers = with lib.maintainers; [ + nequissimus + yzx9 + ]; }; })