forked from brendanhay/amazonka
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate
More file actions
executable file
·45 lines (29 loc) · 778 Bytes
/
generate
File metadata and controls
executable file
·45 lines (29 loc) · 778 Bytes
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
#!/usr/bin/env bash
# Usage: generate MODELS
# Run nix-build generate and copy the output to the local working tree.
set -euo pipefail
function join_by() {
local d="${1-}" f="${2-}"
if shift 2; then
printf %s "$f" "${@/#/$d}"
fi
}
cd "$(dirname "${BASH_SOURCE[0]}")/.."
models=""
if [ ! $# -eq 0 ]; then
models="\"$(join_by '" "' "$@")\""
echo "Building $models ..."
else
echo "Building all models ..."
fi
result="$(nix-build generate.nix --no-out-link --arg models "[$models]")"
for input in "$result"/amazonka-*; do
output="$(basename "$input")"
echo "Removing $output/gen"
rm -rf "$output/gen"
echo "Copying $input to $output ..."
cp -r "$input" .
done
echo "Setting user+group permissions ..."
chmod -R ug+w amazonka-*
echo "Done."