From b83c23b801c311b648ea3d87dc1c9263de217d5a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= <torjus@usit.uio.no>
Date: Thu, 3 Oct 2024 21:57:19 +0200
Subject: [PATCH] Fix warning in unit file

---
 backup.nix | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/backup.nix b/backup.nix
index 3c6d5bb..93a1a29 100644
--- a/backup.nix
+++ b/backup.nix
@@ -1,4 +1,9 @@
-{ lib, config, pkgs, utils, ... }:
+{
+  lib,
+  config,
+  pkgs,
+  ...
+}:
 let
   cfg = config.backup-helper;
   restic-wrapper = pkgs.writeShellApplication {
@@ -58,13 +63,16 @@ in
   };
   config = lib.mkIf cfg.enable {
     systemd.services."backup-helper" = {
+      wants = [ "network-online.target" ];
       after = [ "network-online.target" ];
-      environment = {
-        RESTIC_REPOSITORY = cfg.restic-repository;
-        BACKUP_HELPER_DIRS = lib.strings.concatStringsSep "," cfg.backup-dirs;
-      } // lib.attrsets.optionalAttrs (builtins.hasAttr "password-file" cfg) {
-        RESTIC_PASSWORD_FILE = cfg.password-file;
-      };
+      environment =
+        {
+          RESTIC_REPOSITORY = cfg.restic-repository;
+          BACKUP_HELPER_DIRS = lib.strings.concatStringsSep "," cfg.backup-dirs;
+        }
+        // lib.attrsets.optionalAttrs (builtins.hasAttr "password-file" cfg) {
+          RESTIC_PASSWORD_FILE = cfg.password-file;
+        };
       serviceConfig = {
         Type = "oneshot";
         ExecStart = "${restic-wrapper}/bin/restic-wrapper";
@@ -80,4 +88,3 @@ in
     };
   };
 }
-