From 514c48fdde64659bb66aa35b50f0339275b3722a Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 9 Dec 2019 11:44:21 +0000 Subject: feat(tools): Set up Advent of Code 2019 scaffolding --- tools/aoc2019/default.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tools/aoc2019/default.nix (limited to 'tools/aoc2019') diff --git a/tools/aoc2019/default.nix b/tools/aoc2019/default.nix new file mode 100644 index 000000000000..3c10ea88b1c8 --- /dev/null +++ b/tools/aoc2019/default.nix @@ -0,0 +1,22 @@ +# Solutions for Advent of Code 2019, written in Emacs Lisp. +# +# For each day a new file is created as "solution-day$n.el". +{ pkgs, ... }: + +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 = pkgs.writeElispBin { + name = "solution-${day}"; + deps = p: with p; [ dash s ht ]; + src = ./. + ("/" + f); + }; + }) solutionFiles; +in listToAttrs solutions -- cgit 1.4.1