Skip to content

Commit 6cadbbc

Browse files
committed
feat: create a separate docs devshell
Removes dependency on latest build of treefmt from inside the repo. Signed-off-by: Brian McGee <[email protected]>
1 parent 94301f1 commit 6cadbbc

File tree

3 files changed

+31
-27
lines changed

3 files changed

+31
-27
lines changed

nix/devshells/default.nix

+1-26
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,8 @@ perSystem.self.treefmt.overrideAttrs (old: {
1919
pkgs.delve
2020
pkgs.pprof
2121
pkgs.graphviz
22-
pkgs.nodejs
2322
]
2423
++
2524
# include formatters for development and testing
26-
(import ../packages/treefmt/formatters.nix pkgs)
27-
# docs related helpers
28-
++ (let
29-
docs = command:
30-
pkgs.writeShellApplication {
31-
name = "docs:${command}";
32-
runtimeInputs = [pkgs.nodejs];
33-
text = ''cd "''${DIRENV_DIR:1}/docs" && npm ci && npm run ${command}'';
34-
};
35-
in [
36-
(docs "dev")
37-
(docs "build")
38-
(docs "preview")
39-
(pkgs.writeShellApplication {
40-
name = "vhs";
41-
runtimeInputs =
42-
[
43-
perSystem.self.treefmt
44-
pkgs.rsync
45-
pkgs.vhs
46-
]
47-
++ (import ../packages/treefmt/formatters.nix pkgs);
48-
text = ''vhs "$@"'';
49-
})
50-
]);
25+
(import ../packages/treefmt/formatters.nix pkgs);
5126
})

nix/devshells/docs.nix

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
pkgs,
3+
perSystem,
4+
...
5+
}:
6+
pkgs.mkShellNoCC {
7+
packages = let
8+
docs = command:
9+
pkgs.writeShellApplication {
10+
name = "docs:${command}";
11+
runtimeInputs = [pkgs.nodejs];
12+
text = ''cd "''${DIRENV_DIR:1}/docs" && npm ci && npm run ${command}'';
13+
};
14+
in [
15+
(docs "dev")
16+
(docs "build")
17+
(docs "preview")
18+
(pkgs.writeShellApplication {
19+
name = "vhs";
20+
runtimeInputs =
21+
[
22+
perSystem.self.treefmt
23+
pkgs.rsync
24+
pkgs.vhs
25+
]
26+
++ (import ../packages/treefmt/formatters.nix pkgs);
27+
text = ''vhs "$@"'';
28+
})
29+
];
30+
}

nix/formatter.nix

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
pkgs,
33
inputs,
4-
perSystem,
54
...
65
}:
76
inputs.treefmt-nix.lib.mkWrapper pkgs {

0 commit comments

Comments
 (0)