3 Commits

Author SHA1 Message Date
e66070383f flake: Improve service preStart 2025-01-07 22:42:59 +03:00
438cd3d86f flake: Improve service preStart 2025-01-07 22:40:48 +03:00
0cf9b85787 flake: use enum for mode option 2025-01-07 22:15:08 +03:00

View File

@@ -77,7 +77,7 @@
'';
};
mode = mkOption {
type = types.str;
type = types.enum [ "hardlink" "symlink" "move" "copy" ];
default = "hardlink";
description = ''
Organization mode, one of [ hardlink symlink move copy ].
@@ -100,10 +100,11 @@
wantedBy = [
"default.target"
];
preStart = if !sync.skipFullSync then (''
preStart = ''
mkdir -p ${sync.target}
'' + (if !sync.skipFullSync then (''
photocatalog -source ${sync.source} -target ${sync.target} -mode ${sync.mode} ${if sync.overwrite then "-overwrite" else ""}
'') else null;
'') else null);
script = "photocatalog -source ${sync.source} -target ${sync.target} -skip-full-sync -watch -mode ${sync.mode} ${if sync.overwrite then "-overwrite" else ""}";
serviceConfig = {
Type="simple";