From 6aafe2a223c00755d71cbc86bbabfe54d95611d3 Mon Sep 17 00:00:00 2001 From: sterni <sternenseemann@systemli.org> Date: Wed, 28 Dec 2022 12:56:03 +0100 Subject: 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 --- users/sterni/exercises/aoc/2022/README.md | 4 ++-- users/sterni/exercises/aoc/2022/default.nix | 24 ----------------------- users/sterni/exercises/aoc/2022/nix.nix | 30 ----------------------------- 3 files changed, 2 insertions(+), 56 deletions(-) delete mode 100644 users/sterni/exercises/aoc/2022/nix.nix (limited to 'users/sterni/exercises/aoc/2022') diff --git a/users/sterni/exercises/aoc/2022/README.md b/users/sterni/exercises/aoc/2022/README.md index 9274265305a6..65d51dd21fe7 100644 --- a/users/sterni/exercises/aoc/2022/README.md +++ b/users/sterni/exercises/aoc/2022/README.md @@ -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. diff --git a/users/sterni/exercises/aoc/2022/default.nix b/users/sterni/exercises/aoc/2022/default.nix index 82d743428ab0..77b33728470d 100644 --- a/users/sterni/exercises/aoc/2022/default.nix +++ b/users/sterni/exercises/aoc/2022/default.nix @@ -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" - ''; } diff --git a/users/sterni/exercises/aoc/2022/nix.nix b/users/sterni/exercises/aoc/2022/nix.nix deleted file mode 100644 index ca8bfc6e57df..000000000000 --- a/users/sterni/exercises/aoc/2022/nix.nix +++ /dev/null @@ -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; -} -- cgit 1.4.1