1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{ depot, pkgs, ... }:

let
  goDeps = import ./go-deps.nix { inherit depot pkgs; };

  activitypub = depot.users.Profpatsch.activitypub-go;

  # Assemble source tree so go:embed can find templates/ next to main.go
  src = pkgs.runCommandLocal "booster-bot-src" {} ''
    mkdir -p $out/templates
    cp ${./main.go} $out/main.go
    cp ${./quoting.go} $out/quoting.go
    cp ${./db.go} $out/db.go
    cp ${./templates}/*.html $out/templates/
  '';

in depot.nix.buildGo.program {
  name = "booster-bot";
  srcs = [ "${src}/main.go" "${src}/quoting.go" "${src}/db.go" ];
  deps = [
    activitypub
    goDeps.golang-x-image.draw
    goDeps.golang-x-image.webp
    goDeps.modernc-sqlite
  ];
}