Skip to content

Commit

Permalink
froide-govplan: init at 0-unstable-2024-09-19
Browse files Browse the repository at this point in the history
  • Loading branch information
onny committed Dec 11, 2024
1 parent 592b1a2 commit f528c04
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkgs/by-name/fr/froide-govplan/load_extra_settings.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/project/settings.py b/project/settings.py
index dd282ac..64ff265 100644
--- a/project/settings.py
+++ b/project/settings.py
@@ -202,3 +202,10 @@ CMS_CONFIRM_VERSION4 = True

GOVPLAN_NAME = "GovPlan"
GOVPLAN_ENABLE_FOIREQUEST = False
+
+EXTRA_SETTINGS_PATH = os.path.join(PROJECT_DIR, 'extra_settings.py')
+
+if os.path.exists(EXTRA_SETTINGS_PATH):
+ with open(EXTRA_SETTINGS_PATH) as f:
+ code = compile(f.read(), EXTRA_SETTINGS_PATH, 'exec')
+ exec(code)
104 changes: 104 additions & 0 deletions pkgs/by-name/fr/froide-govplan/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
lib,
python3,
fetchFromGitHub,
makeWrapper,
froide,
gdal,
geos,
nixosTests,
fetchpatch,
}:

let

python = python3.override {
packageOverrides = self: super: {
django = super.django.override { withGdal = true; };
};
};

in
python.pkgs.buildPythonApplication rec {
pname = "froide-govplan";
version = "0-unstable-2024-11-05";
pyproject = true;

src = fetchFromGitHub {
owner = "okfde";
repo = "froide-govplan";
# No tagged release yet
# https://github.com/okfde/froide-govplan/issues/15
rev = "5d2f5e6c0bc883c75a00e45893f3e32761d3159f";
hash = "sha256-hVZL8WMY0xorZv8k0qQ2Q7etJnwrl/CTKXkcQiLN+RQ=";
};

patches = [
# Add missing oauth2_provider app
# https://github.com/okfde/froide-govplan/pull/17
(fetchpatch {
url = "https://github.com/okfde/froide-govplan/commit/bc388b693ebc7656fc7917511048a47b68e119fe.patch";
hash = "sha256-StIyN3gFKd/fld14s03fsV6fmWinSRWINUyRRBzqVco=";
name = "add_oauth2_provider_app.patch";
})
# Enable automatic image cropping for filer
# https://github.com/okfde/froide-govplan/pull/19
(fetchpatch {
url = "https://github.com/okfde/froide-govplan/commit/d5db02f3bbc501929a901e964147a0ed2f974f41.patch";
hash = "sha256-jf6e84fd2kQIPER2HGmZNkbtl067311xdNJRU+iFVXM=";
name = "filer_enable_automatic_cropping.patch";
})

# Patch settings.py to source additional settings from the NixOS module
./load_extra_settings.patch
];

build-system = [ python.pkgs.setuptools ];

build-inputs = [ gdal ];

nativeBuildInputs = [ makeWrapper ];

dependencies = with python.pkgs; [
bleach
django-admin-sortable2
django-cms
django-filer
django-mfa3
django-oauth-toolkit
django-tinymce
psycopg
(toPythonModule (froide.override { python3Packages = python.pkgs; }))
django-mptt
django-sekizai
django-treebeard
djangocms-alias
];

postInstall = ''
cp manage.py $out/${python.sitePackages}/froide_govplan/
cp -r project $out/${python.sitePackages}/froide_govplan/
cp -r project $out/${python.sitePackages}/
makeWrapper $out/${python.sitePackages}/froide_govplan/manage.py $out/bin/froide-govplan \
--prefix PYTHONPATH : "$PYTHONPATH" \
--set GDAL_LIBRARY_PATH "${gdal}/lib/libgdal.so" \
--set GEOS_LIBRARY_PATH "${geos}/lib/libgeos_c.so"
'';

passthru = {
tests = {
inherit (nixosTests) froide-govplan;
};
python = python;
pythonPath = python.pkgs.makePythonPath dependencies;
};

meta = {
description = "Government planner and basis of FragDenStaat.de Koalitionstracker";
homepage = "https://github.com/okfde/froide-govplan";
license = lib.licenses.mit;
maintainers = [ lib.maintainers.onny ];
mainProgram = "froide-govplan";
};

}

0 comments on commit f528c04

Please sign in to comment.