aoc/2024/flake.nix

50 lines
1.3 KiB
Nix
Raw Normal View History

2024-12-06 07:13:59 +00:00
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
tix.url = "git+https://git.tristans.cloud/tristan/tix";
2024-12-10 09:04:17 +00:00
/*
* sharing your puzzle inputs is discouraged:
* https://adventofcode.com/about#faq_copying
*
* so on a new day, paste the input into
* /tmp/aoc-inputs/${day number}
*
* and run
* nix flake update aoc-inputs
*/
aoc-inputs = {
url = "path:/tmp/aoc-inputs";
flake = false;
};
2024-12-06 07:13:59 +00:00
};
2024-12-10 09:04:17 +00:00
outputs = { aoc-inputs, nixpkgs, tix, ... }: let
2024-12-06 07:13:59 +00:00
pkgs = import nixpkgs {system = "x86_64-linux";};
2024-12-10 09:04:17 +00:00
inherit (pkgs) lib;
2024-12-06 07:13:59 +00:00
2024-12-16 10:00:40 +00:00
in (lib.range 1 25
2024-12-10 09:04:17 +00:00
|> map (i: let id = lib.fixedWidthNumber 2 i; in {
name = "day-${id}";
value = let
solution = import ./${id}/solution.nix pkgs;
example = (pkgs.lib.readFile ./${id}/example.txt);
2024-12-16 10:00:40 +00:00
example2 = (pkgs.lib.readFile ./${id}/example2.txt);
2024-12-15 16:56:29 +00:00
example3 = (pkgs.lib.readFile ./${id}/example3.txt);
2024-12-10 09:04:17 +00:00
input = (pkgs.lib.readFile "${aoc-inputs}/${id}");
2024-12-08 13:08:57 +00:00
in {
2024-12-08 15:01:56 +00:00
example = solution example;
2024-12-16 10:00:40 +00:00
example2 = solution example2;
2024-12-15 16:56:29 +00:00
example3 = solution example3;
2024-12-08 15:01:56 +00:00
real = solution input;
2024-12-08 13:08:57 +00:00
test = tix.run [
2024-12-11 12:18:32 +00:00
./${id}/solution.test.nix
2024-12-08 13:08:57 +00:00
];
};
2024-12-10 09:04:17 +00:00
})
|> builtins.listToAttrs
2024-12-11 23:08:31 +00:00
);
2024-12-06 07:13:59 +00:00
}