From 6aa6151146eb42a4ef5a1d770bdbfbc281399d4f Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 1 Dec 2020 13:49:17 +0100 Subject: feat(tazjin/aoc2020): Add solution for day 1 Change-Id: I9c5e7f69cac1940ddeb7932d4450e2bd3764e1f5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2213 Reviewed-by: tazjin Tested-by: BuildkiteCI --- users/tazjin/aoc2020/default.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 users/tazjin/aoc2020/default.nix (limited to 'users/tazjin/aoc2020/default.nix') diff --git a/users/tazjin/aoc2020/default.nix b/users/tazjin/aoc2020/default.nix new file mode 100644 index 0000000000..830b1f7cd3 --- /dev/null +++ b/users/tazjin/aoc2020/default.nix @@ -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 -- cgit 1.4.1