tvl-depot/users/tazjin/aoc2020/default.nix
Vincent Ambo 6aa6151146 feat(tazjin/aoc2020): Add solution for day 1
Change-Id: I9c5e7f69cac1940ddeb7932d4450e2bd3764e1f5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2213
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2020-12-01 12:55:59 +00:00

22 lines
696 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 {
name = day;
value = depot.nix.writeElispBin {
name = "aoc2020";
deps = p: with p; [ dash s ht ];
src = ./. + ("/" + f);
};
}) solutionFiles;
in listToAttrs solutions