generated from duckdb/extension-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
81 lines (76 loc) · 2.21 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
{
description = "Nix flake for the record duckdb extension";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
zig-overlay = {
url = "github:mitchellh/zig-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
flake-utils,
zig-overlay,
nixpkgs,
...
}: let
systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
outputs = flake-utils.lib.eachSystem systems (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [
zig-overlay.overlays.default
];
};
in rec {
# packages exported by the flake
packages = {
zig-build-fast = pkgs.writeScriptBin "zig_build_fast" ''
${pkgs.zigpkgs.master}/bin/zig build \
-Doptimize=ReleaseFast \
-Dopenssl-include-dir=${pkgs.openssl.dev}/include \
-Dbuild-shell
'';
zig-build-small = pkgs.writeScriptBin "zig_build_small" ''
${pkgs.zigpkgs.master}/bin/zig build \
-Doptimize=ReleaseSmall \
-Dopenssl-include-dir=${pkgs.openssl.dev}/include \
-Dbuild-shell
'';
zig-build-debug = pkgs.writeScriptBin "zig_build_debug" ''
${pkgs.zigpkgs.master}/bin/zig build \
-Doptimize=Debug \
-Dopenssl-include-dir=${pkgs.openssl.dev}/include \
-Dbuild-shell
'';
};
# nix run
apps = {
build-fast = {
type = "app";
program = "${self.packages.${system}.zig-build-fast}/bin/zig_build_fast";
};
build-small = {
type = "app";
program = "${self.packages.${system}.zig-build-small}/bin/zig_build_small";
};
build-debug = {
type = "app";
program = "${self.packages.${system}.zig-build-debug}/bin/zig_build_debug";
};
default = apps.build-fast;
};
# nix fmt
formatter = pkgs.alejandra;
# nix develop -c $SHELL
devShells.default = pkgs.mkShell {
packages = [
pkgs.openssl
pkgs.zigpkgs.master
];
};
});
in
outputs;
}