improve shelf hiearchy
This commit is contained in:
parent
928c1067b3
commit
9c18a0c924
5 changed files with 46 additions and 18 deletions
15
flake.nix
15
flake.nix
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
description = "Deno development environment";
|
description = "Grimu-R base";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
|
@ -10,23 +10,16 @@
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
denoWorkspace = import ./shelf/deno-workspace.nix {
|
shelf = import ./shelf {
|
||||||
inherit pkgs system;
|
inherit pkgs system;
|
||||||
# collective hash of all deno sources - resulting shared deno cache hash
|
|
||||||
knownDenoHashes = {
|
|
||||||
"UnKGEQo7oF1X5JeWyx7w0oCwqPQ=" =
|
|
||||||
"sha256-7csbrTbGd6J4a0Gkj9ndKhNxv90KeOHjr7DDNal3L4Q=";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
packages.shelf = shelf;
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
buildInputs = [ ];
|
buildInputs = [ ];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export DENO_DIR=$PWD/.deno_cache
|
${shelf.setupScript}
|
||||||
rm -rf $DENO_DIR
|
|
||||||
cp -r ${denoWorkspace} $DENO_DIR
|
|
||||||
chmod -R u+w "$DENO_DIR"
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
24
shelf/default.nix
Normal file
24
shelf/default.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
{ 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"
|
||||||
|
|
||||||
|
# TODO: add other interpreters
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
setupScript = shelfSetup;
|
||||||
|
}
|
||||||
|
|
@ -15,9 +15,9 @@ let
|
||||||
hash = "sha256-ukIk8K2CE+N+3eFs++RPiGZlhhRRVk1gjhdt77/s+4o=";
|
hash = "sha256-ukIk8K2CE+N+3eFs++RPiGZlhhRRVk1gjhdt77/s+4o=";
|
||||||
};
|
};
|
||||||
|
|
||||||
scrollsDir = ./deno;
|
scrollsDir = ./.;
|
||||||
lib = pkgs.lib;
|
lib = pkgs.lib;
|
||||||
packageDirs = builtins.attrNames (builtins.readDir scrollsDir);
|
packageDirs = [ "./hjq" "./uses-hjq" ];
|
||||||
|
|
||||||
# hash only dependency-relevant files (lock files and configs)
|
# hash only dependency-relevant files (lock files and configs)
|
||||||
hashDependencyFiles = dir:
|
hashDependencyFiles = dir:
|
||||||
|
|
@ -98,4 +98,6 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
unifiedCache
|
{
|
||||||
|
cache = unifiedCache;
|
||||||
|
}
|
||||||
|
|
@ -4,12 +4,21 @@
|
||||||
description = "Drop-in jq replacement for HJSON that tries to preserve comments";
|
description = "Drop-in jq replacement for HJSON that tries to preserve comments";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
stdin = "HJSON";
|
stdin = {
|
||||||
jq_filter = "string";
|
format = "HJSON";
|
||||||
|
react = "push";
|
||||||
|
};
|
||||||
|
jq_filter = {
|
||||||
|
format = "string";
|
||||||
|
react = "push";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = {
|
||||||
stdout = "HJSON";
|
stdout = {
|
||||||
|
format = "HJSON";
|
||||||
|
react = "push";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
cache-command = "deno cache --reload main.ts";
|
cache-command = "deno cache --reload main.ts";
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"tasks": {
|
"tasks": {
|
||||||
"start": "deno run --cached-only main.ts"
|
"start": "deno run --cached-only main.ts"
|
||||||
},
|
},
|
||||||
"links": [
|
"patch": [
|
||||||
"../hjq"
|
"../hjq"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue