-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathshell.nix
More file actions
73 lines (61 loc) · 1.59 KB
/
Copy pathshell.nix
File metadata and controls
73 lines (61 loc) · 1.59 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
with import (builtins.fetchTarball {
name = "2025-06-16";
url = "https://github.com/NixOS/nixpkgs/archive/e6f23dc08d3624daab7094b701aa3954923c6bbb.tar.gz";
sha256 = "sha256:0m0xmk8sjb5gv2pq7s8w7qxf7qggqsd3rxzv3xrqkhfimy2x7bnx";
}) {};
mkShellNoCC {
buildInputs =
let
xpg = import (fetchFromGitHub { owner = "steve-chavez";
repo = "xpg";
rev = "v2.4.0";
sha256 = "sha256-moRjdGvymGEyREU4++qpNzDuUN+nVC69CUYjhuY4Yzs=";
});
style =
writeShellScriptBin "pg_csv-style" ''
${clang-tools}/bin/clang-format -i src/*
'';
styleCheck =
writeShellScriptBin "pg_csv-style-check" ''
${clang-tools}/bin/clang-format -i src/*
${git}/bin/git diff-index --exit-code HEAD -- '*.c'
'';
bench =
writeShellScriptBin "pg_csv-bench" ''
set -euo pipefail
pg_ver=$1
make bench > /dev/null
for file in ./bench/*.sql; do
if [ "$file" = ./bench/init.sql ]; then
continue
fi
duration=30
if [ "$file" = ./bench/native_copy.sql ] ||
[ "$file" = ./bench/csv_read.sql ]; then
duration=120
fi
cat <<EOF
## "$file"
pgbench running for:
\`\`\`sql
$(< "$file")
\`\`\`
results:
\`\`\`
$(${xpg.xpg}/bin/xpg -v "$pg_ver" pgbench -n -c 1 -T "$duration" -M simple -f "$file")
\`\`\`
EOF
done
'';
in [
p7zip
xpg.xpg
style
styleCheck
bench
gcc15
];
shellHook = ''
export HISTFILE=.history
'';
}