Installing the cni plugins.

This commit is contained in:
Tom Alexander 2025-12-18 00:27:18 -05:00 committed by Tom Alexander
parent c61da527f2
commit 1da6250301
Signed by: talexander
GPG Key ID: 36C99E8B3C39D85F
4 changed files with 60 additions and 12 deletions

View File

@ -20,22 +20,23 @@
config = lib.mkIf config.me.containerd.enable {
virtualisation.containerd.enable = true;
virtualisation.containerd.settings =
# let
# my-cni-plugins = pkgs.buildEnv {
# name = "my-cni-plugins";
# paths = with pkgs; [
# cni-plugins
# cni-plugin-flannel
# ];
# };
# in
let
my-cni-plugins = pkgs.buildEnv {
name = "my-cni-plugins";
paths = with pkgs; [
cni-plugins
cni-plugin-flannel
];
};
in
{
"plugins" = {
"io.containerd.grpc.v1.cri" = {
"cni" = {
"bin_dir" = "/opt/cni/bin";
# "bin_dir" = "${my-cni-plugins}/bin";
"conf_dir" = "/etc/cni/net.d";
# "bin_dir" = "/opt/cni/bin";
"bin_dir" = "${my-cni-plugins}/bin";
# "conf_dir" = "/etc/cni/net.d";
"conf_dir" = "${pkgs.callPackage ./package/cni_conf/package.nix { }}";
};
"containerd" = {
"default_runtime_name" = "runc";

View File

@ -0,0 +1,15 @@
{
"cniVersion": "1.0.0",
"name": "bridge",
"type": "bridge",
"bridge": "cni0",
"isGateway": true,
"ipMasq": true,
"ipam": {
"type": "host-local",
"ranges": [
[{"subnet": "SUBNET"}]
],
"routes": [{"dst": "0.0.0.0/0"}]
}
}

View File

@ -0,0 +1,5 @@
{
"cniVersion": "1.1.0",
"name": "lo",
"type": "loopback"
}

View File

@ -0,0 +1,27 @@
# unpackPhase
# patchPhase
# configurePhase
# buildPhase
# checkPhase
# installPhase
# fixupPhase
# installCheckPhase
# distPhase
{
stdenv,
openssl,
...
}:
stdenv.mkDerivation (finalAttrs: {
name = "cni-conf";
nativeBuildInputs = [ openssl ];
buildInputs = [ ];
unpackPhase = "true";
installPhase = ''
mkdir -p "$out"
cd "$out"
install ${./files/10-bridge.conf} ${./files/99-loopback.conf} $out/
'';
})