structure, unison

This commit is contained in:
Henri Dohmen 2025-05-31 00:20:26 +02:00
parent b61bb970a5
commit fb70bd789e
4 changed files with 42 additions and 2 deletions

View file

@ -1 +1,7 @@
{ ... }: { }
{ ... }:
{
imports = [ ];
home = {
imports = [ ./hm ];
};
}

6
mod/hm/default.nix Normal file
View file

@ -0,0 +1,6 @@
{ ... }:
{
imports = [
./unison.nix
];
}

28
mod/hm/unison.nix Normal file
View file

@ -0,0 +1,28 @@
{ lib, config, ... }:
let
cfg = config.services.unison';
in
{
options.services.unison' = {
enable = lib.mkEnableOption "Unison file synchronizer";
pairs = lib.mkOption {
type = lib.types.attrsOf (lib.types.attrsOf (lib.types.listOf lib.types.str));
default = { };
description = "";
};
};
config = lib.mkIf cfg.enable {
home.file = lib.mapAttrs' (name: roots: {
name = ".unison/${name}.prf";
value.text =
''
watch = true
logfile = /dev/null
confirmbigdeletes = true
confirmmerge = true
''
+ lib.concatStringsSep "\n" (map (root: "root = ${root}") roots.roots);
}) cfg.pairs;
};
}