doc: add some devshell helpers
Signed-off-by: Brian McGee <brian@bmcgee.ie>
This commit is contained in:
parent
3b623c3307
commit
ab2d9ef0f3
48
nix/docs.nix
48
nix/docs.nix
@ -1,28 +1,50 @@
|
|||||||
_: {
|
_: {
|
||||||
perSystem = {pkgs, self', ...}: {
|
perSystem = {
|
||||||
packages.docs = pkgs.buildNpmPackage {
|
pkgs,
|
||||||
pname = "treefmt-docs";
|
self',
|
||||||
inherit (self'.packages.default) version;
|
...
|
||||||
|
}: {
|
||||||
|
packages.docs = pkgs.buildNpmPackage {
|
||||||
|
pname = "treefmt-docs";
|
||||||
|
inherit (self'.packages.default) version;
|
||||||
|
|
||||||
src = ../docs;
|
src = ../docs;
|
||||||
npmDepsHash = "sha256-acT9uaUhvxyM/S3hv1M9h5h2H5EpzrNbaxCYmzYn100=";
|
npmDepsHash = "sha256-acT9uaUhvxyM/S3hv1M9h5h2H5EpzrNbaxCYmzYn100=";
|
||||||
|
|
||||||
npmBuildScript = "docs:build";
|
npmBuildScript = "docs:build";
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
cp -rv .vitepress/dist/ $out
|
cp -rv .vitepress/dist/ $out
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
devshells.default = {
|
devshells.default = {
|
||||||
|
packages = [
|
||||||
|
pkgs.nodejs
|
||||||
|
];
|
||||||
|
|
||||||
commands = let
|
commands = let
|
||||||
category = "docs";
|
category = "docs";
|
||||||
in [
|
in [
|
||||||
{
|
{
|
||||||
inherit category;
|
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;
|
inherit category;
|
||||||
|
Reference in New Issue
Block a user