-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dba9a47
commit 6eae42e
Showing
1 changed file
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{ | ||
lib, | ||
stdenvNoCC, | ||
fetchFromGitHub, | ||
makeBinaryWrapper, | ||
nodejs, | ||
pnpm_9, | ||
testers, | ||
shadcn, | ||
}: | ||
|
||
stdenvNoCC.mkDerivation (finalAttrs: { | ||
pname = "shadcn"; | ||
version = "2.0.3"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "shadcn-ui"; | ||
repo = "ui"; | ||
rev = "shadcn@${finalAttrs.version}"; | ||
hash = "sha256-OBLKCj+v5KgYslJGuwLgJHjgcrxLPiiyO5/ucrJ14Ws="; | ||
}; | ||
|
||
pnpmWorkspace = "shadcn"; | ||
pnpmDeps = pnpm_9.fetchDeps { | ||
inherit (finalAttrs) | ||
pname | ||
version | ||
src | ||
pnpmWorkspace | ||
; | ||
hash = "sha256-OcoZfbB04CFHpAM/fW3IhIMXtas6x8H3+lvk7nTN8Tg="; | ||
}; | ||
|
||
nativeBuildInputs = [ | ||
makeBinaryWrapper | ||
nodejs | ||
pnpm_9.configHook | ||
]; | ||
|
||
buildPhase = '' | ||
runHook preBuild | ||
pnpm run shadcn:build | ||
runHook postBuild | ||
''; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out/{bin,lib} | ||
cp -r {packages,node_modules} $out/lib | ||
# cleanup | ||
rm -r $out/lib/packages/{cli,shadcn/src} | ||
find $out/lib/packages/shadcn -name '*.ts' -delete | ||
makeWrapper ${lib.getExe nodejs} $out/bin/shadcn \ | ||
--inherit-argv0 \ | ||
--add-flags $out/lib/packages/shadcn/dist/index.js | ||
runHook postInstall | ||
''; | ||
|
||
passthru.tests.version = testers.testVersion { | ||
package = shadcn; | ||
command = "shadcn --version"; | ||
version = finalAttrs.version; | ||
}; | ||
|
||
meta = { | ||
changelog = "https://github.com/shadcn-ui/ui/blob/${finalAttrs.src.rev}/packages/shadcn/CHANGELOG.md#${ | ||
builtins.replaceStrings [ "." ] [ "" ] finalAttrs.version | ||
}"; | ||
description = "Beautifully designed components that you can copy and paste into your apps"; | ||
homepage = "https://ui.shadcn.com/docs/cli"; | ||
license = lib.licenses.mit; | ||
mainProgram = "shadcn"; | ||
maintainers = with lib.maintainers; [ getpsyched ]; | ||
platforms = lib.platforms.all; | ||
}; | ||
}) |