Skip to content

Commit

Permalink
feat: create a separate docs devshell
Browse files Browse the repository at this point in the history
Removes dependency on latest build of treefmt from inside the repo.

Signed-off-by: Brian McGee <[email protected]>
  • Loading branch information
brianmcgee committed Oct 4, 2024
1 parent 94301f1 commit 6cadbbc
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 27 deletions.
27 changes: 1 addition & 26 deletions nix/devshells/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,8 @@ perSystem.self.treefmt.overrideAttrs (old: {
pkgs.delve
pkgs.pprof
pkgs.graphviz
pkgs.nodejs
]
++
# include formatters for development and testing
(import ../packages/treefmt/formatters.nix pkgs)
# docs related helpers
++ (let
docs = command:
pkgs.writeShellApplication {
name = "docs:${command}";
runtimeInputs = [pkgs.nodejs];
text = ''cd "''${DIRENV_DIR:1}/docs" && npm ci && npm run ${command}'';
};
in [
(docs "dev")
(docs "build")
(docs "preview")
(pkgs.writeShellApplication {
name = "vhs";
runtimeInputs =
[
perSystem.self.treefmt
pkgs.rsync
pkgs.vhs
]
++ (import ../packages/treefmt/formatters.nix pkgs);
text = ''vhs "$@"'';
})
]);
(import ../packages/treefmt/formatters.nix pkgs);
})
30 changes: 30 additions & 0 deletions nix/devshells/docs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
pkgs,
perSystem,
...
}:
pkgs.mkShellNoCC {
packages = let
docs = command:
pkgs.writeShellApplication {
name = "docs:${command}";
runtimeInputs = [pkgs.nodejs];
text = ''cd "''${DIRENV_DIR:1}/docs" && npm ci && npm run ${command}'';
};
in [
(docs "dev")
(docs "build")
(docs "preview")
(pkgs.writeShellApplication {
name = "vhs";
runtimeInputs =
[
perSystem.self.treefmt
pkgs.rsync
pkgs.vhs
]
++ (import ../packages/treefmt/formatters.nix pkgs);
text = ''vhs "$@"'';
})
];
}
1 change: 0 additions & 1 deletion nix/formatter.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
pkgs,
inputs,
perSystem,
...
}:
inputs.treefmt-nix.lib.mkWrapper pkgs {
Expand Down

0 comments on commit 6cadbbc

Please sign in to comment.