sigal: fix crash when building gallery

When building a gallery using `sigal build` the process would error
out with an message along the lines of

shutil.Error: [('/nix/store/…/static/css',
'/…/_build/static/css',
"[Errno 13] Permission denied: '/…/_build/static/css'"),

]

This is caused by `shutil.copytree` copying the permissions (555) of
the directories in the Nix store and then attempting to make
modifications to the copied directory. The patch makes the copy ignore
the permissions of directories.

+18
+16
pkgs/applications/misc/sigal/copytree-permissions.patch
···
··· 1 + diff -Nurp sigal-2.3.orig/sigal/writer.py sigal-2.3/sigal/writer.py 2 + --- sigal-2.3.orig/sigal/writer.py 2022-08-08 19:43:10.934707194 +0200 3 + +++ sigal-2.3/sigal/writer.py 2022-08-08 19:44:57.542382532 +0200 4 + @@ -103,7 +103,11 @@ class AbstractWriter: 5 + os.path.join(THEMES_PATH, 'default', 'static'), 6 + os.path.join(self.theme, 'static'), 7 + ): 8 + - shutil.copytree(static_path, self.theme_path, dirs_exist_ok=True) 9 + + # https://stackoverflow.com/a/17022146/4935114 10 + + orig_copystat = shutil.copystat 11 + + shutil.copystat = lambda x, y: x 12 + + shutil.copytree(static_path, self.theme_path, dirs_exist_ok=True, copy_function=shutil.copy) 13 + + shutil.copystat = orig_copystat 14 + 15 + if self.settings["user_css"]: 16 + if not os.path.exists(self.settings["user_css"]):
+2
pkgs/applications/misc/sigal/default.nix
··· 14 hash = "sha256-4Zsb/OBtU/jV0gThEYe8bcrb+6hW+hnzQS19q1H409Q="; 15 }; 16 17 propagatedBuildInputs = with python3.pkgs; [ 18 # install_requires 19 jinja2
··· 14 hash = "sha256-4Zsb/OBtU/jV0gThEYe8bcrb+6hW+hnzQS19q1H409Q="; 15 }; 16 17 + patches = [ ./copytree-permissions.patch ]; 18 + 19 propagatedBuildInputs = with python3.pkgs; [ 20 # install_requires 21 jinja2