tvl-depot/users/tazjin/aoc2020/default.nix
Vincent Ambo a8371b01df refactor(tazjin/aoc2020): Build all solutions in CI
This changes the structure of the output, too, where all AoC solutions
now end up in a big folder with `bin/day$n` executables.

Change-Id: I77928f4129489d06779b50059835925652688c9c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2231
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2020-12-06 13:02:31 +00:00

22 lines
710 B
Nix

# Solutions for Advent of Code 2020, written in Emacs Lisp.
#
# For each day a new file is created as "solution-day$n.el".
{ depot, ... }:
let
inherit (builtins) attrNames filter head listToAttrs match readDir;
dir = readDir ./.;
matchSolution = match "solution-(.*)\.el";
isSolution = f: (matchSolution f) != null;
getDay = f: head (matchSolution f);
solutionFiles = filter (e: dir."${e}" == "regular" && isSolution e) (attrNames dir);
solutions = map (f: let day = getDay f; in depot.nix.writeElispBin {
name = day;
deps = p: with p; [ dash s ht p.f ];
src = ./. + ("/" + f);
}) solutionFiles;
in depot.third_party.symlinkJoin {
name = "aoc2020";
paths = solutions;
}