Skip to content

Commit

Permalink
doc: add some devshell helpers
Browse files Browse the repository at this point in the history
Signed-off-by: Brian McGee <[email protected]>
  • Loading branch information
brianmcgee committed May 2, 2024
1 parent 7cc49e2 commit 95c6cdb
Showing 1 changed file with 35 additions and 13 deletions.
48 changes: 35 additions & 13 deletions nix/docs.nix
Original file line number Diff line number Diff line change
@@ -1,28 +1,50 @@
_: {
perSystem = {pkgs, self', ...}: {
packages.docs = pkgs.buildNpmPackage {
pname = "treefmt-docs";
inherit (self'.packages.default) version;
perSystem = {
pkgs,
self',
...
}: {
packages.docs = pkgs.buildNpmPackage {
pname = "treefmt-docs";
inherit (self'.packages.default) version;

src = ../docs;
npmDepsHash = "sha256-acT9uaUhvxyM/S3hv1M9h5h2H5EpzrNbaxCYmzYn100=";
src = ../docs;
npmDepsHash = "sha256-acT9uaUhvxyM/S3hv1M9h5h2H5EpzrNbaxCYmzYn100=";

npmBuildScript = "docs:build";
npmBuildScript = "docs:build";

installPhase = ''
runHook preInstall
cp -rv .vitepress/dist/ $out
runHook postInstall
'';
installPhase = ''
runHook preInstall
cp -rv .vitepress/dist/ $out
runHook postInstall
'';
};

devshells.default = {
packages = [
pkgs.nodejs
];

commands = let
category = "docs";
in [
{
inherit category;
package = pkgs.nodejs;
name = "docs:dev";
help = "serve docs for local development";
command = "cd $PRJ_ROOT/docs && npm run docs:dev";
}
{
inherit category;
name = "docs:build";
help = "create a production build of docs";
command = "cd $PRJ_ROOT/docs && npm run docs:build";
}
{
inherit category;
name = "docs:preview";
help = "preview a production build of docs";
command = "cd $PRJ_ROOT/docs && npm run docs:preview";
}
{
inherit category;
Expand Down

0 comments on commit 95c6cdb

Please sign in to comment.