mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-11 18:32:23 +08:00
It is more common to specify hash as the last attribute of fetcher
function args. Let's move fetcherVersion right above hash for all
occurrences.
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
(cherry picked from commit a8c9a2aa3e)
68 lines
1.4 KiB
Nix
68 lines
1.4 KiB
Nix
{
|
|
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;
|
|
fetcherVersion = 1;
|
|
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";
|
|
};
|
|
})
|