This repository has been archived by the owner on Dec 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pkg-fun.nix
74 lines (69 loc) · 2.26 KB
/
pkg-fun.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
# ============================================================================ #
#
#
#
# ---------------------------------------------------------------------------- #
{ stdenv
, sqlite
, pkg-config
, nlohmann_json
, nix
, boost
, argparse
, semver
, sqlite3pp
, toml11
, yaml-cpp
}: stdenv.mkDerivation {
pname = "flox-pkgdb";
version = builtins.replaceStrings ["\n"] [""] ( builtins.readFile ./version );
src = builtins.path {
path = ./.;
filter = name: type: let
bname = baseNameOf name;
ignores = [
"default.nix" "pkg-fun.nix" "flake.nix" "flake.lock" ".ccls"
".ccls-cache" "compile_commands.json" ".git" ".gitignore" "out" "bin"
"pkgs" "bear.d" ".direnv" ".clang-tidy" ".clang-format" ".envrc"
".github" "LICENSE"
"tests" # Tests require internet so there's no point in including them
];
ext = let
m = builtins.match ".*\\.([^.]+)" name;
in if m == null then "" else builtins.head m;
ignoredExts = ["o" "so" "dylib" "log"];
notResult = ( builtins.match "result(-*)?" bname ) == null;
notIgnored = ( ! ( builtins.elem bname ignores ) ) &&
( ! ( builtins.elem ext ignoredExts ) );
in notIgnored && notResult;
};
propagatedBuildInputs = [semver nix];
nativeBuildInputs = [pkg-config];
buildInputs = [
sqlite.dev nlohmann_json argparse sqlite3pp toml11 yaml-cpp boost nix
];
nix_INCDIR = nix.dev.outPath + "/include";
boost_CFLAGS = "-isystem " + boost.dev.outPath + "/include";
toml_CFLAGS = "-isystem " + toml11.outPath + "/include";
yaml_PREFIX = yaml-cpp.outPath;
libExt = stdenv.hostPlatform.extensions.sharedLibrary;
SEMVER_PATH = semver.outPath + "/bin/semver";
configurePhase = ''
runHook preConfigure;
export PREFIX="$out";
if [[ "''${enableParallelBuilding:-1}" = 1 ]]; then
makeFlagsArray+=( "-j''${NIX_BUILD_CORES:?}" );
fi
runHook postConfigure;
'';
# Checks require internet
doCheck = false;
doInstallCheck = false;
outputs = ["out" "dev"];
meta.mainProgram = "pkgdb";
}
# ---------------------------------------------------------------------------- #
#
#
#
# ============================================================================ #