Last active
October 24, 2022 08:40
-
-
Save lukego/46528e16c359a4e680baa30b013916b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defpackage :nixpkgs-lisp-survey | |
(:nicknames :survey) | |
(:use :common-lisp :alexandria :serapeum)) | |
(in-package :nixpkgs-lisp-survey) | |
;;;; Conditions | |
(define-condition build-error (error) | |
((transcript :initarg :transcript :accessor transcript))) | |
(define-condition library-load-error (build-error) | |
((alternatives :initarg :alternatives :accessor alternatives))) | |
(define-condition dependency-error (build-error) | |
((dependency :initarg :dependency :accessor dependency))) | |
(define-condition unrecognized-error (build-error) | |
()) | |
;;;; Testing | |
(defun test-package (name lisp) | |
(check-transcript (run-nix-build name lisp))) | |
(defun check-transcript (transcript) | |
(when-let (m (missing-libraries transcript)) | |
(cerror "Ignore" 'library-load-error :alternatives m))) | |
(defun missing-libraries (transcript) | |
(collecting | |
(cl-ppcre:do-matches-as-strings (m "Unable to load any of the alternatives:\\s+\\([^(]+\\)" transcript) | |
(cl-ppcre:do-matches-as-strings (s "\"[^\"]+\"" m) | |
(collect (remove #\" s)))))) | |
(defun run-nix-build (name lisp) | |
(uiop:run-program | |
(format nil "nix-build -E 'with import ../../../../default.nix {}; lispPackages_new.~aPackages.~a'" | |
lisp name) :ignore-error-status t :output :string :error-output :output)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ nixpkgs ? <nixpkgs> }: | |
with import nixpkgs {}; | |
lispPackages_new.sbclWithPackages (p: with p; [ alexandria serapeum cl-ppcre]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment