From 6cadbbc00af449bd0332e0f8a0079fbc24cfe3a7 Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Fri, 4 Oct 2024 14:38:09 +0100 Subject: [PATCH] feat: create a separate docs devshell Removes dependency on latest build of treefmt from inside the repo. Signed-off-by: Brian McGee --- nix/devshells/default.nix | 27 +-------------------------- nix/devshells/docs.nix | 30 ++++++++++++++++++++++++++++++ nix/formatter.nix | 1 - 3 files changed, 31 insertions(+), 27 deletions(-) create mode 100644 nix/devshells/docs.nix diff --git a/nix/devshells/default.nix b/nix/devshells/default.nix index 2d243f16..7d12631e 100644 --- a/nix/devshells/default.nix +++ b/nix/devshells/default.nix @@ -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); }) diff --git a/nix/devshells/docs.nix b/nix/devshells/docs.nix new file mode 100644 index 00000000..82bd0f58 --- /dev/null +++ b/nix/devshells/docs.nix @@ -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 "$@"''; + }) + ]; +} diff --git a/nix/formatter.nix b/nix/formatter.nix index dc8d2443..daffed5e 100644 --- a/nix/formatter.nix +++ b/nix/formatter.nix @@ -1,7 +1,6 @@ { pkgs, inputs, - perSystem, ... }: inputs.treefmt-nix.lib.mkWrapper pkgs {