nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 98 lines 2.3 kB view raw
1{ 2 lib, 3 stdenv, 4 nodejs, 5 pnpm_10, 6 fetchPnpmDeps, 7 pnpmConfigHook, 8 fetchFromGitHub, 9 gitMinimal, 10 nix-update-script, 11}: 12stdenv.mkDerivation (finalAttrs: { 13 pname = "cspell"; 14 version = "9.6.2"; 15 16 src = fetchFromGitHub { 17 owner = "streetsidesoftware"; 18 repo = "cspell"; 19 tag = "v${finalAttrs.version}"; 20 hash = "sha256-JEvvopeSqoVXrh9t4ORUlT0nPdE+3PofzD7h4VajnAs="; 21 }; 22 23 pnpmWorkspaces = [ "cspell..." ]; 24 25 pnpmDeps = fetchPnpmDeps { 26 inherit (finalAttrs) 27 pname 28 version 29 src 30 pnpmWorkspaces 31 ; 32 pnpm = pnpm_10; 33 fetcherVersion = 2; 34 hash = "sha256-CNsxfAsIQxmDvuGZtedKnHMOoB1usDlw45cKYxaD05U="; 35 }; 36 37 nativeBuildInputs = [ 38 nodejs 39 pnpmConfigHook 40 pnpm_10 41 ]; 42 43 buildInputs = [ 44 nodejs 45 gitMinimal 46 ]; 47 48 buildPhase = '' 49 runHook preBuild 50 51 pnpm --filter "cspell..." build 52 53 runHook postBuild 54 ''; 55 56 # Make PNPM happy to re-install deps for prod 57 env.CI = true; 58 59 installPhase = '' 60 runHook preInstall 61 62 mkdir -p $out/lib/node_modules/cspell 63 mkdir $out/bin 64 65 # Re-install only production dependencies 66 rm -rf node_modules packages/*/node_modules scripts/node_modules 67 pnpm config set nodeLinker hoisted 68 pnpm config set preferSymlinkedExecutables false 69 pnpm --filter="cspell..." --offline --prod install 70 71 mv ./package.json ./packages ./bin.mjs ./node_modules $out/lib/node_modules/cspell 72 # Clean up unneeded files 73 pushd $out/lib/node_modules/cspell/packages 74 rm -rf */*.md */tsconfig.* */LICENSE Samples */**/*.test.{j,t}s */**/*.map */__snapshots__ */src */Samples 75 # These are example dictionaries, and are not needed 76 rm -rf hunspell-reader/dictionaries 77 pushd cspell 78 rm -rf dist/tsc 79 rm -rf samples/ fixtures/ tools/ static/ 80 popd 81 popd 82 83 ln -s $out/lib/node_modules/cspell/bin.mjs $out/bin/cspell 84 85 runHook postInstall 86 ''; 87 88 passthru.updateScript = nix-update-script { }; 89 90 meta = { 91 description = "Spell checker for code"; 92 homepage = "https://cspell.org"; 93 changelog = "https://github.com/streetsidesoftware/cspell/releases/tag/v${finalAttrs.version}"; 94 license = lib.licenses.mit; 95 mainProgram = "cspell"; 96 maintainers = [ lib.maintainers.pyrox0 ]; 97 }; 98})