add remove-duplicates option

This commit is contained in:
Robin Appelman 2025-10-22 19:32:51 +02:00
commit 6705debd2a
8 changed files with 308 additions and 30 deletions

View file

@ -9,7 +9,10 @@ with lib; let
format = pkgs.formats.toml {};
removeNulls = filterAttrs (_: val: val != null);
configFile = format.generate "galton.toml" {
watch = removeNulls {inherit (cfg) symlink;};
watch = removeNulls {
inherit (cfg) symlink;
remove-duplicates = cfg.removeDuplicates;
};
rule = map removeNulls cfg.rules;
};
in {
@ -28,6 +31,12 @@ in {
description = "Create a symlink to matched files";
};
removeDuplicates = mkOption {
type = types.bool;
default = false;
description = "Remove duplicate downloads";
};
rules = mkOption {
default = [];
type = types.listOf (types.submodule {