summaryrefslogtreecommitdiff
path: root/.envrc
blob: 7e9583edbc828ed074f0703b179ccacb366e1a2a (plain)
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
63
64
65
66
67
68
69
70
71
# setup dev environment using direnv
#
  if ! has nix_direnv_version || ! nix_direnv_version 3.0.4; then
    source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.4/direnvrc" "sha256-DzlYZ33mWF/Gs8DDeyjr8mnVmQGx7ASYqA5WlxwvBG4="
  fi
#
# watch some files that effect the dev environment
# watch_file shell.nix
# watch_file default.nix
# watch_file Biz/Bild.nix
# watch_file Biz/Bild.hs
# if direnv doesn't detect changes to the nix environment, just touch .envrc and
# it will refresh
  use nix
#
  export CODEROOT=$PWD
  export COLUMNS
#
# scripts for editing go here
  PATH_add $CODEROOT/Biz/Ide
#
# executable bild outputs go here
  PATH_add $CODEROOT/_/bin
#
# library/linkable bild outputs go here
  export LTDL_LIBRARY_PATH=$CODEROOT/_/lib
#
# intermediate compilation artifacts go here
  export PYTHONPYCACHEPREFIX=$CODEROOT/_/int
#
# Biz/Dragons.hs:
  export GITHUB_CLIENT_ID=aa575dc96263bc99556d
  export GITHUB_CLIENT_STATE=$(cat /proc/sys/kernel/random/uuid)
  export STRIPE_PUBKEY=pk_test_51I3jv1IC3f10BNLClrBmNr485mWSzQkITvjO0MmSeFn4chFqmODJaHcI7IiN1sqSJYusmRhuPzeGTbCrl8dMsSQP00JXUmlVFC
#
# run lorri if its available
  if type lorri &>/dev/null
  then
      eval "$(lorri direnv)"
  fi
#
# configure git
  git config --local core.hooksPath "$CODEROOT/Biz/Ide/hooks"
  git config --local notes.displayRef refs/notes/ci
  git config --local remotes.origin.fetch +refs/notes/*:refs/notes/* notes
  git config --local branchless.test.strategy worktree
  git config --local branchless.test.alias.default 'export CI=1; git clean -ffdx; eval $(direnv export bash); bild --test **/*'
  git config --local branchless.test.alias.bild 'export CI=1; git clean -ffdx; eval $(direnv export bash); bild **/*'
  git config --local branchless.test.alias.lint 'export CI=1; git clean -ffdx; eval $(direnv export bash); bild Biz/Lint.hs; lint **/*'
  git config --local branchless.test.alias.lintfix 'export CI=1; git clean -ffdx; eval $(direnv export bash); bild Biz/Lint.hs; lint --fix **/*'
  git config --local branchless.test.alias.ci 'export CI=1; git clean -ffdx; eval $(direnv export bash); Biz/Ci.sh'
#
# end here if we are in CI
  [[ -n "CI" ]] && exit 0
#
# create third-party tags
  [[ -L "$CODEROOT"/_/src/.ctags.d ]] || ln -s "$CODEROOT"/.ctags.d "$CODEROOT"/_/src/.ctags.d
  function MakeExternalTags {
    "$CODEROOT"/Biz/Ide/MakeTags.py --external $(tr ':' '\n' <<< "$ALL_SOURCES")
  }
  hashfile="$CODEROOT"/_/src/hash
  curhash=$(cat "$hashfile")
  newhash=$(sha256sum <<< "$ALL_SOURCES")
  [[ ! -e "$hashfile" ]] && MakeExternalTags
  [[ -e "$hashfile" ]] && [[ "$curhash" != "$newhash" ]] && MakeExternalTags
  echo "$newhash" > "$hashfile"
#
# load local settings
  [[ -f ./.envrc.local ]] && . ./.envrc.local || :
##
  tips.sh