2020-12-01 13:49:17 +01:00
|
|
|
# Solutions for Advent of Code 2020, written in Emacs Lisp.
|
|
|
|
#
|
|
|
|
# For each day a new file is created as "solution-day$n.el".
|
2021-04-10 18:05:16 +02:00
|
|
|
{ depot, pkgs, ... }:
|
2020-12-01 13:49:17 +01:00
|
|
|
|
|
|
|
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);
|
2020-12-06 13:59:48 +01:00
|
|
|
solutions = map
|
|
|
|
(f:
|
|
|
|
let day = getDay f; in depot.nix.writeElispBin {
|
|
|
|
name = day;
|
2020-12-02 10:56:38 +01:00
|
|
|
deps = p: with p; [ dash s ht p.f ];
|
2020-12-01 13:49:17 +01:00
|
|
|
src = ./. + ("/" + f);
|
|
|
|
})
|
|
|
|
solutionFiles;
|
2021-04-10 18:05:16 +02:00
|
|
|
in
|
|
|
|
pkgs.symlinkJoin {
|
2020-12-06 13:59:48 +01:00
|
|
|
name = "aoc2020";
|
|
|
|
paths = solutions;
|
|
|
|
}
|