-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsbclrc
53 lines (43 loc) · 1.94 KB
/
sbclrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
;-*- mode: lisp -*- file: .sbclrc
(defun in-home-dir (subdir)
(merge-pathnames subdir (user-homedir-pathname)))
;; Lets make sure we didn't get some wonky temporary HOME
(princ #\newline)
(princ (concatenate 'string "Home: " (namestring (user-homedir-pathname))))
#-quicklisp
(let ((quicklisp-init (in-home-dir "quicklisp/setup.lisp")))
(when (probe-file quicklisp-init)
(load quicklisp-init)))
#-asdf (require :asdf)
(ql:quickload :linedit :silent t)
(ql:quickload :cffi :silent t)
(ql:quickload :cl-ppcre :silent t)
;; Pretty this up with `let` and what not...
(defparameter *home-libs* (in-home-dir ".nix-profile/lib/"))
(defparameter *nix-cl-settings-dir*
(in-home-dir ".nix-profile/lib/common-lisp-settings"))
(defparameter *nix-cl-settings-scripts*
(directory (concatenate 'string (namestring *nix-cl-settings-dir*)
"/*-path-config.sh")))
(defun source-file (f)
(concatenate 'string "source " (namestring f) "; "))
(defparameter *nix-cl-libs*
(cl-ppcre:split ":" (uiop:run-program
(format nil "~{~A~}"
(nconc
(mapcar #'source-file *nix-cl-settings-scripts*)
'("echo \"${NIX_LISP_LD_LIBRARY_PATH}\";")))
:output
'(:string :stripped t))))
(pushnew *home-libs* cffi:*foreign-library-directories*)
(loop for l in *nix-cl-libs* do (pushnew (car(directory l))
cffi:*foreign-library-directories*))
;;; Check for `--no-linedit` command-line option.
;; For any of this to work you need to have installed `linedit`
;; To do so run `(ql:quickload "linedit")`
(if (member "--no-linedit" sb-ext:*posix-argv* :test 'equal)
(setf sb-ext:*posix-argv*
(remove "--no-linedit" sb-ext:*posix-argv* :test 'equal))
(when (interactive-stream-p *terminal-io*)
(require :sb-aclrepl)
(linedit:install-repl :wrap-current t)))