make cache dir configurable
This commit is contained in:
parent
e50afb2a22
commit
4cef3f1fd0
3 changed files with 5 additions and 7 deletions
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
perSystem = { config, pkgs, ... }: {
|
perSystem = { config, pkgs, ... }: {
|
||||||
deno-with-packages.lockfiles = [ ./deno.lock ];
|
deno-with-packages.lockfiles = [ ./deno.lock ];
|
||||||
|
deno-with-packages.dir = "$FLAKE_ROOT/.deno_cache";
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
inputsFrom = [ config.flake-root.devShell ];
|
inputsFrom = [ config.flake-root.devShell ];
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ in
|
||||||
default = impl.denoWithCache {
|
default = impl.denoWithCache {
|
||||||
baseDeno = config.deno-with-packages.basePackage;
|
baseDeno = config.deno-with-packages.basePackage;
|
||||||
sharedCache = config.deno-with-packages.cache;
|
sharedCache = config.deno-with-packages.cache;
|
||||||
|
dir = config.deno-with-packages.dir;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
10
impl.nix
10
impl.nix
|
|
@ -109,16 +109,12 @@ EOF
|
||||||
'';
|
'';
|
||||||
|
|
||||||
denoWithCache =
|
denoWithCache =
|
||||||
{ baseDeno, sharedCache }:
|
{ baseDeno, sharedCache, dir }:
|
||||||
pkgs.writeShellScriptBin "deno" ''
|
pkgs.writeShellScriptBin "deno" ''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
if [ -n "''${FLAKE_ROOT:-}" ]; then
|
# Use configured dir, with support for FLAKE_ROOT variable expansion
|
||||||
CACHE_DIR="$FLAKE_ROOT/.deno_cache"
|
CACHE_DIR="${dir}"
|
||||||
else
|
|
||||||
echo "FLAKE_ROOT not set. Make sure you're using the flake-root devShell." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d "$CACHE_DIR" ] || [ ! "$(ls -A "$CACHE_DIR" 2>/dev/null)" ]; then
|
if [ ! -d "$CACHE_DIR" ] || [ ! "$(ls -A "$CACHE_DIR" 2>/dev/null)" ]; then
|
||||||
echo "Setting up Deno cache at: $CACHE_DIR" >&2
|
echo "Setting up Deno cache at: $CACHE_DIR" >&2
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue