pkgs: {
  systemd.user.services.pkgs-update = {
    enable = true;
    wantedBy = [ "multi-user.target" ];
    path = with pkgs; [ coreutils git nix ];
    script = ''
      cd /etc/nixos
      nix flake update
      git diff --quiet flake.lock && continue
      git add flake.lock
      git commit -m "Daily Update at `date -Iseconds`"
    '';
    serviceConfig.Type = "oneshot";
  };

  systemd.user.timers.pkgs-update = {
    wantedBy = [ "timers.target" ];
    timerConfig = {
      OnCalendar = "daily";
      Persistent = true;
      Unit = "pkgs-update.service";
    };
  };
}