From 0b3a788a1322a0573c7be029ba4480a41a1f90f7 Mon Sep 17 00:00:00 2001 From: efim Date: Thu, 28 Jul 2022 15:38:16 +0000 Subject: [PATCH] learning to add quicklisp to flake and non CL dependencies without which nix-store SBCL isn't able to install pakcages --- clog.lisp | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 16 ++++++++++- 2 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 clog.lisp diff --git a/clog.lisp b/clog.lisp new file mode 100644 index 0000000..2e0a29f --- /dev/null +++ b/clog.lisp @@ -0,0 +1,83 @@ +;; here's most up-to-date thing? +;; https://github.com/rabbibotton/clog +;; +;; welp currently can't load clog, libraries are not found +;; tried to add openssl to buildinputs, but not yet working +(defun pkg-config-add-lib (libname) + (let ((process (sb-ext:run-program "/usr/bin/env" + (list "pkg-config" libname "--libs-only-L") + :input t :output :stream :wait t))) + (let ((stream (sb-ext:process-output process))) + (loop for line = (read-line stream nil nil) + while line do + (format t "~&another lib ~S" line) + ;; Drop "-L" part, and add '/' to the end '/' IS necessary! + ;; (pushnew (pathname (concatenate 'string (subseq line 2) "/")) + ;; cffi:*foreign-library-directories*)) + (sb-ext:process-close process))))) + +(pkg-config-add-lib "libcrypto") + +;; nope, I don't understand it, and it doesn't work + +(ql:quickload :clog) + + + +(set-on-new-window (lambda (body) (create-div body :content "hello world."))) +(dotimes (n 10) (create-div *body* :content (format nil "Line ~A - Hello World" n)) (sleep .3)) + +(clog:is-running-p) +(clog:debug-mode) + +(in-package clog-user) + +(clog-install-dir) +;; #P"/home/efim/quicklisp/local-projects/clog/" + +(ql:quickload :clog/tools) ; clog-terminal not found =C +(ql:quickload :clog-terminal/tools) ; well, my guess is that I'm not using latest? since I've what, downloaded to local projects + ; instead of adding a repository? +;; yup, some repos weren't cloned + +(clog-tools:clog-builder) + +(clog:open-manual) + +(ql:quickload :clog/terminal) ; yup after cloning more repos + +(clog-tools:clog-db-admin) + +;; (initialize) +;; well, now it's time to try to go through tutorials, i guess + +(clog:run-tutorial 1) +;; #P"/home/efim/quicklisp/local-projects/clog/" +;; ~/quicklisp/local-projects/clog/tutorial/README.md + +(defun my-setup (body) + (let ((header (create-child body "

lalalla

")) + (colors '(:black :blue :green))) + (setf (color header) :efim) + (set-on-click header + (lambda (obj) + (declare (ignore obj)) + ;; if set value in debugger, this is how to delete it + ;; since it's just created in image + ;; (boundp 'colors) + ;; (makunbound 'colors) + (nth (random (length colors)) colors) + (setf (color header) (nth (random (length colors)) colors))))) + (create-child body "

lalalla

")) ; now, that doesn't work. + +(initialize #'my-setup) +(open-browser) + +;; and for each element, we can call #'set-on-click + +;; next things I'd like to do is random colors, I guess + +;; but how do I look which colors can be used? +;; it would seem that it just takes value of the keyword and puts it into html property +;; but +;; well, it's not that. diff --git a/flake.nix b/flake.nix index 0371d15..119bfb7 100644 --- a/flake.nix +++ b/flake.nix @@ -7,10 +7,24 @@ let pkgs = nixpkgs.legacyPackages.${system}; in { devShells.default = pkgs.mkShell { - buildInputs = [ pkgs.sbcl pkgs.inotify-tools ]; + buildInputs = [ + pkgs.sbcl + + # for koans + pkgs.inotify-tools + + # for CLOG + pkgs.openssl + pkgs.sqlite + ]; + shellHook = '' + export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath([pkgs.openssl])}:${pkgs.lib.makeLibraryPath([pkgs.sqlite])} + ''; }; } ); # see https://serokell.io/blog/practical-nix-flakes + # welp, I would be able to reference store paths here, yup + # but what's the actual way to do that? }