From 75d403085a1f66e673ded8e83b6d115ae26abfde Mon Sep 17 00:00:00 2001
From: catvayor <catvayor@katvayor.net>
Date: Thu, 3 Apr 2025 17:21:24 +0200
Subject: [PATCH] fix(patches): reformat a patch after treewide format of
 upstream

---
 REUSE.toml                                    |  6 +++
 default.nix                                   |  9 ++++
 patches/default.nix                           |  2 +-
 ...e-autocreate-to-verify_bucket_exists.patch | 44 +++++++++++++++++++
 4 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 patches/nixpkgs/09-rename-autocreate-to-verify_bucket_exists.patch

diff --git a/REUSE.toml b/REUSE.toml
index 53c1843..35a67b6 100644
--- a/REUSE.toml
+++ b/REUSE.toml
@@ -41,6 +41,12 @@ SPDX-License-Identifier = "EUPL-1.2"
 path = ["modules/nixos/extranix/0001-revert-don-t-parse-md-in-js.patch", "modules/nixos/extranix/0002-chore-remove-useless-dependencies.patch", "modules/nixos/extranix/0003-feat-separate-HTML-description-of-MD-description.patch", "modules/nixos/extranix/0004-fix-indentation-of-ul.patch", "modules/nixos/extranix/0005-feat-match-all-substring-by-default.patch"]
 precedence = "closest"
 
+[[annotations]]
+SPDX-FileCopyrightText = ["2024 Tom Hubrecht <tom.hubrecht@dgnum.eu>", "2025 Lubin Bailly <lubin.bailly@dgnum.eu>"]
+SPDX-License-Identifier = "EUPL-1.2"
+path = ["patches/nixpkgs/09-rename-autocreate-to-verify_bucket_exists.patch"]
+precedence = "closest"
+
 [[annotations]]
 SPDX-FileCopyrightText = "La Délégation Générale Numérique <contact@dgnum.eu>"
 SPDX-License-Identifier = "MIT"
diff --git a/default.nix b/default.nix
index c2ba752..cad75c4 100644
--- a/default.nix
+++ b/default.nix
@@ -131,6 +131,15 @@ let
         ];
         copyright = "2024 Lubin Bailly <lubin.bailly@dgnum.eu>";
       }
+      {
+        path = [
+          "patches/nixpkgs/09-rename-autocreate-to-verify_bucket_exists.patch"
+        ];
+        copyright = [
+          "2024 Tom Hubrecht <tom.hubrecht@dgnum.eu>"
+          "2025 Lubin Bailly <lubin.bailly@dgnum.eu>"
+        ];
+      }
 
       # colmena wrapper
       {
diff --git a/patches/default.nix b/patches/default.nix
index dd1779e..73cc702 100644
--- a/patches/default.nix
+++ b/patches/default.nix
@@ -17,7 +17,7 @@ in
 
   "nixos-24.11" = [
     # nixos/nextcloud: Rename autocreate (a no-op) to verify_bucket_exists
-    (npr 275165 "sha256-9a26V3Pi8yLD3N9+mC1kvJoruxRTp/qOHapnt6VX7pw=")
+    (local ./nixpkgs/09-rename-autocreate-to-verify_bucket_exists.patch)
 
     # Crabfit: don't depend on all google-fonts
     (local ./nixpkgs/03-crabfit-karla.patch)
diff --git a/patches/nixpkgs/09-rename-autocreate-to-verify_bucket_exists.patch b/patches/nixpkgs/09-rename-autocreate-to-verify_bucket_exists.patch
new file mode 100644
index 0000000..a5fe5bf
--- /dev/null
+++ b/patches/nixpkgs/09-rename-autocreate-to-verify_bucket_exists.patch
@@ -0,0 +1,44 @@
+From dbc114c35dbc279fcde483da805ca1b6d5f40b60 Mon Sep 17 00:00:00 2001
+From: Tom Hubrecht <tom@hubrecht.ovh>
+Date: Mon, 18 Dec 2023 10:40:16 +0100
+Subject: [PATCH] nixos/nextcloud: Rename autocreate (a no-op) to
+ verify_bucket_exists
+
+C.f. https://github.com/nextcloud/documentation/issues/10436
+---
+ nixos/modules/services/web-apps/nextcloud.nix | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/nixos/modules/services/web-apps/nextcloud.nix b/nixos/modules/services/web-apps/nextcloud.nix
+index 7f998207c434aa..ba1e1bbe46756a 100644
+--- a/nixos/modules/services/web-apps/nextcloud.nix
++++ b/nixos/modules/services/web-apps/nextcloud.nix
+@@ -142,7 +142,7 @@ let
+              'class' => '\\OC\\Files\\ObjectStore\\S3',
+              'arguments' => [
+               'bucket' => '${s3.bucket}',
+-              'autocreate' => ${boolToString s3.autocreate},
++              'verify_bucket_exists' => ${boolToString s3.verify_bucket_exists},
+               'key' => '${s3.key}',
+               'secret' => nix_read_secret('${s3.secretFile}'),
+               ${optionalString (s3.hostname != null) "'hostname' => '${s3.hostname}',"}
+@@ -277,6 +277,10 @@ in {
+       [ "services" "nextcloud" "extraOptions" ]
+       [ "services" "nextcloud" "settings" ]
+     )
++    (mkRenamedOptionModule
++      [ "services" "nextcloud" "config" "objectstore" "s3" "autocreate" ]
++      [ "services" "nextcloud" "config" "objectstore" "s3" "verify_bucket_exists" ]
++    )
+   ];
+ 
+   options.services.nextcloud = {
+@@ -568,7 +572,7 @@ in {
+               The name of the S3 bucket.
+             '';
+           };
+-          autocreate = mkOption {
++          verify_bucket_exists = mkOption {
+             type = types.bool;
+             description = lib.mdDoc ''
+               Create the objectstore if it does not exist.