···7070 </listitem>
7171 <listitem>
7272 <para>
7373+ <literal>borgbackup</literal> module now has an option for
7474+ inhibiting system sleep while backups are running, defaulting
7575+ to off (not inhibiting sleep), available as
7676+ <link linkend="opt-services.borgbackup.jobs._name_.inhibitsSleep"><literal>services.borgbackup.jobs.<name>.inhibitsSleep</literal></link>.
7777+ </para>
7878+ </listitem>
7979+ <listitem>
8080+ <para>
7381 The EC2 image module no longer fetches instance metadata in
7482 stage-1. This results in a significantly smaller initramfs,
7583 since network drivers no longer need to be included, and
+2
nixos/doc/manual/release-notes/rl-2305.section.md
···28282929- `carnix` and `cratesIO` has been removed due to being unmaintained, use alternatives such as [naersk](https://github.com/nix-community/naersk) and [crate2nix](https://github.com/kolloch/crate2nix) instead.
30303131+- `borgbackup` module now has an option for inhibiting system sleep while backups are running, defaulting to off (not inhibiting sleep), available as [`services.borgbackup.jobs.<name>.inhibitsSleep`](#opt-services.borgbackup.jobs._name_.inhibitsSleep).
3232+3133- The EC2 image module no longer fetches instance metadata in stage-1. This results in a significantly smaller initramfs, since network drivers no longer need to be included, and faster boots, since metadata fetching can happen in parallel with startup of other services.
3234 This breaks services which rely on metadata being present by the time stage-2 is entered. Anything which reads EC2 metadata from `/etc/ec2-metadata` should now have an `after` dependency on `fetch-ec2-metadata.service`
3335
+21-4
nixos/modules/services/backup/borgbackup.nix
···1919 concatStringsSep " "
2020 (mapAttrsToList (x: y: "--keep-${x}=${toString y}") cfg.prune.keep);
21212222- mkBackupScript = cfg: ''
2222+ mkBackupScript = name: cfg: pkgs.writeShellScript "${name}-script" (''
2323+ set -e
2324 on_exit()
2425 {
2526 exitStatus=$?
···6162 ${optionalString (cfg.prune.prefix != null) "--glob-archives ${escapeShellArg "${cfg.prune.prefix}*"}"} \
6263 $extraPruneArgs
6364 ${cfg.postPrune}
6464- '';
6565+ '');
65666667 mkPassEnv = cfg: with cfg.encryption;
6768 if passCommand != null then
···7374 mkBackupService = name: cfg:
7475 let
7576 userHome = config.users.users.${cfg.user}.home;
7676- in nameValuePair "borgbackup-job-${name}" {
7777+ backupJobName = "borgbackup-job-${name}";
7878+ backupScript = mkBackupScript backupJobName cfg;
7979+ in nameValuePair backupJobName {
7780 description = "BorgBackup job ${name}";
7881 path = with pkgs; [
7982 borgbackup openssh
8083 ];
8181- script = mkBackupScript cfg;
8484+ script = "exec " + optionalString cfg.inhibitsSleep ''\
8585+ ${pkgs.systemd}/bin/systemd-inhibit \
8686+ --who="borgbackup" \
8787+ --what="sleep" \
8888+ --why="Scheduled backup" \
8989+ '' + backupScript;
8290 serviceConfig = {
8391 User = cfg.user;
8492 Group = cfg.group;
···338346 {manpage}`systemd.timer(5)`
339347 which triggers the backup immediately if the last trigger
340348 was missed (e.g. if the system was powered down).
349349+ '';
350350+ };
351351+352352+ inhibitsSleep = mkOption {
353353+ default = false;
354354+ type = types.bool;
355355+ example = true;
356356+ description = lib.mdDoc ''
357357+ Prevents the system from sleeping while backing up.
341358 '';
342359 };
343360