tvl-depot/users/sterni/exercises/aoc/2022/default.nix
sterni 5c748780b5 fix(sterni/aoc/2022): make solutions executable in bqn drv
BQNLIBS dependency also needs to be provided in the derivation running
all solutions.

Change-Id: I704369127ab92a52c7e4b21de8b7982fb8328f9d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7662
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
2022-12-28 12:20:41 +00:00

53 lines
1.1 KiB
Nix

{ depot, pkgs, lib, ... }:
let
inherit (pkgs.buildPackages) cbqn ngn-k;
# input files are not checked in
meta.ci.skip = true;
BQNLIBS = pkgs.fetchFromGitHub {
owner = "mlochbaum";
repo = "bqn-libs";
rev = "d56d8ea0b8c294fac7274678d9ab112553a03f42";
sha256 = "1c1bkqj62v8m13jgaa32ridy0fk5iqysq5b2qwxbqxhky5zwnk9h";
};
in
depot.nix.readTree.drvTargets {
shell = pkgs.mkShell {
name = "aoc-2022-shell";
packages = [
cbqn
ngn-k
];
inherit BQNLIBS;
};
bqn = pkgs.runCommand "bqn-aoc-2022"
{
nativeBuildInputs = [
cbqn
];
aoc = builtins.path {
name = "bqn-aoc-2022";
path = ./../.;
# Need lib.bqn from ../ and all inputs as well as bqn files from ./*
filter = path: type:
lib.hasSuffix ".bqn" path || (
lib.hasPrefix (toString ./.) path
&& (
type == "directory"
|| lib.hasSuffix "/input" path
)
);
};
inherit meta BQNLIBS;
}
''
find "$aoc/2022" -name '*.bqn' -exec BQN {} \; | tee "$out"
'';
}