ni: init at 23.3.1 (#383088)

This commit is contained in:
Gaétan Lepage
2025-02-24 08:07:43 +01:00
committed by GitHub
+66
View File
@@ -0,0 +1,66 @@
{
lib,
stdenv,
fetchFromGitHub,
nodejs,
pnpm_9,
npmHooks,
versionCheckHook,
nix-update-script,
}:
let
pnpm = pnpm_9;
in
stdenv.mkDerivation (finalAttrs: {
pname = "ni";
version = "23.3.1";
src = fetchFromGitHub {
owner = "antfu-collective";
repo = "ni";
tag = "v${finalAttrs.version}";
hash = "sha256-jkynuN7w0YaIYQLX0KsEQWqrXkhvh3qKSLK63A/7mx8=";
};
pnpmDeps = pnpm.fetchDeps {
inherit (finalAttrs) pname version src;
hash = "sha256-gDBjAwut217mdbWyk/dSU4JOkoRbOk4Czlb/lXhWqRU=";
};
nativeBuildInputs = [
nodejs
pnpm.configHook
npmHooks.npmInstallHook
];
buildPhase = ''
runHook preBuild
pnpm run build
find dist -type f \( -name '*.cjs' -or -name '*.cts' -or -name '*.ts' \) -delete
runHook postBuild
'';
dontNpmPrune = true;
postInstall = ''
rm -rf $out/lib/node_modules/@antfu/ni/node_modules
'';
nativeInstallCheckInputs = [
versionCheckHook
];
versionCheckProgramArg = [ "--version" ];
doInstallCheck = true;
passthru.updateScript = nix-update-script { };
meta = {
description = "Use the right package manager";
homepage = "https://github.com/antfu-collective/ni";
changelog = "https://github.com/antfu-collective/ni/releases/tag/v${finalAttrs.version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ xiaoxiangmoe ];
mainProgram = "ni";
};
})