This repository has been archived by the owner on Sep 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
128 lines (101 loc) · 3.61 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
# ============================================================================ #
#
#
#
# ---------------------------------------------------------------------------- #
{
# ---------------------------------------------------------------------------- #
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
inputs.floco.url = "github:aakropotkin/floco";
inputs.sqlite3pp.url = "github:aakropotkin/sqlite3pp";
inputs.sql-builder = {
url = "github:six-ddc/sql-builder";
flake = false;
};
# ---------------------------------------------------------------------------- #
outputs = { nixpkgs, floco, sql-builder, sqlite3pp, ... }: let
# ---------------------------------------------------------------------------- #
eachDefaultSystemMap = let
defaultSystems = [
"x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"
];
in fn: let
proc = system: { name = system; value = fn system; };
in builtins.listToAttrs ( map proc defaultSystems );
# ---------------------------------------------------------------------------- #
overlays.deps = nixpkgs.lib.composeExtensions floco.overlays.default
sqlite3pp.overlays.default;
overlays.flox-resolve = final: prev: {
flox-resolve = final.callPackage ./pkg-fun.nix {};
sql-builder = final.runCommandNoCC "sql-builder" {
src = sql-builder;
} ''
mkdir -p "$out/include/sql-builder";
cp "$src/sql.h" "$out/include/sql-builder/sql.hh";
'';
};
overlays.default = nixpkgs.lib.composeExtensions overlays.deps
overlays.flox-resolve;
# ---------------------------------------------------------------------------- #
packages = eachDefaultSystemMap ( system: let
pkgsFor = ( builtins.getAttr system nixpkgs.legacyPackages ).extend
overlays.default;
in {
inherit (pkgsFor) flox-resolve sql-builder;
default = pkgsFor.flox-resolve;
} );
# ---------------------------------------------------------------------------- #
in {
inherit overlays packages;
devShells = eachDefaultSystemMap ( system: let
pkgsFor = ( builtins.getAttr system nixpkgs.legacyPackages ).extend
overlays.default;
flox-resolve-shell = let
batsWith = pkgsFor.bats.withLibraries ( libs: [
libs.bats-assert
libs.bats-file
libs.bats-support
] );
in pkgsFor.mkShell {
name = "flox-resolve-shell";
inputsFrom = [pkgsFor.flox-resolve];
packages = [
# For tests
batsWith
pkgsFor.jq
# For profiling
pkgsFor.lcov
# For debugging
pkgsFor.valgrind
( if pkgsFor.stdenv.cc.isGNU then pkgsFor.gdb else pkgsFor.lldb )
# For doc
pkgsFor.doxygen
];
inherit (pkgsFor.flox-resolve)
nix_INCDIR
boost_CFLAGS
libExt
SEMVER_PATH
sql_builder_CFLAGS
;
shellHook = ''
shopt -s autocd;
alias gs='git status';
alias ga='git add';
alias gc='git commit -am';
alias gl='git pull';
alias gp='git push';
'';
};
in {
inherit flox-resolve-shell;
default = flox-resolve-shell;
} );
};
# ---------------------------------------------------------------------------- #
}
# ---------------------------------------------------------------------------- #
#
#
#
# ============================================================================ #