deno per package cache derivations + hashes

This commit is contained in:
EatThePooh 2025-08-02 14:14:41 +07:00
parent 9c18a0c924
commit f459ec8b78
9 changed files with 203 additions and 133 deletions

View file

@ -1,24 +1,25 @@
{ pkgs, system }:
let
denoShelf = import ./deno {
inherit pkgs system;
# collective hash of all (relevant) deno sources
# mapped to resulting shared deno cache hash
knownDenoHashes = {
"2JQI9Ie/fkl5Ltr22BGJynF9tFc=" =
"sha256-7csbrTbGd6J4a0Gkj9ndKhNxv90KeOHjr7DDNal3L4Q=";
};
};
shelfSetup = pkgs.writeShellScript "setup-shelf" ''
export DENO_DIR=$PWD/.deno_cache
rm -rf $DENO_DIR
cp -r ${denoShelf.cache} $DENO_DIR
chmod -R u+w "$DENO_DIR"
{ pkgs, system, lib }:
let
denoScrollsDir = ./deno;
# TODO: add other interpreters
'';
mkScroll = subDir: lib.readDenoScroll {
inherit pkgs system subDir;
scrollsDir = denoScrollsDir;
};
scrolls = builtins.map mkScroll [
"hjq"
"uses-hjq"
];
shelfSetup =
lib.collectDenoCaches {
inherit pkgs;
denoCacheDrvs = builtins.map (s: s.env) scrolls;
};
in
{
setupScript = shelfSetup;
scrolls = builtins.map (s: s.meta) scrolls;
}