From 0fe23e8bf8d4e1e0fcdb236d54195faf998c793f Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Sat, 1 Jun 2024 00:00:07 +0300 Subject: [PATCH] host/asus: persist docker --- hosts/asus-gl553vd/configs/imp.nix | 45 +++++++++++++++++++----------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/hosts/asus-gl553vd/configs/imp.nix b/hosts/asus-gl553vd/configs/imp.nix index 1d4b861..f81f7c7 100644 --- a/hosts/asus-gl553vd/configs/imp.nix +++ b/hosts/asus-gl553vd/configs/imp.nix @@ -1,4 +1,4 @@ -{ lib, ... }: +{ config, lib, ... }: { # A setup which would clean root subvolume between boots remove automatically removed roots that @@ -36,20 +36,33 @@ "ssh_host_ed25519_key" ]; - environment.persistence."/persistent/system" = { - hideMounts = true; - directories = [ - "/var/lib/bluetooth" - "/var/lib/nixos" - "/var/lib/systemd/coredump" - "/etc/NetworkManager/system-connections" - ]; - files = [ - "/etc/machine-id" - "/etc/ssh/ssh_host_rsa_key" - "/etc/ssh/ssh_host_rsa_key.pub" - "/etc/ssh/ssh_host_ed25519_key" - "/etc/ssh/ssh_host_ed25519_key.pub" - ]; + environment.persistence = { + "/persistent/system" = { + hideMounts = true; + directories = [ + "/var/lib/bluetooth" + "/var/lib/nixos" + "/var/lib/systemd/coredump" + "/etc/NetworkManager/system-connections" + ]; + files = [ + "/etc/machine-id" + "/etc/ssh/ssh_host_rsa_key" + "/etc/ssh/ssh_host_rsa_key.pub" + "/etc/ssh/ssh_host_ed25519_key" + "/etc/ssh/ssh_host_ed25519_key.pub" + ]; + }; + "/persistent/docker" = lib.mkIf config.virtualisation.docker.enable { + hideMounts = true; + directories = map (v: "/var/lib/docker/${v}") [ + "containers" + "volumes" + "image" + "overlay2" + "network" + ]; + files = [ "/var/lib/docker/engine-id" ]; + }; }; }