From a33c74c580f0acc22e677af9410f03496c08ce5a Mon Sep 17 00:00:00 2001
From: Oliver Davies <oliver@oliverdavies.dev>
Date: Mon, 18 Mar 2024 00:44:00 +0000
Subject: [PATCH] Automatically prune unused Docker images

---
 lib/nixos/configuration.nix | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/nixos/configuration.nix b/lib/nixos/configuration.nix
index d2f1c560..dbe15b95 100644
--- a/lib/nixos/configuration.nix
+++ b/lib/nixos/configuration.nix
@@ -173,7 +173,14 @@ in {
   # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
   system.stateVersion = "22.11"; # Did you read the comment?
 
-  virtualisation.docker.enable = true;
+  virtualisation.docker = {
+    enable = true;
+
+    autoPrune = {
+      enable = true;
+      dates = "weekly";
+    };
+  };
 
   programs.zsh.enable = true;
   programs.zsh.histSize = 5000;