2021 Advent of Code
Find a file
thornAvery f401e0a681 15
2021-12-15 21:28:46 +00:00
code 15 2021-12-15 21:28:46 +00:00
nix added wrapper 2021-12-01 04:28:52 +00:00
.gitignore first commit 2021-12-01 02:56:43 +00:00
flake.lock first commit 2021-12-01 02:56:43 +00:00
flake.nix added wrapper 2021-12-01 04:28:52 +00:00
README.md added wrapper 2021-12-01 04:28:52 +00:00
timings.txt 15 2021-12-15 21:28:46 +00:00

Advent of Code 2021

this flake builds a package containing a program for each problem in this years advent of code.

adding a problem

create a folder in code/src for the problem, then add an entry with the following format into code/aoc2021-programs.cabal:

executable aoc2021-XX
   main-is: Main.hs
   ghc-options: -O2 -Wall
   hs-source-dirs: src/XX
   build-depends: base
   default-language: Haskell2010

building

your choice of:

nix shell git+https://git.p7.co.nz/thornAvery/aoc2021
nix build git+https://git.p7.co.nz/thornAvery/aoc2021

or you can add the overlay defined in the flake

running

this flake defines a wrapper script that automates passing input to the problems.

in order to use it, the problem folder must include XX-input.txt, where XX is the suffix defined in the cabal file.

the default package provides a wrapper aoc2021, which when invoked with aoc2021 XX will cat the contents of XX-input.txt to the program aoc2021-XX (as defined in the cabal file).