Repository navigation
Expand file tree
/
Copy pathshell.nix
More file actions
80 lines (76 loc) · 2.41 KB
/
Copy pathshell.nix
File metadata and controls
80 lines (76 loc) · 2.41 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{ self,
mkShell,
callPackage,
git,
janet,
jpm,
nix-zsh-completions,
nix-tree,
nix-diff,
nvd,
nix-output-monitor,
nix-inspect,
... }:
let janetTree = (callPackage ./packages/_janet.nix {}).janetTree;
in mkShell {
buildInputs = [
git
janet
jpm
self.judge
nix-zsh-completions
nix-tree
nix-diff
nvd
nix-output-monitor
nix-inspect
];
# Gotchas:
# - jpm ignores JANET_{MOD,BIN,MAN}PATH once JANET_TREE is set.
# - JANET_PATH last entry has highest precedence (then the rest are searched
# in order).
# - jpm install builds a local build (in ./build) and won't affect the global
# install.
# - `jpm {build,install}` is incremental. It won't build anything that hasn't
# changed. Use `jpm clean` to force it.
shellHook = ''
root=$(git rev-parse --show-toplevel)
export NIX_CONFIG=$(printf '%s\nwarn-dirty = false' "''${NIX_CONFIG-}")
export DOTFILES_HOME="$root"
export JANET_TREE="$root/build/jpm_tree"
export JANET_BUILDPATH="$root/build"
mkdir -p "$JANET_TREE" # jpm's own mkdir of it isn't -p
export JANET_BINPATH="$JANET_TREE/bin"
export JANET_PATH="$root/lib:${janetTree}/lib:$JANET_TREE/lib"
export PATH="$JANET_BINPATH:$root/bin:$PATH"
host=''${HOST:-$(cat /etc/hostname)}
if [[ $- == *i* ]]; then
alias nrepl='nix repl'
alias neval='nix eval'
alias nbuild='nix build'
alias install='jpm install'
alias clean='jpm clean'
rebuild() { jpm clean; jpm install; }
cat <<EOF
Some ways to explore this flake:
nrepl . then nixosConfigurations.$host.{config,options,pkgs}
neval .#nixosConfigurations.$host.config.OPTION
nbuild .#nixosConfigurations.$host.config.system.build.toplevel
nvd diff /run/current-system result what that build would change
nix build .#hey any package or check
nix-inspect -p . browse all of it as a tree
nix-tree /run/current-system who pulls in what and how big
nix flake show everything the flake exports
For bin/hey:
install same as jpm install
clean same as jpm clean
rebuild same as jpm clean+install
EOF
if [[ -x build/hey ]]; then
echo
hey version
fi
fi
unset JANET_HEADERPATH JANET_LIBPATH root host
'';
}