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

# go-deps-check — do the go-deps.nix pins match what go.work resolves?
# See go-deps-check.1. Needs go, git and nix-instantiate on PATH at runtime;
# they are wrapped in so it runs outside the dev shell too.

let
  unwrapped = depot.nix.buildGo.program {
    name = "go-deps-check";
    srcs = [ ./main.go ];
    embeds = [ ./probe.nix ];
  };
in
pkgs.runCommand "go-deps-check"
{
  outputs = [ "out" "man" ];
  nativeBuildInputs = [ pkgs.makeWrapper ];
} ''
  makeWrapper ${unwrapped}/bin/go-deps-check $out/bin/go-deps-check \
    --suffix PATH : ${pkgs.lib.makeBinPath [ depot.nix.buildGo.go pkgs.git pkgs.nix ]}
  mkdir -p $man/share/man/man1
  cp ${./go-deps-check.1} $man/share/man/man1/go-deps-check.1
''