chore(sterni/aoc/2022): nuke Nix solutions
Didn't end up happening due to a lack of motivation. Will try to finish the BQN AoC still, though. Change-Id: Ib296aec9f3cfeef57c79a9ba09fc664c1a19dcff Reviewed-on: https://cl.tvl.fyi/c/depot/+/7661 Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
This commit is contained in:
parent
7163d3ad37
commit
6aafe2a223
3 changed files with 2 additions and 56 deletions
|
@ -3,6 +3,6 @@
|
|||
I'm trying to do it in BQN again to redeem myself for my unfinished [AoC 2021](../2021),
|
||||
but will allow myself falling back to another language if I get stuck, so I actually
|
||||
complete this one.
|
||||
I also plan to write additional solutions in Nix (when I have the time) in order to
|
||||
throw `//tvix/eval` against some new problems.
|
||||
~~I also plan to write additional solutions in Nix (when I have the time) in order to
|
||||
throw `//tvix/eval` against some new problems.~~
|
||||
We'll see how it goes, as my December promises to be quite busy.
|
||||
|
|
|
@ -13,7 +13,6 @@ depot.nix.readTree.drvTargets {
|
|||
packages = [
|
||||
cbqn
|
||||
ngn-k
|
||||
depot.tvix.eval
|
||||
];
|
||||
|
||||
BQNLIBS = pkgs.fetchFromGitHub {
|
||||
|
@ -49,27 +48,4 @@ depot.nix.readTree.drvTargets {
|
|||
''
|
||||
find "$aoc/2022" -name '*.bqn' -exec BQN {} \; | tee "$out"
|
||||
'';
|
||||
|
||||
nix = import ./nix.nix { inherit lib; };
|
||||
|
||||
tvixed-nix = pkgs.runCommand "tvix-aoc-2022"
|
||||
{
|
||||
nativeBuildInputs = [
|
||||
depot.tvix.eval
|
||||
];
|
||||
solutions = builtins.path {
|
||||
name = "nix-aoc-2022";
|
||||
path = ./.;
|
||||
filter = path: type:
|
||||
type == "directory"
|
||||
|| lib.hasSuffix "nix.nix" path
|
||||
|| lib.hasSuffix "/input" path;
|
||||
};
|
||||
|
||||
inherit meta;
|
||||
}
|
||||
''
|
||||
tvix-eval -E "import $solutions/nix.nix { lib = import ${pkgs.path}/lib; }" \
|
||||
| tee "$out"
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
{ lib ? import <nixpkgs/lib> }:
|
||||
|
||||
let
|
||||
chomp = lib.removeSuffix "\n";
|
||||
lines = s: builtins.filter builtins.isString (builtins.split "\n" (chomp s));
|
||||
sum = builtins.foldl' builtins.add 0;
|
||||
|
||||
day01 =
|
||||
let
|
||||
input =
|
||||
builtins.map
|
||||
(elf:
|
||||
sum (builtins.map builtins.fromJSON (lines elf))
|
||||
)
|
||||
(
|
||||
builtins.filter builtins.isString (
|
||||
builtins.split "\n\n" (builtins.readFile ./01/input)
|
||||
)
|
||||
);
|
||||
in
|
||||
{
|
||||
"1" = builtins.foldl' lib.max (-1) input;
|
||||
"2" = sum (lib.sublist 0 3 (lib.sort (a: b: a >= b) input));
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
inherit day01;
|
||||
}
|
Loading…
Reference in a new issue