Skip to content

Commit

Permalink
toolbox: init at 0.0.99.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mjlbach authored and urandom2 committed Dec 13, 2022
1 parent 71154fe commit d8c8e9a
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
51 changes: 51 additions & 0 deletions pkgs/applications/virtualization/toolbox/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{ lib, buildGoModule, fetchFromGitHub, glibc, go-md2man, installShellFiles }:

buildGoModule rec {
pname = "toolbox";
version = "0.0.99.3";

src = fetchFromGitHub {
owner = "containers";
repo = pname;
rev = version;
hash = "sha256-9HiWgEtaMypLOwXJ6Xg3grLSZOQ4NInZtcvLPV51YO8=";
};

patches = [ ./glibc.patch ];

vendorHash = "sha256-k79TcC9voQROpJnyZ0RsqxJnBT83W5Z+D+D3HnuQGsI=";

postPatch = ''
substituteInPlace src/cmd/create.go --subst-var-by glibc ${glibc}
'';

modRoot = "src";

nativeBuildInputs = [ go-md2man installShellFiles ];

ldflags = [
"-s"
"-w"
"-X github.com/containers/toolbox/pkg/version.currentVersion=${version}"
];

preCheck = "export PATH=$GOPATH/bin:$PATH";

postInstall = ''
cd ..
for d in doc/*.md; do
go-md2man -in $d -out ''${d%.md}
done
installManPage doc/*.[1-9]
installShellCompletion --bash completion/bash/toolbox
install profile.d/toolbox.sh -Dt $out/share/profile.d
'';

meta = with lib; {
homepage = "https://containertoolbx.org";
changelog = "https://github.com/containers/toolbox/releases/tag/${version}";
description = "Tool for containerized command line environments on Linux";
license = licenses.asl20;
maintainers = with maintainers; [ urandom ];
};
}
12 changes: 12 additions & 0 deletions pkgs/applications/virtualization/toolbox/glibc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/src/cmd/create.go b/src/cmd/create.go
index 74e90b1..113ef80 100644
--- a/src/cmd/create.go
+++ b/src/cmd/create.go
@@ -423,6 +425,7 @@ func createContainer(container, image, release string, showCommandToEnter bool)
"--volume", toolboxPathMountArg,
"--volume", usrMountArg,
"--volume", runtimeDirectoryMountArg,
+ "--volume", "@glibc@:@glibc@:ro",
}...)

createArgs = append(createArgs, avahiSocketMount...)
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12257,6 +12257,8 @@ with pkgs;

todo = callPackage ../tools/misc/todo { };

toolbox = callPackage ../applications/virtualization/toolbox { };

tor = callPackage ../tools/security/tor { };

tor-browser-bundle-bin = callPackage ../applications/networking/browsers/tor-browser-bundle-bin { };
Expand Down

0 comments on commit d8c8e9a

Please sign in to comment.