diff --git a/assets/favicon.svg b/assets/favicon.svg deleted file mode 100644 index 0519ecb..0000000 --- a/assets/favicon.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/favicon.svg b/favicon.svg deleted file mode 100644 index 405ec3c..0000000 --- a/favicon.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/flake.nix b/flake.nix index 1736249..8cdf623 100644 --- a/flake.nix +++ b/flake.nix @@ -16,21 +16,24 @@ ); in { overlay = final: prev: { - fragify = with final; python3Packages.buildPythonApplication rec { + fragify = with final; python3Packages.buildPythonApplication { pname = "fragify"; version = "0.0.1"; format = "other"; src = self; - dontBuild = true; - - dependencies = with python3Packages; [ falcon requests jinja2 ]; + dependencies = with python3Packages; [ + python + falcon + requests + jinja2 + ]; installPhase = '' install -Dm755 ${./fragify.py} $out/bin/fragify mkdir -p $out/share/fragify - cp -r ${./templates} $out/share/fragify/templates + cp -r ${./templates} $out/share/fragify/ # Provide a WSGI entry file for uWSGI to load install -Dm644 ${./fragify.py} $out/share/fragify/fragify_wsgi.py # Install built assets if present @@ -39,8 +42,6 @@ fi ''; - passthru.pythonPath = python3Packages.makePythonPath dependencies; - meta.mainProgram = "fragify"; }; }; diff --git a/gulpfile.js b/gulpfile.js index 3628105..e6113ba 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -31,13 +31,6 @@ gulp.task('copy-select2-theme', function () { .pipe(gulp.dest('./assets/css')); }); -// 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('copy-assets', gulp.series('copy-bulk', 'copy-jquery', 'copy-select2-theme')); gulp.task('default', gulp.series('copy-assets')); \ No newline at end of file diff --git a/module.nix b/module.nix index c611ce4..b0250e7 100644 --- a/module.nix +++ b/module.nix @@ -6,72 +6,69 @@ }: let - cfg = config.services.fragify; + cfg = config.services.fragify; in { - options = { - services.fragify = { + options = { + services.fragify = { - enable = lib.mkEnableOption "Fragify web app"; + enable = lib.mkEnableOption "Fragify web app"; - }; - }; + }; + }; - config = lib.mkIf cfg.enable { + config = lib.mkIf cfg.enable { - services.uwsgi = { - enable = true; - plugins = [ "python3" ]; + 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 ]; + }; + }; - instance = { - type = "emperor"; - vassals = { - fragify = { - type = "normal"; - chdir = "/"; + # Ensure fragify user and group exist + users.users.fragify = { + isSystemUser = true; + group = "fragify"; + description = "fragify web application user"; + }; - module = "fragify_wsgi:app"; + users.groups.fragify = {}; + }; - socket = "${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; - - env = [ - "PYTHONPATH=${pkgs.fragify}/share/fragify:${pkgs.fragify.pythonPath}" - "FRAGIFY_TEMPLATES_DIR=${pkgs.fragify}/share/fragify/templates" - "FRAGIFY_STATIC_DIR=${pkgs.fragify}/share/fragify/assets" - ]; - - settings = { - "static-map" = "/static=${pkgs.fragify}/share/fragify/assets"; - }; - }; - }; - }; - }; - - # Ensure fragify user and group exist - users.users.fragify = { - isSystemUser = true; - group = "fragify"; - description = "fragify web application user"; - }; - - users.groups.fragify = { }; - }; - - meta = { - maintainers = with lib.maintainers; [ onny ]; - }; + meta = { + maintainers = with lib.maintainers; [ onny ]; + }; } diff --git a/templates/base.html b/templates/base.html index 5c96c5b..9121a9a 100644 --- a/templates/base.html +++ b/templates/base.html @@ -25,8 +25,7 @@ {% if noindex %}{% endif %} - - + {% block meta_extra %}{% endblock %}