Create bridge network and add library containers

This commit is contained in:
2023-06-10 16:40:40 +01:00
parent 62549551e5
commit f65b4c0676

View File

@ -74,6 +74,23 @@ with lib.my;
wantedBy = [ "default.target" ]; wantedBy = [ "default.target" ];
}; };
systemd.services.init-container-networking = {
description = "Create a network bridge for containers on this host";
after = [ "network.target" ];
wantedBy = [ "default.target" ];
serviceConfig.type = "oneshot";
script = let podmancli = "${pkgs.podman}/bin/podman";
in ''
check=$(${podmancli} network ls | grep "library-br" || true)
if [ -z "$check" ]; then
${podmancli} network create library-br
else
echo "library-br already exists"
fi
'';
};
virtualisation.podman = { virtualisation.podman = {
enable = true; enable = true;
extraPackages = [ pkgs.zfs ]; extraPackages = [ pkgs.zfs ];
@ -117,6 +134,7 @@ with lib.my;
]; ];
extraOptions = [ extraOptions = [
"--label=io.containers.autoupdate=registry" "--label=io.containers.autoupdate=registry"
"--network=library-br"
]; ];
dependsOn = [ "jellyfin" ]; dependsOn = [ "jellyfin" ];
}; };
@ -134,6 +152,7 @@ with lib.my;
]; ];
extraOptions = [ extraOptions = [
"--label=io.containers.autoupdate=registry" "--label=io.containers.autoupdate=registry"
"--network=library-br"
]; ];
}; };
radarr = { radarr = {
@ -147,6 +166,7 @@ with lib.my;
extraOptions = [ extraOptions = [
"--label=io.containers.autoupdate=registry" "--label=io.containers.autoupdate=registry"
"--mount=type=bind,source=/mnt/library/movies,target=/movies" "--mount=type=bind,source=/mnt/library/movies,target=/movies"
"--network=library-br"
]; ];
dependsOn = [ "qbittorrent" ]; dependsOn = [ "qbittorrent" ];
}; };
@ -161,6 +181,7 @@ with lib.my;
extraOptions = [ extraOptions = [
"--label=io.containers.autoupdate=registry" "--label=io.containers.autoupdate=registry"
"--mount=type=bind,source=/mnt/library/tv,target=/tv" "--mount=type=bind,source=/mnt/library/tv,target=/tv"
"--network=library-br"
]; ];
dependsOn = [ "qbittorrent" ]; dependsOn = [ "qbittorrent" ];
}; };