-
Notifications
You must be signed in to change notification settings - Fork 19
/
flake.nix
112 lines (97 loc) · 2.66 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
{
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.overlays.default
(import ./nix/overlay.nix)
];
} // flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
inherit (pkgs) lib;
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; [
cacert
cachix
nixpkgs-fmt
poetry
])
++ [ pkgs."ibisSubstraitDevEnv${shortPythonVersion}" ]
++ preCommitDeps;
inherit (self.checks.${system}.pre-commit-check) shellHook;
};
in
rec {
packages = {
inherit (pkgs) ibisSubstrait39 ibisSubstrait310 ibisSubstrait311;
default = pkgs.ibisSubstrait311;
};
checks = import ./nix/checks.nix inputs system;
nixpkgs = pkgs;
devShells = rec {
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;
};
}
);
}