aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/applications/virtualization/cri-o/wrapper.nix
blob: 6d72623d86cbfae59135450ad48ac699b56f01fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{ cri-o-unwrapped
, runCommand
, makeWrapper
, lib
, extraPackages ? []
, cri-o
, runc # Default container runtime
, crun # Container runtime (default with cgroups v2 for podman/buildah)
, conmon # Container runtime monitor
, utillinux # nsenter
, cni-plugins # not added to path
, iptables
}:

let
  cri-o = cri-o-unwrapped;

  binPath = lib.makeBinPath ([
    runc
    crun
    conmon
    utillinux
    iptables
  ] ++ extraPackages);

in runCommand cri-o.name {
  name = "${cri-o.pname}-wrapper-${cri-o.version}";
  inherit (cri-o) pname version passthru;

  meta = builtins.removeAttrs cri-o.meta [ "outputsToInstall" ];

  outputs = [
    "out"
    "man"
  ];

  nativeBuildInputs = [
    makeWrapper
  ];

} ''
  ln -s ${cri-o.man} $man

  mkdir -p $out/bin
  ln -s ${cri-o-unwrapped}/share $out/share

  for p in ${cri-o-unwrapped}/bin/*; do
    makeWrapper $p $out/bin/''${p##*/} \
      --prefix PATH : ${binPath}
  done
''