-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathshell.nix
53 lines (48 loc) · 1.17 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
47
48
49
50
51
52
53
{ python ? "3.10" }:
let
pkgs = import ./nix;
inherit (pkgs) lib;
devDeps = with pkgs; [
buf
cacert
cachix
git
jq
niv
nix-linter
nixpkgs-fmt
poetry
prettierTOML
protobuf
sd
shellcheck
shfmt
yj
];
pythonShortVersion = builtins.replaceStrings [ "." ] [ "" ] python;
ibisSubstraitDevEnv = pkgs."ibisSubstraitDevEnv${pythonShortVersion}";
genProtos = pkgs.writeShellApplication {
name = "gen-protos";
runtimeInputs = with pkgs; [ buf ];
text = ''
proto_dir=./proto
mkdir -p "$proto_dir"
chmod u+rwx "$proto_dir"
rm -r "$proto_dir"
cp -fr ${pkgs.substrait}/proto "$proto_dir"
find "$proto_dir" -type d -exec chmod u+rwx {} +
find "$proto_dir" -type f -exec chmod u+rw {} +
rm -rf ./ibis_substrait/proto
buf generate
protol --in-place --create-package --python-out "./ibis_substrait/proto" buf
'';
};
in
pkgs.mkShell {
name = "ibis-substrait-${pythonShortVersion}";
shellHook = ''
${(import ./pre-commit.nix).pre-commit-check.shellHook}
'';
buildInputs = devDeps ++ [ ibisSubstraitDevEnv genProtos ];
PYTHONPATH = builtins.toPath ./.;
}