restic: Make better use of inherit

This commit is contained in:
SebastianStork 2025-10-06 21:45:04 +02:00
parent 33c79eb8ff
commit eff39a6ccd

View file

@ -41,13 +41,14 @@ in
text = text =
let let
inherit (value) conflictingService; inherit (value) conflictingService;
inherit (value.restoreCommand) preRestore postRestore;
hasconflictingService = conflictingService != null; hasconflictingService = conflictingService != null;
in in
'' ''
${lib.optionalString hasconflictingService "systemctl stop ${conflictingService}"} ${lib.optionalString hasconflictingService "systemctl stop ${conflictingService}"}
${value.restoreCommand.preRestore} ${preRestore}
restic-${name} restore latest --target / restic-${name} restore latest --target /
${value.restoreCommand.postRestore} ${postRestore}
${lib.optionalString hasconflictingService "systemctl start ${conflictingService}"} ${lib.optionalString hasconflictingService "systemctl start ${conflictingService}"}
''; '';
} }