Gaetan Lepage
2026-02-01 14:08:31 +00:00
parent c42f42b692
commit 147673c451
3 changed files with 33 additions and 39 deletions
+28 -23
View File
@@ -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;
};
}
})
@@ -1,12 +1,3 @@
From 49c6138eab0a37d062c5e7d936535d1832b3e031 Mon Sep 17 00:00:00 2001
From: soyouzpanda <soyouzpanda@soyouzpanda.fr>
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
@@ -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"