tvl-depot/fun/aoc2019/default.nix
Vincent Ambo 03bfe08e1d chore: Significantly restructure folder layout
This moves the various projects from "type-based" folders (such as
"services" or "tools") into more appropriate semantic folders (such as
"nix", "ops" or "web").

Deprecated projects (nixcon-demo & gotest) which only existed for
testing/demonstration purposes have been removed.

(Note: *all* builds are broken with this commit)
2019-12-20 20:18:41 +00:00

22 lines
690 B
Nix

# 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 = "aoc2019";
deps = p: with p; [ dash s ht ];
src = ./. + ("/" + f);
};
}) solutionFiles;
in listToAttrs solutions