nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 glibc,
6 go-md2man,
7 installShellFiles,
8}:
9
10buildGoModule rec {
11 pname = "toolbox";
12 version = "0.0.99.3";
13
14 src = fetchFromGitHub {
15 owner = "containers";
16 repo = "toolbox";
17 rev = version;
18 hash = "sha256-9HiWgEtaMypLOwXJ6Xg3grLSZOQ4NInZtcvLPV51YO8=";
19 };
20
21 patches = [ ./glibc.patch ];
22
23 vendorHash = "sha256-k79TcC9voQROpJnyZ0RsqxJnBT83W5Z+D+D3HnuQGsI=";
24
25 postPatch = ''
26 substituteInPlace src/cmd/create.go --subst-var-by glibc ${glibc}
27 '';
28
29 modRoot = "src";
30
31 nativeBuildInputs = [
32 go-md2man
33 installShellFiles
34 ];
35
36 ldflags = [
37 "-s"
38 "-w"
39 "-X github.com/containers/toolbox/pkg/version.currentVersion=${version}"
40 ];
41
42 preCheck = "export PATH=$GOPATH/bin:$PATH";
43
44 postInstall = ''
45 cd ..
46 for d in doc/*.md; do
47 go-md2man -in $d -out ''${d%.md}
48 done
49 installManPage doc/*.[1-9]
50 installShellCompletion --bash completion/bash/toolbox
51 install profile.d/toolbox.sh -Dt $out/share/profile.d
52 '';
53
54 meta = {
55 homepage = "https://containertoolbx.org";
56 changelog = "https://github.com/containers/toolbox/releases/tag/${version}";
57 description = "Tool for containerized command line environments on Linux";
58 license = lib.licenses.asl20;
59 maintainers = [ ];
60 mainProgram = "toolbox";
61 };
62}