From 147673c451903f80c95d5ac3fb77d3f1aeee59e4 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Fri, 30 Jan 2026 23:42:09 +0000 Subject: [PATCH] lasuite-docs: 4.4.0 -> 4.5.0 Diff: https://github.com/suitenumerique/docs/compare/v4.4.0...v4.5.0 Changelog: https://github.com/suitenumerique/docs/blob/v4.5.0/CHANGELOG.md --- pkgs/by-name/la/lasuite-docs/package.nix | 51 ++++++++++--------- .../la/lasuite-docs/postgresql_fix.patch | 11 ---- .../la/lasuite-docs/secure_settings.patch | 10 ++-- 3 files changed, 33 insertions(+), 39 deletions(-) diff --git a/pkgs/by-name/la/lasuite-docs/package.nix b/pkgs/by-name/la/lasuite-docs/package.nix index 7a5c134d6061..47e7e5759664 100644 --- a/pkgs/by-name/la/lasuite-docs/package.nix +++ b/pkgs/by-name/la/lasuite-docs/package.nix @@ -1,28 +1,22 @@ { stdenv, lib, - python3, + python3Packages, fetchFromGitHub, nixosTests, fetchYarnDeps, + python3, nodejs, yarnBuildHook, yarnConfigHook, }: let - python = python3.override { - self = python3; - packageOverrides = self: super: { - django = super.django_5; - }; - }; - - version = "4.4.0"; + version = "4.5.0"; src = fetchFromGitHub { owner = "suitenumerique"; repo = "docs"; tag = "v${version}"; - hash = "sha256-Cm/Ch7dBKInQYPFGfSlSMLgj8uQR6E3S+6gCFUyvFSU="; + hash = "sha256-/mI11ldbYa051WA2hkV7fnc8CJOb0jHra0FJ+eVCqVs="; }; mail-templates = stdenv.mkDerivation { @@ -48,7 +42,7 @@ let }; in -python.pkgs.buildPythonApplication rec { +python3Packages.buildPythonApplication (finalAttrs: { pname = "lasuite-docs"; pyproject = true; inherit version src; @@ -58,14 +52,25 @@ python.pkgs.buildPythonApplication rec { patches = [ # Support configuration throught environment variables for SECURE_* ./secure_settings.patch + # Fix creation of unsafe C function in postgresql migrations ./postgresql_fix.patch ]; - build-system = with python.pkgs; [ setuptools ]; + # Otherwise fails with: + # socket.gaierror: [Errno 8] nodename nor servname provided, or not known + postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' + substituteInPlace impress/settings.py \ + --replace-fail \ + "gethostname()" \ + "gethostname() + '.local'" + ''; + __darwinAllowLocalNetworking = true; + + build-system = with python3Packages; [ setuptools ]; dependencies = - with python.pkgs; + with python3Packages; [ beautifulsoup4 boto3 @@ -115,12 +120,12 @@ python.pkgs.buildPythonApplication rec { postBuild = '' export DATA_DIR=$(pwd)/data - ${python.pythonOnBuildForHost.interpreter} manage.py collectstatic --no-input --clear + ${python3.pythonOnBuildForHost.interpreter} manage.py collectstatic --no-input --clear ''; postInstall = let - pythonPath = python.pkgs.makePythonPath dependencies; + pythonPath = python3Packages.makePythonPath finalAttrs.passthru.dependencies; in '' mkdir -p $out/{bin,share} @@ -131,13 +136,13 @@ python.pkgs.buildPythonApplication rec { makeWrapper $out/bin/.manage.py $out/bin/docs \ --prefix PYTHONPATH : "${pythonPath}" - makeWrapper ${lib.getExe python.pkgs.celery} $out/bin/celery \ - --prefix PYTHONPATH : "${pythonPath}:$out/${python.sitePackages}" - makeWrapper ${lib.getExe python.pkgs.gunicorn} $out/bin/gunicorn \ - --prefix PYTHONPATH : "${pythonPath}:$out/${python.sitePackages}" + makeWrapper ${lib.getExe python3Packages.celery} $out/bin/celery \ + --prefix PYTHONPATH : "${pythonPath}:$out/${python3.sitePackages}" + makeWrapper ${lib.getExe python3Packages.gunicorn} $out/bin/gunicorn \ + --prefix PYTHONPATH : "${pythonPath}:$out/${python3.sitePackages}" - mkdir -p $out/${python.sitePackages}/core/templates - ln -sv ${mail-templates}/ $out/${python.sitePackages}/core/templates/mail + mkdir -p $out/${python3.sitePackages}/core/templates + ln -sv ${mail-templates}/ $out/${python3.sitePackages}/core/templates/mail ''; passthru.tests = { @@ -147,10 +152,10 @@ python.pkgs.buildPythonApplication rec { meta = { description = "Collaborative note taking, wiki and documentation platform that scales. Built with Django and React. Opensource alternative to Notion or Outline"; homepage = "https://github.com/suitenumerique/docs"; - changelog = "https://github.com/suitenumerique/docs/blob/${src.tag}/CHANGELOG.md"; + changelog = "https://github.com/suitenumerique/docs/blob/${finalAttrs.src.tag}/CHANGELOG.md"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ soyouzpanda ]; mainProgram = "docs"; platforms = lib.platforms.all; }; -} +}) diff --git a/pkgs/by-name/la/lasuite-docs/postgresql_fix.patch b/pkgs/by-name/la/lasuite-docs/postgresql_fix.patch index 562251015410..d15988dad623 100644 --- a/pkgs/by-name/la/lasuite-docs/postgresql_fix.patch +++ b/pkgs/by-name/la/lasuite-docs/postgresql_fix.patch @@ -1,12 +1,3 @@ -From 49c6138eab0a37d062c5e7d936535d1832b3e031 Mon Sep 17 00:00:00 2001 -From: soyouzpanda -Date: Tue, 23 Dec 2025 19:43:50 +0100 -Subject: [PATCH] fix: disable postgresql C function creation - ---- - core/migrations/0027_auto_20251120_0956.py | 5 ----- - 1 file changed, 5 deletions(-) - diff --git a/core/migrations/0027_auto_20251120_0956.py b/core/migrations/0027_auto_20251120_0956.py index fe795ff5..0db2090c 100644 --- a/core/migrations/0027_auto_20251120_0956.py @@ -23,5 +14,3 @@ index fe795ff5..0db2090c 100644 CREATE OR REPLACE FUNCTION public.f_unaccent(text) RETURNS text LANGUAGE sql IMMUTABLE PARALLEL SAFE STRICT --- -2.50.1 diff --git a/pkgs/by-name/la/lasuite-docs/secure_settings.patch b/pkgs/by-name/la/lasuite-docs/secure_settings.patch index f679c96b0fc5..6da1b99022da 100644 --- a/pkgs/by-name/la/lasuite-docs/secure_settings.patch +++ b/pkgs/by-name/la/lasuite-docs/secure_settings.patch @@ -1,8 +1,8 @@ diff --git a/impress/settings.py b/impress/settings.py -index 9d825095..518aca7f 100755 +index 80d3a149..af4c4229 100755 --- a/impress/settings.py +++ b/impress/settings.py -@@ -822,19 +822,24 @@ class Production(Base): +@@ -1070,19 +1070,24 @@ class Production(Base): # # In other cases, you should comment the following line to avoid security issues. # SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") @@ -25,12 +25,12 @@ index 9d825095..518aca7f 100755 "^__lbheartbeat__", "^__heartbeat__", ] - + # Modern browsers require to have the `secure` attribute on cookies with `Samesite=none` - CSRF_COOKIE_SECURE = True - SESSION_COOKIE_SECURE = True + CSRF_COOKIE_SECURE = values.BooleanValue(True, environ_name="CSRF_COOKIE_SECURE") + SESSION_COOKIE_SECURE = values.BooleanValue(True, environ_name="SESSION_COOKIE_SECURE") - + SESSION_CACHE_ALIAS = "session" + # Privacy - SECURE_REFERRER_POLICY = "same-origin"