aoc2021/README.md

36 lines
1 KiB
Markdown
Raw Normal View History

2021-12-01 15:56:43 +13: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
2021-12-01 17:28:52 +13:00
create a folder in `code/src` for the problem, then add an entry with the following format into `code/aoc2021-programs.cabal`:
2021-12-01 15:56:43 +13:00
```
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
2021-12-01 17:28:52 +13:00
## 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).