From 8224aa5bd7cf061c2da79328d866de245e54e782 Mon Sep 17 00:00:00 2001 From: Soispha Date: Wed, 28 Feb 2024 20:46:55 +0100 Subject: feat(hm/conf/unison): Support merging special paths --- hm/soispha/conf/unison/default.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/hm/soispha/conf/unison/default.nix b/hm/soispha/conf/unison/default.nix index 13535cb7..dee32d8e 100644 --- a/hm/soispha/conf/unison/default.nix +++ b/hm/soispha/conf/unison/default.nix @@ -15,6 +15,18 @@ auto = "true"; # This is useless, with hm links links = "false"; + + backupdir = "${unisonPath}/backups"; + backuploc = "central"; + backupcurr = paths_to_merge; + merge = + builtins.map (x: ''${x} -> diff3 -m CURRENT1 CURRENTARCH CURRENT2 > NEW || echo "differences detected"'') + paths_to_merge; + }; + + paths_to_merge = mkPathName { + file_names = []; + extensions = ["history"]; }; paths_to_keep = [ @@ -47,6 +59,15 @@ then "tiamat" else builtins.throw "Host (${hn}) not yet covered in the unison host mapping."; + mkPathName = { + file_names, + extensions, + }: + builtins.map (x: ''Name ${x}'') ( + (builtins.map (x: ''*.${x}'') file_names) + ++ extensions + ); + unitName = name: builtins.replaceStrings ["/"] ["-"] name; mkPath = path: -- cgit 1.4.1