about summary refs log blame commit diff
path: root/users/sterni/exercises/aoc/2022/default.nix
blob: 77b33728470d9f9ff86fc55e1cbe428abf351522 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14


                          
                                          









                                  
           
      






                                                                      


























                                                                            
 
{ depot, pkgs, lib, ... }:

let
  inherit (pkgs.buildPackages) cbqn ngn-k;

  # input files are not checked in
  meta.ci.skip = true;
in

depot.nix.readTree.drvTargets {
  shell = pkgs.mkShell {
    name = "aoc-2022-shell";
    packages = [
      cbqn
      ngn-k
    ];

    BQNLIBS = pkgs.fetchFromGitHub {
      owner = "mlochbaum";
      repo = "bqn-libs";
      rev = "d56d8ea0b8c294fac7274678d9ab112553a03f42";
      sha256 = "1c1bkqj62v8m13jgaa32ridy0fk5iqysq5b2qwxbqxhky5zwnk9h";
    };
  };

  bqn = pkgs.runCommand "bqn-aoc-2022"
    {
      nativeBuildInputs = [
        cbqn
      ];

      aoc = builtins.path {
        name = "bqn-aoc-2022";
        path = ./../.;
        # Need lib.bqn from ../ and all inputs as well as bqn files from ./*
        filter = path: type:
          lib.hasSuffix ".bqn" path || (
            lib.hasPrefix (toString ./.) path
            && (
              type == "directory"
              || lib.hasSuffix "/input" path
            )
          );
      };

      inherit meta;
    }
    ''
      find "$aoc/2022" -name '*.bqn' -exec BQN {} \; | tee "$out"
    '';
}