refactor: split the repo into self-contained validator, directory, quickstart, spec and site folders

validator/ holds mewslint (lint, css, fetch, DTD/CSS data); directory/ holds
the mews.page service (app, db, check, pages, cli) and depends on validator/;
quickstart/ holds mews-quickstart and md2mews.py for third parties who want
to create Mews content without cloning the repo; spec/ consolidates doc/ and
dtd/ with the canonical mews-0.1.css; site/ becomes a Pelican project with
the forward-facing pages as Markdown, the check form kept as a raw HTML
snippet. Root pyproject.toml is now a virtual uv workspace over validator,
directory and quickstart, with cross-cutting tests that span more than one
of them staying at the repo root. Makefile and flake.nix updated to match.
This commit is contained in:
randogoth 2026-10-13 12:29:23 +03:00
parent 5fa8708bd1
commit 060d4e00fd
90 changed files with 1290 additions and 287 deletions

View file

@ -1,5 +1,5 @@
{
description = "Mews Profile: page validator, site directory and the mews.page site";
description = "Mews Profile: page validator, directory service, quickstart, and the mews.page site";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
@ -35,6 +35,10 @@
inherit (nixpkgs) lib;
forAllSystems = lib.genAttrs lib.systems.flakeExposed;
# Covers the three self-contained Python projects: validator/,
# directory/ and quickstart/. site/ and pelican-mews/ are plain Python
# projects outside this uv workspace, same as before, each installable
# on its own.
workspace = uv2nix.lib.workspace.loadWorkspace { workspaceRoot = ./.; };
# Wheels, not sources: the service is built on the machine it runs on,
@ -78,8 +82,9 @@
packages = [
virtualenv
pkgs.uv
# md2mews.py is a standalone script with its own dependency
# header, so it is not part of the workspace environment.
# quickstart/md2mews.py is a standalone script with its own
# dependency header, so it is not part of the workspace
# environment.
(pkgs.python3.withPackages (ps: [ ps.mistune ]))
];
env = {
@ -99,8 +104,26 @@
system:
let
pkgs = nixpkgs.legacyPackages.${system};
pyPkgs = pkgs.python3Packages;
# The directory service plus the validator and quickstart it was
# built alongside, for deploying or running any of their commands.
app = pythonSets.${system}.mkVirtualEnv "mews-env" workspace.deps.default;
converter = pkgs.python3.withPackages (ps: [ ps.mistune ]);
# pelican-mews uses pdm-backend and is not part of the uv workspace
# above (it stays installable on its own, the same way it always
# has been). Building it here, from plain nixpkgs python tooling,
# is what lets the site build run inside the sandbox with no
# network access.
pelicanMews = pyPkgs.buildPythonPackage {
pname = "pelican-mews";
version = "0.1.0";
pyproject = true;
src = ./pelican-mews;
build-system = [ pyPkgs.pdm-backend ];
dependencies = [ pyPkgs.lxml pyPkgs.pelican ];
};
siteBuilder = pkgs.python3.withPackages (ps: [ ps.pelican ps.markdown pelicanMews ]);
in
{
default = app;
@ -109,14 +132,20 @@
# page that does not follow the spec cannot reach the server.
site = pkgs.runCommand "mews-site" { } ''
mkdir -p $out/spec $out/dtd
cp ${./site}/index.html ${./site}/check.html $out/
cp ${./mews-0.1.css} $out/mews-0.1.css
cp ${./mews-0.1.css} $out/spec/mews-0.1.css
cp ${./dtd/mews-0.1.dtd} $out/dtd/mews-0.1.dtd
cp ${./dtd/xhtml-mobile12.dtd} $out/dtd/xhtml-mobile12.dtd
cp -r ${./site} site-src
chmod -R u+w site-src
${siteBuilder}/bin/pelican site-src/content -o pelican-output \
-s site-src/pelicanconf.py
cp pelican-output/index.html pelican-output/check.html $out/
cp pelican-output/mews-0.1.css $out/mews-0.1.css
cp pelican-output/mews-0.1.css $out/spec/mews-0.1.css
cp ${./spec/mews-0.1.dtd} $out/dtd/mews-0.1.dtd
cp ${./spec/xhtml-mobile12.dtd} $out/dtd/xhtml-mobile12.dtd
chmod -R u+w $out
${converter}/bin/python ${./md2mews.py} ${./doc/SPEC.md} \
${converter}/bin/python ${./quickstart/md2mews.py} ${./spec/SPEC.md} \
-o $out/spec/0.1.html --lang en --variant mews-cool \
--description ${lib.escapeShellArg specDescription}