2022-04-27 09:35:20 +00:00
|
|
|
(defpackage org.lispbuilds.nix/main
|
|
|
|
(:use :common-lisp
|
|
|
|
:org.lispbuilds.nix/database/sqlite
|
|
|
|
:org.lispbuilds.nix/repository/quicklisp
|
2023-04-12 12:48:02 +00:00
|
|
|
:org.lispbuilds.nix/api)
|
|
|
|
(:local-nicknames
|
|
|
|
(:http :dexador)))
|
2022-04-27 09:35:20 +00:00
|
|
|
|
|
|
|
(in-package org.lispbuilds.nix/main)
|
|
|
|
|
|
|
|
(defun resource (name type)
|
|
|
|
(make-pathname
|
|
|
|
:defaults (asdf:system-source-directory :org.lispbuilds.nix)
|
|
|
|
:name name
|
|
|
|
:type type))
|
|
|
|
|
|
|
|
(defvar *sqlite*
|
|
|
|
(make-instance
|
|
|
|
'sqlite-database
|
|
|
|
:init-file (resource "init" "sql")
|
|
|
|
:url "packages.sqlite"))
|
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
(defvar *quicklisp* nil)
|
|
|
|
|
|
|
|
(defun get-quicklisp-version ()
|
|
|
|
(let ((response (http:get "http://beta.quicklisp.org/dist/quicklisp.txt")))
|
|
|
|
(subseq
|
|
|
|
(second (uiop:split-string response :separator '(#\Newline)))
|
|
|
|
9)))
|
|
|
|
|
|
|
|
(defun init-quicklisp ()
|
|
|
|
(setf *quicklisp*
|
|
|
|
(make-instance
|
|
|
|
'quicklisp-repository
|
|
|
|
:dist-url
|
|
|
|
(format nil
|
|
|
|
"https://beta.quicklisp.org/dist/quicklisp/~a/"
|
|
|
|
(get-quicklisp-version)))))
|
2022-04-27 09:35:20 +00:00
|
|
|
|
|
|
|
(defun run-importers ()
|
2023-04-12 12:48:02 +00:00
|
|
|
(ignore-errors (delete-file "packages.sqlite"))
|
2022-04-27 09:35:20 +00:00
|
|
|
(import-lisp-packages *quicklisp* *sqlite*)
|
|
|
|
(format t "Imported packages from quicklisp to ~A~%"
|
|
|
|
(truename "packages.sqlite")))
|
|
|
|
|
|
|
|
(defun gen-nix-file ()
|
|
|
|
(database->nix-expression *sqlite* "imported.nix")
|
|
|
|
(format t "Dumped nix file to ~a~%"
|
|
|
|
(truename "imported.nix")))
|
|
|
|
|
|
|
|
(defun main ()
|
|
|
|
(format t "~%")
|
2023-04-12 12:48:02 +00:00
|
|
|
(init-quicklisp)
|
2022-04-27 09:35:20 +00:00
|
|
|
(run-importers)
|
|
|
|
(gen-nix-file))
|