-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell.nix
46 lines (41 loc) · 1.33 KB
/
shell.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
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
pre-commit = writeShellScriptBin "pre-commit" ''
# get the staged files
s_files=$(${git}/bin/git diff --name-only --cached)
# if a staged file contains the keyword, get it out of the staged list
for s_file in ''${s_files};do
if grep -q -E '@nocheckin' ''${s_file};then
echo "WARNING: ''${s_file} contains the keyword"
${git}/bin/git reset ''${s_file}
fi
done
# if there is not any staged file left, fail the commit, otherwise
# an empty commit would be created.
s_files=$(${git}/bin/git diff --name-only --cached)
if [[ "''${s_files}" = "" ]];then
echo "WARNING: nothing to commit"
exit 1
fi
exit 0
'';
monitor = writeShellScriptBin "monitor" ''
dot -Tpng ./monitor.dot > ./monitor.png
nohup feh --auto-reload --quiet monitor.png &
nohup inotifywait -e close_write,moved_to,create -m . |
while read -r directory events filename; do
if [ "$filename" = "monitor.dot" ]; then
dot -Tpng ./monitor.dot > ./monitor.png
fi
done &
'';
in
mkShell {
name = "copernica";
src = null;
buildInputs = [ rustup gdb pkgconfig pre-commit ripgrep mc docker docker-machine qemu_full gitui ruby ];
shellHook = ''
export PATH=~/.cargo/bin:$PATH
'';
}