git.fiddlerwoaroof.com
Browse code

Add nix builder

Ed Langley authored on 02/07/2017 05:06:46
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,75 @@
1
+set -eu -o pipefail
2
+
3
+cleanup() {
4
+  if [[ -d /homeless-shelter ]]; then
5
+    rm -rf /homeless-shelter
6
+  fi
7
+}
8
+trap cleanup EXIT
9
+
10
+export PATH
11
+add_path() {
12
+  PATH="$PATH:$1"
13
+}
14
+add_path "$coreutils/bin"
15
+add_path "$findutils/bin"
16
+add_path "$git/bin"
17
+add_path "$sbcl/bin" 
18
+add_path "$curl/bin" 
19
+
20
+mkdir -p "$out"/bin/multicall
21
+
22
+BUILD_DIR="$out/build"
23
+mkdir "$BUILD_DIR"
24
+cd "$BUILD_DIR"
25
+
26
+cp -R "$src" "$BUILD_DIR/src"
27
+chmod -R +rwX "$BUILD_DIR/src"
28
+ls -dl $PWD
29
+mkdir build quicklisp
30
+
31
+cd "$BUILD_DIR/src"
32
+
33
+curl -O https://beta.quicklisp.org/quicklisp.lisp
34
+sbcl \
35
+  --eval "(require :asdf)" \
36
+  --eval "(setf asdf:*user-cache* (truename #p\"$BUILD_DIR/build/\"))" \
37
+  --load quicklisp.lisp \
38
+  --eval "(quicklisp-quickstart:install :path (truename \"$BUILD_DIR/quicklisp/\"))"
39
+
40
+sbcl \
41
+  --eval "(require :asdf)" \
42
+  --eval "(setf asdf:*user-cache* (truename #p\"$BUILD_DIR/build/\"))" \
43
+  --load "$BUILD_DIR/quicklisp/setup.lisp" \
44
+  --eval '(ql:quickload :buildapp)' \
45
+  --eval '(buildapp:build-buildapp)'
46
+
47
+./buildapp \
48
+  --output "$out/bin/multicall/uclip" \
49
+  --eval "(require :asdf)" \
50
+  --eval "(setf asdf:*user-cache* (truename #p\"$BUILD_DIR/build/\"))" \
51
+  --eval "(format t \"~3&ASDF:*user-cache*: ~s~3%\" asdf:*user-cache*)" \
52
+  --load "$BUILD_DIR/quicklisp/setup.lisp" \
53
+  --asdf-tree "$BUILD_DIR/src/" \
54
+  --eval "(ql:quickload :uclip)" \
55
+  --dispatched-entry /uclip::paste \
56
+  --dispatched-entry ucopy/uclip::copy \
57
+  --dispatched-entry upaste/uclip::paste \
58
+  --dispatched-entry uswitch/uclip::switch-clipboards \
59
+  --dispatched-entry upop/uclip::pop-clipboard \
60
+  --dispatched-entry uls/uclip::list-clipboards \
61
+  --dispatched-entry ushow/uclip::show-clipboard-contents \
62
+  --dispatched-entry uclear/uclip::clear-clipboard
63
+
64
+cd "$out/bin"
65
+
66
+xargs  -n1  ln -fsv multicall/uclip <<EOF
67
+ucopy
68
+upaste
69
+uswitch
70
+upop
71
+uls
72
+ushow
73
+uclear
74
+EOF
75
+
0 76
new file mode 100644
... ...
@@ -0,0 +1,10 @@
1
+with (import <nixpkgs> {});
2
+derivation {
3
+  name = "uclip";
4
+  builder = "${bash}/bin/bash";
5
+  args = [ ./builder.sh ];
6
+  inherit sbcl curl coreutils git findutils;
7
+  src = ./.;
8
+  system = builtins.currentSystem;
9
+}
10
+