diff options
Diffstat (limited to 'users')
-rw-r--r-- | users/sterni/exercises/aoc/2022/README.md | 4 | ||||
-rw-r--r-- | users/sterni/exercises/aoc/2022/default.nix | 24 | ||||
-rw-r--r-- | users/sterni/exercises/aoc/2022/nix.nix | 30 |
3 files changed, 2 insertions, 56 deletions
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; -} |