Commit f3d5be87299e

Vincent Demeester <vincent@sbr.pm>
2018-09-15 15:24:46
Package cni/cni-plugins in nixos
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 13c50bb
overlays/sbr.overlay.nix
@@ -1,6 +1,20 @@
 self: super: {
-  ape = import ../pkgs/ape { inherit (self) stdenv lib buildGoPackage fetchFromGitHub; };
-  vrsync = import ../pkgs/vrsync { inherit (self) stdenv lib; };
-  runc-edge = import ../pkgs/runc { inherit (self) stdenv lib fetchFromGitHub removeReferencesTo go-md2man go pkgconfig libapparmor apparmor-parser libseccomp; };
-  containerd-edge = import ../pkgs/containerd { inherit (self) stdenv lib fetchFromGitHub removeReferencesTo go btrfs-progs; };
+  ape = import ../pkgs/ape {
+    inherit (self) stdenv lib buildGoPackage fetchFromGitHub;
+  };
+  vrsync = import ../pkgs/vrsync {
+    inherit (self) stdenv lib;
+  };
+  runc-edge = import ../pkgs/runc {
+    inherit (self) stdenv lib fetchFromGitHub removeReferencesTo go-md2man go pkgconfig libapparmor apparmor-parser libseccomp;
+  };
+  containerd-edge = import ../pkgs/containerd {
+    inherit (self) stdenv lib fetchFromGitHub removeReferencesTo go btrfs-progs;
+  };
+  cni = import ../pkgs/cni {
+    inherit (self) stdenv fetchFromGitHub go;
+  };
+  cni-plugins = import ../pkgs/cni/plugins.nix {
+    inherit (self) stdenv lib fetchFromGitHub go;
+  };
 }
pkgs/cni/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchFromGitHub, go }:
+
+stdenv.mkDerivation rec {
+  name = "cni-${version}";
+  version = "0.6.0";
+
+  src = fetchFromGitHub {
+    owner = "containernetworking";
+    repo = "cni";
+    rev = "v${version}";
+    sha256 = "00ajs2r5r2z3l0vqwxrcwhjfc9px12qbcv5vnvs2mdipvvls1y2y";
+  };
+
+  buildInputs = [ go ];
+
+  buildPhase = ''
+    patchShebangs build.sh
+    ./build.sh
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    mv bin/cnitool $out/bin
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Container Network Interface - networking for Linux containers";
+    license = licenses.asl20;
+    homepage = https://github.com/containernetworking/cni;
+    maintainers = with maintainers; [offline];
+    platforms = [ "x86_64-linux" ];
+  };
+}
pkgs/cni/plugins.nix
@@ -0,0 +1,33 @@
+{ stdenv, lib, fetchFromGitHub, go }:
+
+stdenv.mkDerivation rec {
+  name = "cni-plugins-${version}";
+  version = "0.7.3";
+
+  src = fetchFromGitHub {
+    owner = "containernetworking";
+    repo = "plugins";
+    rev = "v${version}";
+    sha256 = "1saaszzxy4x3jkqd9ac6cphmzfim7x84h28c9i7az46px40blzm1";
+  };
+
+  buildInputs = [ go ];
+
+  buildPhase = ''
+    patchShebangs build.sh
+    ./build.sh
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    mv bin/* $out/bin
+  '';
+
+  meta = with lib; {
+    description = "Some standard networking plugins, maintained by the CNI team";
+    homepage = https://github.com/containernetworking/plugins;
+    license = licenses.asl20;
+    platforms = [ "x86_64-linux" ];
+    maintainers = with maintainers; [ cstrahan ];
+  };
+}
pkgs/default.nix
@@ -16,4 +16,10 @@ rec {
   containerd-edge = import ./containerd {
     inherit (pkgs) stdenv lib fetchFromGitHub removeReferencesTo go btrfs-progs;
   };
+  cni = import ./cni {
+    inherit (pkgs) stdenv fetchFromGitHub go;
+  };
+  cni-plugins = import ./cni/plugins.nix {
+    inherit (pkgs) stdenv lib fetchFromGitHub go;
+  };
 }
profiles/containerd.nix
@@ -4,7 +4,7 @@
   imports = [ ../service/containerd.nix ];
   environment.systemPackages = with pkgs; [
     cni
-    # cni-plugins
+    cni-plugins
     containerd-edge
     runc-edge
   ];