From b31f045d45b4b6fb39964b4ffe9fcc33dc2380c3 Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Mon, 28 Jul 2025 20:29:29 -0500 Subject: [PATCH] scripts --- homeManagerModules/restic/profiles/base.nix | 2 +- homeManagerModules/restic/resticprofile.nix | 32 ++++++++++++++++----- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/homeManagerModules/restic/profiles/base.nix b/homeManagerModules/restic/profiles/base.nix index 7a95998..528e3f5 100644 --- a/homeManagerModules/restic/profiles/base.nix +++ b/homeManagerModules/restic/profiles/base.nix @@ -26,7 +26,7 @@ "*.csv" "*.m4a" ]; - schedule-permission = "system"; + schedule-permission = "user"; schedule-priority = "background"; check-after = true; }; diff --git a/homeManagerModules/restic/resticprofile.nix b/homeManagerModules/restic/resticprofile.nix index 48c6179..e4348bb 100644 --- a/homeManagerModules/restic/resticprofile.nix +++ b/homeManagerModules/restic/resticprofile.nix @@ -39,11 +39,29 @@ in { }; }; - config = mkIf cfg.enable { - home.packages = [ cfg.package ]; - xdg.configFile."resticprofile/profiles.yaml".source = yamlFormat.generate "profiles" { - version = "2"; - profiles = profiles; - }; - }; + config = mkIf cfg.enable ( + let + resticprofileCmd = '' + ${cfg.package}/bin/resticprofile --config "${config.xdg.configHome}/resticprofile/profiles.yaml" + ''; + in { + # Add a script to manually unschedule and reschedule all resticprofiles + home.packages = [ + cfg.package + (pkgs.writeShellScriptBin "rp" '' + set -e + sudo ${cfg.package}/bin/resticprofile --config "${config.xdg.configHome}/resticprofile/profiles.yaml" $@ + '') + (pkgs.writeShellScriptBin "rps" '' + set -e + rp unschedule --all + rp schedule --all + '') + ]; + xdg.configFile."resticprofile/profiles.yaml".source = yamlFormat.generate "profiles" { + version = "2"; + profiles = profiles; + }; + } + ); }