about summary refs log tree commit diff stats
path: root/hm/soispha
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2024-02-28 20:46:55 +0100
committerSoispha <soispha@vhack.eu>2024-02-28 20:46:55 +0100
commit8224aa5bd7cf061c2da79328d866de245e54e782 (patch)
treeea1fd5c9f56feb319936fe863065376d68709664 /hm/soispha
parentfeat(hm): Add nix-index and associated command_not_found_handler (diff)
downloadnixos-config-8224aa5bd7cf061c2da79328d866de245e54e782.zip
feat(hm/conf/unison): Support merging special paths
Diffstat (limited to 'hm/soispha')
-rw-r--r--hm/soispha/conf/unison/default.nix21
1 files changed, 21 insertions, 0 deletions
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: