Skip to content
No description, website, or topics provided.
Haskell Nix Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
aoc1
aoc10
aoc11
aoc12
aoc13
aoc14
aoc15
aoc16
aoc2
aoc3
aoc4
aoc5
aoc6
aoc7
aoc8
aoc9
template
.envrc
.gitignore
Readme.org
cabal.project
default.nix
newday
shell.nix

Readme.org

Infinisil’s Advent Of Code 2018 Solutions

See https://adventofcode.com/2018/

All commands by default use my personal input file. You can specify a different file by giving it as an argument.

Building and running

The default nix build will include binaries for every day:

$ nix-build
/nix/store/fcckhqa9mqyh7q3sl4vpii3b8gjl56gg-aoc
$ result/bin/aoc1
2553
78724
$ result/bin/aoc2
24980
qysdtrkloagnfozuwujmhrbvx

Builds for specific days are also possible:

$ nix-build -A aoc2
/nix/store/hd6x5vszsa82b210rj8fx6kshr7zv6wa-aoc2-0.1.0.0
$ result/bin/aoc2
24980
qysdtrkloagnfozuwujmhrbvx

Developing

By entering a nix-shell in the project root you can build all packages with cabal new-build:

$ nix-shell
[nix-shell:~/aoc]$ cabal new-build aoc1
Up to date
[nix-shell:~/aoc]$ cabal new-run aoc2
Up to date
4980
qysdtrkloagnfozuwujmhrbvx

It’s also possible to use cabal build:

[nix-shell:~/aoc]$ cd aoc1
[nix-shell:~/aoc/aoc1]$ cabal configure --datadir . --datasubdir .
Resolving dependencies...
Configuring aoc1-0.1.0.0...
[nix-shell:~/aoc/aoc1]$ cabal run
Preprocessing executable 'aoc1' for aoc1-0.1.0.0..
Building executable 'aoc1' for aoc1-0.1.0.0..
Running aoc1...
553
78724

Template creation

A simple template for the next day can be created by running

$ ./newday 7
Created new template in aoc7
You can’t perform that action at this time.