From 4fbf63bfaa46e7a2189ac8f5569cdf7634b07a9d Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Tue, 19 Aug 2025 10:17:08 +0200 Subject: [PATCH 01/10] update module --- module.nix | 67 +++++++++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/module.nix b/module.nix index b0250e7..a942901 100644 --- a/module.nix +++ b/module.nix @@ -21,40 +21,39 @@ in config = lib.mkIf cfg.enable { - services.uwsgi = { - enable = true; - user = "fragify"; - group = "fragify"; - plugins = [ "python3" ]; - instances.fragify = { - # Align with upstream module: put uwsgi options under settings - settings = { - "chdir" = "/"; - "wsgi-file" = "${pkgs.fragify}/share/fragify/fragify_wsgi.py"; - module = "fragify:app"; - # Socket - "socket" = "unix:${config.services.uwsgi.runDir}/fragify.sock"; - "chmod-socket" = "660"; - umask = "0077"; - vacuum = true; - master = true; - processes = 2; - threads = 2; - "harakiri" = 60; - "buffer-size" = 65535; - "need-app" = true; - "no-orphans" = true; - # Serve static files directly via uWSGI (optional) - # Map /static to packaged assets directory (if present) - "static-map" = "/static=${pkgs.fragify}/share/fragify/assets"; - }; - # Environment for the WSGI app - env = { - FRAGIFY_TEMPLATES_DIR = "${pkgs.fragify}/share/fragify/templates"; - FRAGIFY_STATIC_DIR = "${pkgs.fragify}/share/fragify/assets"; - }; - # Python packages for uWSGI - pythonPackages = p: with p; [ falcon requests jinja2 ]; + # uWSGI configuration (nixos-25.05 uses `instance`, not `instances`) + services.uwsgi.enable = true; + services.uwsgi.user = "fragify"; + services.uwsgi.group = "fragify"; + services.uwsgi.plugins = [ "python3" ]; + services.uwsgi.instance."fragify" = { + type = "normal"; + chdir = "/"; + # WSGI entry from packaged share dir + wsgi-file = "${pkgs.fragify}/share/fragify/fragify_wsgi.py"; + module = "fragify:app"; + # Socket + socket = "unix:${config.services.uwsgi.runDir}/fragify.sock"; + "chmod-socket" = "660"; + umask = "0077"; + vacuum = true; + master = true; + processes = 2; + threads = 2; + harakiri = 60; + "buffer-size" = 65535; + need-app = true; + "no-orphans" = true; + # Pass environment to the app + env = { + FRAGIFY_TEMPLATES_DIR = "${pkgs.fragify}/share/fragify/templates"; + FRAGIFY_STATIC_DIR = "${pkgs.fragify}/share/fragify/assets"; + }; + # Python deps for the embedded interpreter + pythonPackages = p: with p; [ falcon requests jinja2 ]; + # Extra raw uWSGI settings not covered by module options + settings = { + "static-map" = "/static=${pkgs.fragify}/share/fragify/assets"; }; }; From 65b556d858ec129a53bc1fa3c0e80001dcbff890 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Tue, 19 Aug 2025 10:18:08 +0200 Subject: [PATCH 02/10] update module --- module.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/module.nix b/module.nix index a942901..c8d60ed 100644 --- a/module.nix +++ b/module.nix @@ -23,8 +23,6 @@ in # uWSGI configuration (nixos-25.05 uses `instance`, not `instances`) services.uwsgi.enable = true; - services.uwsgi.user = "fragify"; - services.uwsgi.group = "fragify"; services.uwsgi.plugins = [ "python3" ]; services.uwsgi.instance."fragify" = { type = "normal"; From 5fc5c123ff2b1e75367a284bba8acba13148615b Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Tue, 19 Aug 2025 10:23:17 +0200 Subject: [PATCH 03/10] update module --- flake.nix | 9 +++------ gulpfile.js | 9 ++++++++- module.nix | 4 ++-- templates/base.html | 3 ++- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/flake.nix b/flake.nix index 8cdf623..61861b3 100644 --- a/flake.nix +++ b/flake.nix @@ -23,12 +23,7 @@ src = self; - dependencies = with python3Packages; [ - python - falcon - requests - jinja2 - ]; + dependencies = with python3Packages; [ falcon requests jinja2 ]; installPhase = '' install -Dm755 ${./fragify.py} $out/bin/fragify @@ -42,6 +37,8 @@ fi ''; + passthru.pythonPath = python3Packages.makePythonPath dependencies; + meta.mainProgram = "fragify"; }; }; diff --git a/gulpfile.js b/gulpfile.js index e6113ba..3628105 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -31,6 +31,13 @@ gulp.task('copy-select2-theme', function () { .pipe(gulp.dest('./assets/css')); }); -gulp.task('copy-assets', gulp.series('copy-bulk', 'copy-jquery', 'copy-select2-theme')); +// Copy favicon(s) +gulp.task('copy-favicon', function () { + return gulp + .src(['./favicon.svg'], { allowEmpty: true }) + .pipe(gulp.dest('./assets')); +}); + +gulp.task('copy-assets', gulp.series('copy-bulk', 'copy-jquery', 'copy-select2-theme', 'copy-favicon')); gulp.task('default', gulp.series('copy-assets')); \ No newline at end of file diff --git a/module.nix b/module.nix index c8d60ed..7e8f965 100644 --- a/module.nix +++ b/module.nix @@ -44,11 +44,11 @@ in "no-orphans" = true; # Pass environment to the app env = { + PYTHONPATH = "${pkgs.fragify.pythonPath}"; FRAGIFY_TEMPLATES_DIR = "${pkgs.fragify}/share/fragify/templates"; FRAGIFY_STATIC_DIR = "${pkgs.fragify}/share/fragify/assets"; }; - # Python deps for the embedded interpreter - pythonPackages = p: with p; [ falcon requests jinja2 ]; + # Python deps for the embedded interpreter moved to PYTHONPATH in env # Extra raw uWSGI settings not covered by module options settings = { "static-map" = "/static=${pkgs.fragify}/share/fragify/assets"; diff --git a/templates/base.html b/templates/base.html index 9121a9a..5c96c5b 100644 --- a/templates/base.html +++ b/templates/base.html @@ -25,7 +25,8 @@ {% if noindex %}{% endif %} - + + {% block meta_extra %}{% endblock %}