Migrate docker module to podman

This also enables podman on mayushii.
This commit is contained in:
Simon Bruder 2024-05-10 23:41:38 +02:00
parent 8c9d39edb6
commit 7523f70bf0
Signed by: simon
GPG key ID: 347FF8699CDA0776
5 changed files with 32 additions and 48 deletions

View file

@ -19,6 +19,7 @@
gui.enable = true;
media-proxy.enable = true;
mullvad.enable = true;
podman.enable = true;
restic.system = {
enable = true;
qos = true;

View file

@ -33,7 +33,6 @@
./ausweisapp.nix
./authoritative-dns.nix
./cups.nix
./docker.nix
./fancontrol.nix
./flatpak.nix
./fonts.nix
@ -55,6 +54,7 @@
./nix.nix
./office.nix
./pipewire.nix
./podman.nix
./prometheus/node_exporter.nix
./pubkeys.nix
./qbittorrent

View file

@ -1,47 +0,0 @@
# SPDX-FileCopyrightText: 2020-2021 Simon Bruder <simon@sbruder.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{ config, lib, pkgs, ... }:
{
# This uses a custom option (instead of `virtualisation.docker.enable`) since
# `virtualisation.oci-containers` conditionally sets
# `virtualisation.docker.enable` and therefore causes an infinite recursion.
options.sbruder.docker.enable = lib.mkEnableOption "docker with ipv6nat";
config = lib.mkIf config.sbruder.docker.enable {
environment.systemPackages = with pkgs; [
docker-compose
docker-credential-helpers
docker-ls
];
virtualisation = {
docker = {
enable = true;
logDriver = "journald";
extraOptions = lib.concatStringsSep " " [
"--ipv6"
"--fixed-cidr-v6=fd00:d0ce:d0ce:d0ce::/64"
];
};
oci-containers.containers.ipv6nat = {
image = "robbertkl/ipv6nat";
volumes = [
"/var/run/docker.sock:/var/run/docker.sock:ro"
];
extraOptions = [
"--network=host"
"--cap-drop=ALL"
"--cap-add=NET_ADMIN"
"--cap-add=NET_RAW"
"--cap-add=SYS_MODULE"
];
};
};
environment.etc."modules-load.d/ipv6nat.conf".text = "ip6_tables\n";
};
}

29
modules/podman.nix Normal file
View file

@ -0,0 +1,29 @@
# SPDX-FileCopyrightText: 2020-2024 Simon Bruder <simon@sbruder.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{ config, lib, pkgs, ... }:
{
options.sbruder.podman.enable = lib.mkEnableOption "podman";
config = lib.mkIf config.sbruder.podman.enable {
boot.enableContainers = false; # FIXME: this only needs to be set for some stateVersions
environment.systemPackages = with pkgs; [
buildah
podman-compose
skopeo
];
virtualisation = {
podman = {
enable = true;
dockerSocket.enable = true;
defaultNetwork.settings = {
ipv6_enabled = true;
};
};
};
};
}

View file

@ -28,6 +28,7 @@ let
"/home/*/mounts"
# Docker (state should be kept somewhere else)
"/home/*/.local/share/containers" # podman
"/var/lib/docker/"
# Static configuration (generated from this repository)