about summary refs log tree commit diff
path: root/users/tazjin/aoc2020/default.nix
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-12-01T12·49+0100
committertazjin <mail@tazj.in>2020-12-01T12·55+0000
commit6aa6151146eb42a4ef5a1d770bdbfbc281399d4f (patch)
tree4873f9fc69210b76e5eb440a92432aeac1b843e6 /users/tazjin/aoc2020/default.nix
parent87f1e15baa5491dcfd1b66102909d1ba1b75c175 (diff)
feat(tazjin/aoc2020): Add solution for day 1 r/1972
Change-Id: I9c5e7f69cac1940ddeb7932d4450e2bd3764e1f5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2213
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
Diffstat (limited to 'users/tazjin/aoc2020/default.nix')
-rw-r--r--users/tazjin/aoc2020/default.nix22
1 files changed, 22 insertions, 0 deletions
diff --git a/users/tazjin/aoc2020/default.nix b/users/tazjin/aoc2020/default.nix
new file mode 100644
index 000000000000..830b1f7cd3e8
--- /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