From 5a772d3376ae7ffb4464bab2794350ea4015a83e Mon Sep 17 00:00:00 2001 From: ltadeu6 Date: Thu, 2 Apr 2026 11:12:05 -0300 Subject: [PATCH] autoupate --- hosts/Nixos/configuration.nix | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/hosts/Nixos/configuration.nix b/hosts/Nixos/configuration.nix index 26c4185..5e7653f 100644 --- a/hosts/Nixos/configuration.nix +++ b/hosts/Nixos/configuration.nix @@ -433,14 +433,36 @@ randomizedDelaySec = "45min"; flags = [ "--print-build-logs" - "--commit-lock-file" - "--update-input" - "nixpkgs" - "--update-input" - "home-manager" ]; }; + systemd.services."nix-flake-update" = { + description = "Update flake.lock and commit"; + serviceConfig = { + Type = "oneshot"; + WorkingDirectory = "/home/ltadeu6/nixos-config"; + Environment = [ + "GIT_AUTHOR_NAME=auto-upgrade" + "GIT_AUTHOR_EMAIL=auto-upgrade@localhost" + "GIT_COMMITTER_NAME=auto-upgrade" + "GIT_COMMITTER_EMAIL=auto-upgrade@localhost" + ]; + }; + script = '' + set -euo pipefail + /run/current-system/sw/bin/nix flake update --commit-lock-file + ''; + }; + + systemd.timers."nix-flake-update" = { + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "02:00"; + RandomizedDelaySec = "45min"; + Persistent = true; + }; + }; + nix.gc = { automatic = true; dates = "weekly";