diff --git a/lib/informis/cl-gemini.nix b/lib/informis/cl-gemini.nix index 75513bd..8b903dc 100644 --- a/lib/informis/cl-gemini.nix +++ b/lib/informis/cl-gemini.nix @@ -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; [ diff --git a/packages/cl-gemini.nix b/packages/cl-gemini.nix index 4373f5d..560397a 100644 --- a/packages/cl-gemini.nix +++ b/packages/cl-gemini.nix @@ -15,11 +15,14 @@ let value))) (require :asdf) + (asdf:load-system :slynk) (asdf:load-system :cl-gemini) - (let ((slynk-port (uiop:getenv "GEMINI_SLYNK_PORT"))) + (let ((slynk-port (uiop:getenvp "GEMINI_SLYNK_PORT"))) (when slynk-port - (asdf:load-system :slynk) (slynk:create-server :port (parse-integer slynk-port) :dont-close t))) + (let ((feed-file (uiop:getenvp "GEMINI_FEEDS"))) + (when feed-file + (load feed-file))) (cl-gemini:start-gemini-server (getenv-or-fail "GEMINI_LISTEN_IP") (getenv-or-fail "GEMINI_PRIVATE_KEY") diff --git a/packages/lisp/agnostic-lizard.nix b/packages/lisp/agnostic-lizard.nix new file mode 100644 index 0000000..490f6ef --- /dev/null +++ b/packages/lisp/agnostic-lizard.nix @@ -0,0 +1,20 @@ +{ pkgs, localLispPackages, ... }: + +pkgs.lispPackages.buildLispPackage { + baseName = "agnostic-lizard"; + packageName = "agnostic-lizard"; + description = "Agnostic Lizard is a portable implementation of a code walker and in particular of the macroexpand-all function (and macro) that makes a best effort to be correct while not expecting much beyond what the Common Lisp standard requires."; + + buildSystems = [ "agnostic-lizard" ]; + + deps = with localLispPackages; []; + + src = pkgs.fetchgit { + url = "https://gitlab.common-lisp.net/mraskin/agnostic-lizard.git"; + rev = "fe3a73719f05901c8819f8995a3ebae738257952"; + sha256 = "0ax78y8w4zlp5dcwyhz2nq7j3shi49qn31dkfg8lv2jlg7mkwh2d"; + fetchSubmodules = false; + }; + + asdFilesToKeep = [ "agnostic-lizard.asd" ]; +} diff --git a/packages/lisp/cl-gemini.nix b/packages/lisp/cl-gemini.nix index a282ec5..33a8725 100644 --- a/packages/lisp/cl-gemini.nix +++ b/packages/lisp/cl-gemini.nix @@ -33,7 +33,11 @@ in pkgs.lispPackages.buildLispPackage { osicat quicklisp quri - uiop + slynk + # slynk-asdf + slynk-macrostep + slynk-stepper + uiop usocket-server xml-emitter ]; diff --git a/packages/lisp/default.nix b/packages/lisp/default.nix index 999ec60..0c71093 100644 --- a/packages/lisp/default.nix +++ b/packages/lisp/default.nix @@ -1,6 +1,7 @@ { pkgs, localLispPackages, ... }: rec { + agnostic-lizard = import ./agnostic-lizard.nix { inherit pkgs localLispPackages; }; arrows = import ./arrows.nix { inherit pkgs localLispPackages; }; cl-gemini = import ./cl-gemini.nix { inherit pkgs localLispPackages; }; cl-sasl = import ./cl-sasl.nix { inherit pkgs localLispPackages; }; @@ -12,6 +13,10 @@ rec { inferior-shell = import ./inferior-shell.nix { inherit pkgs localLispPackages; }; ip-utils = import ./ip-utils.nix { inherit pkgs localLispPackages; }; osicat = import ./osicat.nix { inherit pkgs localLispPackages; }; + slynk = import ./slynk.nix { inherit pkgs localLispPackages; }; + slynk-asdf = import ./slynk-asdf.nix { inherit pkgs localLispPackages; }; + slynk-macrostep = import ./slynk-macrostep.nix { inherit pkgs localLispPackages; }; + slynk-stepper = import ./slynk-stepper.nix { inherit pkgs localLispPackages; }; usocket-server = import ./usocket-server.nix { inherit pkgs localLispPackages; }; xml-emitter = import ./xml-emitter.nix { inherit pkgs localLispPackages; }; } diff --git a/packages/lisp/slynk-asdf.nix b/packages/lisp/slynk-asdf.nix new file mode 100644 index 0000000..379296a --- /dev/null +++ b/packages/lisp/slynk-asdf.nix @@ -0,0 +1,22 @@ +{ pkgs, localLispPackages, ... }: + +pkgs.lispPackages.buildLispPackage { + baseName = "slynk-asdf"; + packageName = "slynk-asdf"; + description = "SLY-ASDF is a contrib for SLY that adds support for editing ASDF systems, exposing several utilities for working with and loading systems."; + + buildSystems = [ "slynk-asdf" ]; + + deps = with localLispPackages; [ + slynk + ]; + + src = pkgs.fetchgit { + url = "https://github.com/mmgeorge/sly-asdf.git"; + rev = "95ca71ddeb6132c413e1e4352b136f41ed9254f1"; + sha256 = "1dvjwdan3qd3x716zgziy5vbq2972rz8pdqi7b40haqg01f33qf4"; + fetchSubmodules = false; + }; + + asdFilesToKeep = [ "slynk-asdf.asd" ]; +} diff --git a/packages/lisp/slynk-macrostep.nix b/packages/lisp/slynk-macrostep.nix new file mode 100644 index 0000000..107ffe4 --- /dev/null +++ b/packages/lisp/slynk-macrostep.nix @@ -0,0 +1,22 @@ +{ pkgs, localLispPackages, ... }: + +pkgs.lispPackages.buildLispPackage { + baseName = "slynk-macrostep"; + packageName = "slynk-macrostep"; + description = "sly-macrostep is a SLY contrib for expanding CL macros right inside the source file."; + + buildSystems = [ "slynk-macrostep" ]; + + deps = with localLispPackages; [ + slynk + ]; + + src = pkgs.fetchgit { + url = "https://github.com/joaotavora/sly-macrostep.git"; + rev = "5113e4e926cd752b1d0bcc1508b3ebad5def5fad"; + sha256 = "1nxf28gn4f3n0wnv7nb5sgl36fz175y470zs9hig4kq8cp0yal0r"; + fetchSubmodules = false; + }; + + asdFilesToKeep = [ "slynk-macrostep.asd" ]; +} diff --git a/packages/lisp/slynk-stepper.nix b/packages/lisp/slynk-stepper.nix new file mode 100644 index 0000000..e134885 --- /dev/null +++ b/packages/lisp/slynk-stepper.nix @@ -0,0 +1,23 @@ +{ pkgs, localLispPackages, ... }: + +pkgs.lispPackages.buildLispPackage { + baseName = "slynk-stepper"; + packageName = "slynk-stepper"; + description = "A portable Common Lisp stepper interface."; + + buildSystems = [ "slynk-stepper" ]; + + deps = with localLispPackages; [ + agnostic-lizard + slynk + ]; + + src = pkgs.fetchgit { + url = "https://github.com/joaotavora/sly-stepper.git"; + rev = "ec3c0a7f3c8b82926882e5fcfdacf67b86d989f8"; + sha256 = "1hxniaxifdw3m4y4yssgy22xcmmf558wx7rpz66wy5hwybjslf7b"; + fetchSubmodules = false; + }; + + asdFilesToKeep = [ "slynk-stepper.asd" ]; +} diff --git a/packages/lisp/slynk.nix b/packages/lisp/slynk.nix new file mode 100644 index 0000000..ab8e91f --- /dev/null +++ b/packages/lisp/slynk.nix @@ -0,0 +1,32 @@ +{ pkgs, localLispPackages, ... }: + +pkgs.lispPackages.buildLispPackage { + baseName = "slynk"; + packageName = "slynk"; + description = "SLY is Sylvester the Cat's Common Lisp IDE for Emacs."; + + buildSystems = [ + "slynk" + "slynk/arglists" + "slynk/fancy-inspector" + "slynk/package-fu" + "slynk/mrepl" + "slynk/trace-dialog" + "slynk/profiler" + "slynk/stickers" + "slynk/stickers" + "slynk/indentation" + "slynk/retro" + ]; + + deps = with localLispPackages; []; + + src = pkgs.fetchgit { + url = "https://github.com/joaotavora/sly.git"; + rev = "1.0.43"; + sha256 = "11yclc8i6gpy26m1yj6bid6da22639zpil1qzj87m5gfvxiv4zg6"; + fetchSubmodules = false; + }; + + asdFilesToKeep = [ "slynk/slynk.asd" ]; +}