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
This commit is contained in:
parent
87f1e15baa
commit
6aa6151146
2 changed files with 66 additions and 0 deletions
22
users/tazjin/aoc2020/default.nix
Normal file
22
users/tazjin/aoc2020/default.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue