Merge pull request #154061 from winterqt/borgbackup-empty-archive-base-name

nixos/borgbackup: allow empty archive base name

authored by pennae and committed by GitHub 4a44a5f1 cf3c3da4

+6 -5
+6 -5
nixos/modules/services/backup/borgbackup.nix
··· 30 } 31 trap 'on_exit' INT TERM QUIT EXIT 32 33 - archiveName="${cfg.archiveBaseName}-$(date ${cfg.dateFormat})" 34 archiveSuffix="${optionalString cfg.appendFailedSuffix ".failed"}" 35 ${cfg.preHook} 36 '' + optionalString cfg.doInit '' ··· 60 '' + optionalString (cfg.prune.keep != { }) '' 61 borg prune $extraArgs \ 62 ${mkKeepArgs cfg} \ 63 - --prefix ${escapeShellArg cfg.prune.prefix} \ 64 $extraPruneArgs 65 ${cfg.postPrune} 66 ''; ··· 284 }; 285 286 archiveBaseName = mkOption { 287 - type = types.strMatching "[^/{}]+"; 288 default = "${globalConfig.networking.hostName}-${name}"; 289 defaultText = literalExpression ''"''${config.networking.hostName}-<name>"''; 290 description = '' ··· 292 determined by <option>dateFormat</option>, will be appended. The full 293 name can be modified at runtime (<literal>$archiveName</literal>). 294 Placeholders like <literal>{hostname}</literal> must not be used. 295 ''; 296 }; 297 ··· 471 }; 472 473 prune.prefix = mkOption { 474 - type = types.str; 475 description = '' 476 Only consider archive names starting with this prefix for pruning. 477 By default, only archives created by this job are considered. 478 - Use <literal>""</literal> to consider all archives. 479 ''; 480 default = config.archiveBaseName; 481 defaultText = literalExpression "archiveBaseName";
··· 30 } 31 trap 'on_exit' INT TERM QUIT EXIT 32 33 + archiveName="${if cfg.archiveBaseName == null then "" else cfg.archiveBaseName + "-"}$(date ${cfg.dateFormat})" 34 archiveSuffix="${optionalString cfg.appendFailedSuffix ".failed"}" 35 ${cfg.preHook} 36 '' + optionalString cfg.doInit '' ··· 60 '' + optionalString (cfg.prune.keep != { }) '' 61 borg prune $extraArgs \ 62 ${mkKeepArgs cfg} \ 63 + ${optionalString (cfg.prune.prefix != null) "--prefix ${escapeShellArg cfg.prune.prefix} \\"} 64 $extraPruneArgs 65 ${cfg.postPrune} 66 ''; ··· 284 }; 285 286 archiveBaseName = mkOption { 287 + type = types.nullOr (types.strMatching "[^/{}]+"); 288 default = "${globalConfig.networking.hostName}-${name}"; 289 defaultText = literalExpression ''"''${config.networking.hostName}-<name>"''; 290 description = '' ··· 292 determined by <option>dateFormat</option>, will be appended. The full 293 name can be modified at runtime (<literal>$archiveName</literal>). 294 Placeholders like <literal>{hostname}</literal> must not be used. 295 + Use <literal>null</literal> for no base name. 296 ''; 297 }; 298 ··· 472 }; 473 474 prune.prefix = mkOption { 475 + type = types.nullOr (types.str); 476 description = '' 477 Only consider archive names starting with this prefix for pruning. 478 By default, only archives created by this job are considered. 479 + Use <literal>""</literal> or <literal>null</literal> to consider all archives. 480 ''; 481 default = config.archiveBaseName; 482 defaultText = literalExpression "archiveBaseName";