cl-gemini working again

This commit is contained in:
root@procul
2021-04-19 00:25:06 -05:00
parent f25ada0c71
commit 18bddb7e45
9 changed files with 143 additions and 12 deletions
+9 -9
View File
@@ -6,7 +6,7 @@ let
lisp-helper = import ../lisp.nix { inherit pkgs; };
feedOpts = with types; {
feedOpts = { ... }: with types; {
options = {
url = mkOption {
type = str;
@@ -28,13 +28,6 @@ let
};
};
register-feed = name: opts: ''
(cl-gemini:register-feed :name "${name}" :title "${opts.title}" :path "${opts.path}" :base-uri "${opts.url}")'';
register-feeds = feeds:
concatStringsSep "\n"
(mapAttrsToList register-feed feeds);
ensure-certificates = hostname: user: key: cert: pkgs.writeShellScript "ensure-gemini-certificates.sh" ''
if [[ ! -e ${key} ]]; then
TARGET_CERT_DIR=$(${pkgs.coreutils}/bin/dirname ${cert})
@@ -49,6 +42,12 @@ let
fi
'';
generate-feeds = feeds:
let
feed-strings = mapAttrsToList (feed-name: opts:
"(cl-gemini:register-feed :name \"${feed-name}\" :title \"${opts.title}\" :path \"${opts.path}\" :base-uri \"${opts.url}\")") feeds;
in pkgs.writeText "gemini-local-feeds.lisp" (concatStringsSep "\n" feed-strings);
in {
options.informis.cl-gemini = with types; {
enable = mkEnableOption "Enable the cl-gemini server.";
@@ -162,8 +161,9 @@ in {
GEMINI_LISTEN_PORT = toString cfg.port;
GEMINI_DOCUMENT_ROOT = cfg.document-root;
GEMINI_TEXTFILES_ROOT = cfg.textfiles-archive;
GEMINI_FEEDS = "${generate-feeds cfg.feeds}";
CL_SOURCE_REGISTRY = lisp-helper.lisp-source-registry pkgs.cl-gemini;
CL_SOURCE_REGISTRY = "${lisp-helper.lisp-source-registry pkgs.cl-gemini}";
};
path = with pkgs; [