-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinit-haskell
More file actions
executable file
·62 lines (50 loc) · 1.66 KB
/
init-haskell
File metadata and controls
executable file
·62 lines (50 loc) · 1.66 KB
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
54
55
56
57
58
59
60
61
62
#! /usr/bin/env nix-shell
#! nix-shell --pure --keep NIX_SSL_CERT_FILE --keep GITHUB_TOKEN -i bash -p git mustache-go niv direnv nix
set -Eeuxo pipefail
# init-haskell location
base=$(dirname "$(readlink -f "$0")")
# Variables
data=$(mktemp)
projectname=${PWD##*/}
cat <<EOF >$data
{ "author": "$(git config user.name)"
, "email": "$(git config user.email)"
, "ghc":
{ major: 8
, minor: 10
, patch: 7
}
, "snapshot": "2022-03-01T00:00:00Z"
, "projectname": "${projectname}"
}
EOF
# Set up git
git init
mustache $base/templates/.gitignore >.gitignore <$data
# Set up niv
mkdir nix || exit 0
mustache $base/templates/sources.json >./nix/sources.json <$data
niv init
# Create hpack project
mustache $base/templates/cabal.project >./cabal.project <$data
mustache $base/templates/package.yaml >./package.yaml <$data
# Add nix files
mustache $base/templates/snapshot.nix >./snapshot.nix <$data
mustache $base/templates/compiler.nix >./compiler.nix <$data
mustache $base/templates/default.nix >./default.nix <$data
mustache $base/templates/shell.nix >./shell.nix <$data
# Add hie.yaml file to help language server figure out what's what
mustache $base/templates/hie.yaml >./hie.yaml <$data
# Add some vim config to help editor pick up the language server
mkdir .vim
mustache $base/templates/.vim/coc-settings.json >./.vim/coc-settings.json <$data
# Create direnv file
mustache $base/templates/.envrc >./.envrc <$data
# Add note about caching
mustache $base/templates/CACHES.md >./CACHES.md <$data
# Add a hello world source file
mkdir lib || exit 0
mustache $base/templates/Lib.hs >./lib/Lib.hs <$data
mkdir app || exit 0
mustache $base/templates/Main.hs >./app/Main.hs <$data
git add .