Skip to content

Commit 05cc283

Browse files
committed
feat: blacklist containers from backup - ollama
Signed-off-by: Reputable2722 <153411261+Reputable2772@users.noreply.github.com>
1 parent ee70e4e commit 05cc283

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

Config/config.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ rec {
161161
# Not a container, refer to Users/WickedWizard/Programs/Selfhosted/backup.nix.
162162
# Can contain the path with docker mount path, or without. Doesn't matter.
163163
backup = {
164+
blacklistedContainers = [
165+
"ollama.container"
166+
];
164167
blacklistedPaths = [
165168
# lidarr.custom.downloadPath
166169
# lidarr.custom.music.libraryPath

Users/WickedWizard/Programs/Selfhosted/backup.nix

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
...
77
}:
88
let
9-
inherit (config'.containers.backup) pwdFile blacklistedPaths location;
9+
inherit (config'.containers.backup)
10+
pwdFile
11+
blacklistedContainers
12+
blacklistedPaths
13+
location
14+
;
1015
tmpLocation = "${config.home.homeDirectory}/tmp-container-backup";
1116
containerCommand =
1217
cmd:
@@ -34,7 +39,10 @@ let
3439
paths = mapAttrsToList (
3540
qname: qval:
3641
if
37-
hasAttrByPath [ "Container" "ContainerName" ] qval && hasAttrByPath [ "Container" "Volume" ] qval
42+
hasAttrByPath [ "Container" "ContainerName" ] qval
43+
# Container must not be blacklisted.
44+
&& !(elem qname blacklistedContainers || elem qval.Container.ContainerName blacklistedContainers)
45+
&& hasAttrByPath [ "Container" "Volume" ] qval
3846
then
3947
map (
4048
vname:

0 commit comments

Comments
 (0)