/
devenv.nix
121 lines (115 loc) · 2.66 KB
/
devenv.nix
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
{ pkgs, ... }:
{
packages = [
pkgs.cargo-insta
pkgs.cargo-nextest
pkgs.cargo-udeps
pkgs.deno
pkgs.dprint
pkgs.mdbook
pkgs.rustup
pkgs.yamlfmt
];
# Scripts
scripts."generate:all".exec = ''
set -e
generate:plugin:rust
'';
scripts."generate:plugin:rust".exec = ''
set -e
cargo run --example generate --package skribble_rust -- crates/skribble_rust/tests
'';
scripts."build:all".exec = ''
set -e
build:cargo
build:book
'';
scripts."build:cargo".exec = ''
set -e
cargo build
'';
scripts."build:book".exec = ''
set -e
mdbook build docs
'';
scripts."fix:all".exec = ''
set -e
generate:all
fix:clippy
fix:format
'';
scripts."fix:format".exec = ''
set -e
dprint fmt
'';
scripts."fix:clippy".exec = ''
set -e
cargo clippy --fix --allow-dirty --allow-staged
'';
scripts."lint:all".exec = ''
set -e
lint:format
lint:clippy
'';
scripts."lint:format".exec = ''
set -e
dprint check
'';
scripts."lint:clippy".exec = ''
set -e
cargo clippy
'';
scripts."snapshot:review".exec = ''
cargo insta review
'';
scripts."snapshot:update".exec = ''
cargo nextest run
cargo insta accept
'';
scripts."test:all".exec = ''
set -e
test:cargo
test:docs
'';
scripts."test:cargo".exec = ''
set -e
cargo nextest run
'';
scripts."test:docs".exec = ''
set -e
cargo test --doc
'';
# This doesn't seem to work so I've used `doc-comment` instead
scripts."test:book".exec = ''
set -e
mdbook test docs --library-path target/debug/deps
'';
scripts."setup:helix".exec = ''
set -e
rm -rf .helix
cp -r setup/editors/helix .helix
'';
scripts."setup:vscode".exec = ''
set -e
rm -rf .vscode
cp -r ./setup/editors/vscode .vscode
'';
scripts."setup:ci".exec = ''
set -e
# update GitHub CI Path
echo "$DEVENV_PROFILE/bin" >> $GITHUB_PATH
echo "DEVENV_PROFILE=$DEVENV_PROFILE" >> $GITHUB_ENV
# prepend common compilation lookup paths
echo PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV
echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo LIBRARY_PATH=$LIBRARY_PATH" >> $GITHUB_ENV
echo C_INCLUDE_PATH=$C_INCLUDE_PATH" >> $GITHUB_ENV
# these provide shell completions / default config options
echo XDG_DATA_DIRS=$XDG_DATA_DIRS" >> $GITHUB_ENV
echo XDG_CONFIG_DIRS=$XDG_CONFIG_DIRS" >> $GITHUB_ENV
echo DEVENV_DOTFILE=$DEVENV_DOTFILE" >> $GITHUB_ENV
echo DEVENV_PROFILE=$DEVENV_PROFILE" >> $GITHUB_ENV
echo DEVENV_ROOT=$DEVENV_ROOT" >> $GITHUB_ENV
echo DEVENV_STATE=$DEVENV_STATE" >> $GITHUB_ENV
'';
}