forked from ibis-project/ibis-substrait
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
129 lines (113 loc) · 3.13 KB
/
flake.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
122
123
124
125
126
127
128
129
{
description = "Ibis Substrait compiler.";
inputs = {
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
flake-utils.url = "github:numtide/flake-utils";
gitignore = {
url = "github:hercules-ci/gitignore.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
};
outputs = { self, flake-utils, gitignore, nixpkgs, poetry2nix, ... }@inputs: {
overlays.default = nixpkgs.lib.composeManyExtensions [
gitignore.overlay
poetry2nix.overlay
(import ./nix/overlay.nix)
];
} // flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
inherit (pkgs) lib;
genProtos = pkgs.writeShellApplication {
name = "gen-protos";
runtimeInputs = [ pkgs.buf ];
text = ''
${./gen-protos.sh} "${pkgs.substrait}/proto"
'';
};
preCommitDeps = with pkgs; [
actionlint
git
just
nixpkgs-fmt
pre-commit
prettierTOML
shellcheck
shfmt
statix
];
mkDevShell = env:
let
pythonVersion = env.python.version;
shortPythonVersion = lib.concatStrings (lib.take 2 (lib.splitVersion env.python.version));
in
pkgs.mkShell {
name = "ibis-substrait-${pythonVersion}";
nativeBuildInputs = (with pkgs; [
buf
cacert
cachix
genProtos
jq
nixpkgs-fmt
poetry
protobuf3_20
sd
yj
])
++ [ pkgs."ibisSubstraitDevEnv${shortPythonVersion}" ]
++ preCommitDeps;
inherit (self.checks.${system}.pre-commit-check) shellHook;
PROTO_DIR = "${pkgs.substrait}/proto";
PROTO_HASH = "${pkgs.substrait.rev}";
};
in
rec {
packages = {
inherit (pkgs) ibisSubstrait38 ibisSubstrait39 ibisSubstrait310 ibisSubstrait311;
default = pkgs.ibisSubstrait311;
};
checks = import ./nix/checks.nix inputs system;
nixpkgs = pkgs;
devShells = rec {
ibisSubstrait38 = mkDevShell pkgs.ibisSubstraitDevEnv38;
ibisSubstrait39 = mkDevShell pkgs.ibisSubstraitDevEnv39;
ibisSubstrait310 = mkDevShell pkgs.ibisSubstraitDevEnv310;
ibisSubstrait311 = mkDevShell pkgs.ibisSubstraitDevEnv311;
release = pkgs.mkShell {
name = "release";
nativeBuildInputs = with pkgs; [
git
poetry
nodejs
unzip
gnugrep
];
};
default = ibisSubstrait311;
};
}
);
}