proper scrolls
This commit is contained in:
parent
d92bc3b437
commit
9df3f362fe
11 changed files with 146 additions and 36 deletions
63
shelf/deno-workspace.nix
Normal file
63
shelf/deno-workspace.nix
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
{ pkgs, system }:
|
||||
|
||||
let
|
||||
target =
|
||||
let
|
||||
arch = builtins.head (builtins.split "-" system);
|
||||
os = builtins.elemAt (builtins.split "-" system) 1;
|
||||
vendor = if os == "darwin" then "apple" else "unknown";
|
||||
sys = if os == "darwin" then "darwin" else "linux-gnu";
|
||||
in "${arch}-${vendor}-${sys}";
|
||||
|
||||
# currently unused, needed for deno compile
|
||||
denort = pkgs.fetchzip {
|
||||
url = "https://dl.deno.land/release/v${pkgs.deno.version}/denort-${target}.zip";
|
||||
hash = "sha256-ukIk8K2CE+N+3eFs++RPiGZlhhRRVk1gjhdt77/s+4o=";
|
||||
};
|
||||
|
||||
scrollsDir = ./deno;
|
||||
lib = pkgs.lib;
|
||||
packageDirs = builtins.attrNames (builtins.readDir scrollsDir);
|
||||
|
||||
# Separate FOD for cache only
|
||||
unifiedCache = pkgs.stdenv.mkDerivation {
|
||||
name = "deno-scrolls-cache";
|
||||
src = scrollsDir;
|
||||
|
||||
nativeBuildInputs = [ pkgs.deno pkgs.jq ];
|
||||
dontPatchShebangs = true;
|
||||
|
||||
buildPhase = ''
|
||||
export DENO_DIR=$out
|
||||
|
||||
${lib.concatStringsSep "\n" (map (pkg:
|
||||
let config = import (scrollsDir + "/${pkg}/scroll.nix");
|
||||
in ''
|
||||
echo "Caching ${pkg}..."
|
||||
cd ${pkg}
|
||||
${config.cache-command}
|
||||
cd ..
|
||||
''
|
||||
) packageDirs)}
|
||||
|
||||
echo 'Go fuck yourself, SQLite!'
|
||||
find $out -name "*-wal" -delete
|
||||
find $out -name "*-shm" -delete
|
||||
|
||||
echo 'Go fuck yourself, JSON!'
|
||||
find $out/npm -name "*.json" -type f 2>/dev/null | while read -r file; do
|
||||
if ${pkgs.jq}/bin/jq empty "$file" 2>/dev/null; then
|
||||
${pkgs.jq}/bin/jq -S . "$file" > "$file.tmp" && mv "$file.tmp" "$file"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
|
||||
installPhase = "true";
|
||||
|
||||
outputHashMode = "recursive";
|
||||
outputHashAlgo = "sha256";
|
||||
outputHash = "sha256-maP/JMY6n95A9FQx72YFwRtnprGXc97v1ZdPgt2GB8s=";
|
||||
};
|
||||
|
||||
in
|
||||
unifiedCache
|
||||
Loading…
Add table
Add a link
Reference in a new issue