nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv, ffmpeg-full, tone, pname, nodejs }: ''
2 #!${stdenv.shell}
3
4 port=8000
5 host=0.0.0.0
6 config=$(pwd)/config
7 metadata=$(pwd)/metadata
8
9 LONGOPTS=host:,port:,config:,metadata:,help
10 args=$(getopt -l "$LONGOPTS" -o h -- "$@")
11
12 eval set -- "$args"
13
14 while [ $# -ge 1 ]; do
15 case "$1" in
16 --)
17 # No more options left.
18 shift
19 break
20 ;;
21 --host)
22 host="$2"
23 shift
24 ;;
25 --port)
26 port="$2"
27 shift
28 ;;
29 --config)
30 if [[ "''${2:0:1}" = "/" ]]; then
31 config="$2"
32 else
33 config="$(pwd)/$2"
34 fi
35 shift
36 ;;
37 --metadata)
38 if [[ "''${2:0:1}" = "/" ]]; then
39 metadata="$2"
40 else
41 metadata="$(pwd)/$2"
42 fi
43 shift
44 ;;
45 --help|-h)
46 echo "Usage: audiobookshelf [--host <host>] [--port <port>] [--metadata <dir>] [--config <dir>]"
47 shift
48 ;;
49 esac
50 shift
51 done
52
53 NODE_ENV=production \
54 SOURCE=nixpkgs \
55 FFMPEG_PATH=${ffmpeg-full}/bin/ffmpeg \
56 FFPROBE_PATH=${ffmpeg-full}/bin/ffprobe \
57 TONE_PATH=${tone}/bin/tone \
58 CONFIG_PATH="$config" \
59 METADATA_PATH="$metadata" \
60 PORT="$port" \
61 HOST="$host" \''