nixpkgs/pkgs/by-name/gv/gvisor/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

60 lines
1.5 KiB
Nix
Raw Normal View History

{ lib
, nixosTests
, buildGoModule
2019-10-27 03:18:26 +00:00
, fetchFromGitHub
2021-03-14 16:05:16 +00:00
, iproute2
2019-10-27 03:18:26 +00:00
, iptables
, makeWrapper
, procps
2024-05-15 13:47:54 +00:00
, glibc
2019-10-27 03:18:26 +00:00
}:
buildGoModule {
2022-03-07 11:37:20 +00:00
pname = "gvisor";
version = "20240401.0";
2022-09-21 15:47:20 +00:00
# gvisor provides a synthetic go branch (https://github.com/google/gvisor/tree/go)
# that can be used to build gvisor without bazel.
# For updates, you should stick to the commits labeled "Merge release-** (automated)"
2019-10-27 03:18:26 +00:00
src = fetchFromGitHub {
owner = "google";
repo = "gvisor";
rev = "9d995324d058812a5476f8c06b20167012511e9c";
hash = "sha256-idgUEbYAfnm/HphVs12Sj1FwG+jmL2BBr0PJnG9BC3A=";
2019-10-27 03:18:26 +00:00
};
2024-05-15 13:47:54 +00:00
# Replace the placeholder with the actual path to ldconfig
postPatch = ''
substituteInPlace runsc/container/container.go \
--replace-fail '"/sbin/ldconfig"' '"${glibc}/bin/ldconfig"'
'';
vendorHash = "sha256-jbMXeNXzvjfJcIfHjvf8I3ePjm6KFTXJ94ia4T2hUs4=";
2019-10-27 03:18:26 +00:00
nativeBuildInputs = [ makeWrapper ];
2019-10-27 03:18:26 +00:00
2022-09-21 15:47:20 +00:00
CGO_ENABLED = 0;
ldflags = [ "-s" "-w" ];
2019-10-27 03:18:26 +00:00
subPackages = [ "runsc" "shim" ];
2019-10-27 03:18:26 +00:00
postInstall = ''
# Needed for the 'runsc do' subcommand
wrapProgram $out/bin/runsc \
--prefix PATH : ${lib.makeBinPath [ iproute2 iptables procps ]}
mv $out/bin/shim $out/bin/containerd-shim-runsc-v1
'';
2019-10-27 03:18:26 +00:00
passthru.tests = { inherit (nixosTests) gvisor; };
meta = with lib; {
description = "Application Kernel for Containers";
homepage = "https://github.com/google/gvisor";
2019-10-27 03:18:26 +00:00
license = licenses.asl20;
maintainers = with maintainers; [ gpl ];
2024-04-20 13:01:31 +00:00
platforms = [ "x86_64-linux" "aarch64-linux" ];
2019-10-27 03:18:26 +00:00
};
}