diff --git a/hosts/yodaTab/configuration.nix b/hosts/yodaTab/configuration.nix index 708c687..e6a80f8 100644 --- a/hosts/yodaTab/configuration.nix +++ b/hosts/yodaTab/configuration.nix @@ -43,6 +43,7 @@ in #../../modules/digikam.nix #../../modules/android.nix #../../modules/podman.nix + #../../modules/docker.nix ]; networking.hostName = "yodaTab"; diff --git a/hosts/yodaTux/configuration.nix b/hosts/yodaTux/configuration.nix index d856ebc..728b74f 100644 --- a/hosts/yodaTux/configuration.nix +++ b/hosts/yodaTux/configuration.nix @@ -42,7 +42,8 @@ in ../../modules/thunderbird.nix ../../modules/digikam.nix ../../modules/android.nix - ../../modules/podman.nix + #../../modules/podman.nix + ../../modules/docker.nix ]; networking.hostName = "yodaTux"; diff --git a/hosts/yodaYoga/configuration.nix b/hosts/yodaYoga/configuration.nix index 7b4d45a..20e52dd 100644 --- a/hosts/yodaYoga/configuration.nix +++ b/hosts/yodaYoga/configuration.nix @@ -44,7 +44,8 @@ in #../../modules/thunderbird.nix #../../modules/digikam.nix #../../modules/android.nix - ../../modules/podman.nix + #../../modules/podman.nix + ../../modules/docker.nix ]; networking.hostName = "yodaYoga"; diff --git a/modules/docker.nix b/modules/docker.nix new file mode 100644 index 0000000..510d4ec --- /dev/null +++ b/modules/docker.nix @@ -0,0 +1,29 @@ +{ config, pkgs, ... }: + +{ + # https://nixos.wiki/wiki/Docker#Installation + + # TODO: rootless Docker. https://nixos.wiki/wiki/Docker#Rootless_docker + # TODO: run as systemd services. https://nixos.wiki/wiki/Docker#docker_containers_as_systemd_services + + virtualisation = { + docker = { + enable = true; + + # As we use btrfs, we enable the according storageDriver option. + storageDriver = "btrfs"; + + # Run `docker system prune -f` every week. + autoPrune.enable = true; + autoPrune.dates = "weekly"; + # https://docs.docker.com/engine/reference/commandline/system_prune/#options + autoPrune.flags = [ + "--all" + "--volumes" + # https://docs.docker.com/engine/reference/commandline/system_prune/#filter + # https://pkg.go.dev/maze.io/x/duration#ParseDuration + "--filter until=7d" + ]; + }; + }; +} diff --git a/modules/podman.nix b/modules/podman.nix index 2b2885d..a265d91 100644 --- a/modules/podman.nix +++ b/modules/podman.nix @@ -5,7 +5,7 @@ # https://search.nixos.org/options?channel=23.05&query=virtualisation.podman # TODO: Run as systemd services. https://nixos.wiki/wiki/Podman#Run_Podman_containers_as_systemd_services - # TODO: Podman Terminal UI: https://github.com/containers/podman-tui#podman-tui + # TODO: Podman Terminal UI. https://github.com/containers/podman-tui#podman-tui environment.systemPackages = with pkgs; [ podman-compose