Merge pull request #329823 from ExpidusOS/fix/pkgsllvm/elfutils
[NixPkgs.git] / pkgs / by-name / gv / gvisor / package.nix
blob4caecce1ea3de70571998a99a93b99c3762aa4d8
1 { lib
2 , nixosTests
3 , buildGoModule
4 , fetchFromGitHub
5 , iproute2
6 , iptables
7 , makeWrapper
8 , procps
9 , glibc
12 buildGoModule {
13   pname = "gvisor";
14   version = "20240401.0";
16   # gvisor provides a synthetic go branch (https://github.com/google/gvisor/tree/go)
17   # that can be used to build gvisor without bazel.
18   # For updates, you should stick to the commits labeled "Merge release-** (automated)"
20   src = fetchFromGitHub {
21     owner = "google";
22     repo = "gvisor";
23     rev = "9d995324d058812a5476f8c06b20167012511e9c";
24     hash = "sha256-idgUEbYAfnm/HphVs12Sj1FwG+jmL2BBr0PJnG9BC3A=";
25   };
27     # Replace the placeholder with the actual path to ldconfig
28   postPatch = ''
29     substituteInPlace runsc/container/container.go \
30       --replace-fail '"/sbin/ldconfig"' '"${glibc}/bin/ldconfig"'
31   '';
33   vendorHash = "sha256-jbMXeNXzvjfJcIfHjvf8I3ePjm6KFTXJ94ia4T2hUs4=";
35   nativeBuildInputs = [ makeWrapper ];
37   CGO_ENABLED = 0;
39   ldflags = [ "-s" "-w" ];
41   subPackages = [ "runsc" "shim" ];
43   postInstall = ''
44     # Needed for the 'runsc do' subcommand
45     wrapProgram $out/bin/runsc \
46       --prefix PATH : ${lib.makeBinPath [ iproute2 iptables procps ]}
47     mv $out/bin/shim $out/bin/containerd-shim-runsc-v1
48   '';
50   passthru.tests = { inherit (nixosTests) gvisor; };
52   meta = with lib; {
53     description = "Application Kernel for Containers";
54     homepage = "https://github.com/google/gvisor";
55     license = licenses.asl20;
56     maintainers = with maintainers; [ gpl ];
57     platforms = [ "x86_64-linux" "aarch64-linux" ];
58   };