Skip to content

Commit e6c46f7

Browse files
fstamourvindarel
authored andcommitted
#2 add a shell.nix and .envrc for easier dev env setup
1 parent 6209cb2 commit e6c46f7

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed

.envrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use nix

shell.nix

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{ pkgs ? import <nixpkgs> {} }:
2+
3+
with pkgs;
4+
let
5+
libraries = [
6+
openssl
7+
sqlite
8+
readline
9+
];
10+
11+
lispWithPackages = pkgs.lispPackages_new.lispWithPackages;
12+
13+
sbcl = (lispWithPackages "${pkgs.sbcl}/bin/sbcl --script"
14+
(p: [
15+
p.asdf
16+
p.alexandria
17+
p.cacle
18+
p.can
19+
p.cl-ansi-text
20+
p.cl-i18n
21+
p.cl-json
22+
p.cl-ppcre
23+
p.cl-slug
24+
p.clss
25+
p.dbd-sqlite3
26+
p.dexador
27+
p.djula
28+
p.easy-routes
29+
p.function-cache
30+
p.hunchentoot
31+
p.local-time
32+
p.local-time-duration
33+
p.log4cl
34+
p.lquery
35+
p.mito
36+
p.mito-auth
37+
p.parse-float
38+
p.parse-number
39+
p.plump
40+
p.replic
41+
p.serapeum
42+
p.str
43+
p.trivial-backtrace
44+
p.unix-opts
45+
46+
p.deploy
47+
p.fiveam
48+
49+
p.swank
50+
p.slynk
51+
]));
52+
53+
deps = stdenv.mkDerivation {
54+
name = "bookshops-deps";
55+
56+
src = ./bookshops.asd;
57+
58+
phases = [ "installPhase" ];
59+
installPhase = ''
60+
echo Dependencies: >> $out
61+
${sbcl}/bin/sbcl \
62+
--noinform \
63+
--non-interactive \
64+
--eval '(require :asdf)' \
65+
--eval '(asdf:load-asd "'$src'")' \
66+
--eval '(format t "~{ - ~a~^~&~}" (asdf:system-depends-on (asdf:find-system "bookshops")))' \
67+
| sort >> $out
68+
'';
69+
};
70+
71+
in mkShell {
72+
buildInputs = with pkgs; [
73+
rlwrap
74+
sbcl
75+
gnumake
76+
gettext
77+
] ++ libraries;
78+
shellHook = ''
79+
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath(libraries)}
80+
# fstamour: I run it on a different port because 4242 is
81+
# already used on my computer
82+
export OBS_PORT=4343
83+
# uncomment to get a list of dependencies without building
84+
# the whole application
85+
# cat ${deps}
86+
'';
87+
}

0 commit comments

Comments
 (0)