-
Notifications
You must be signed in to change notification settings - Fork 13
/
flake.nix
97 lines (93 loc) · 2.64 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
{
description = "Silicon Heaven library Flake";
inputs.necrolog.url = "github:fvacek/necrolog";
outputs = {
self,
flake-utils,
nixpkgs,
necrolog,
}: let
inherit (flake-utils.lib) eachDefaultSystem;
inherit (nixpkgs.lib) hasSuffix composeManyExtensions optional optionals strings;
inherit (strings) cmakeBool;
rev = self.shortRev or self.dirtyShortRev or "unknown";
libshv = {
stdenv,
qt6,
cmake,
necrolog,
chainpack ? true,
chainpack_cpp ? true,
core ? true,
coreqt ? true,
iotqt ? true,
visu ? true,
broker ? true,
cli_examples ? false,
gui_examples ? false,
}:
stdenv.mkDerivation {
name = "libshv-${rev}";
src = builtins.path {
name = "libshv-src";
path = ./.;
filter = path: type: ! hasSuffix ".nix" path;
};
buildInputs =
[necrolog]
++ (optionals coreqt [
qt6.wrapQtAppsHook
qt6.qtbase
qt6.qtserialport
qt6.qtwebsockets
]);
nativeBuildInputs = [cmake] ++ (optional coreqt qt6.qttools);
cmakeFlags = [
"-DLIBSHV_USE_LOCAL_NECROLOG=ON"
(cmakeBool "LIBSHV_WITH_CHAINPACK" chainpack)
(cmakeBool "LIBSHV_WITH_CHAINPACK_CPP" chainpack_cpp)
(cmakeBool "LIBSHV_WITH_CORE" core)
(cmakeBool "LIBSHV_WITH_COREQT" coreqt)
(cmakeBool "LIBSHV_WITH_IOTQT" iotqt)
(cmakeBool "LIBSHV_WITH_VISU" visu)
(cmakeBool "LIBSHV_WITH_BROKER" broker)
(cmakeBool "LIBSHV_WITH_CLI_EXAMPLES" cli_examples)
(cmakeBool "LIBSHV_WITH_GUI_EXAMPLES" gui_examples)
];
};
in
{
overlays = {
pkgs = final: prev: {
libshv = final.callPackage libshv {};
libshvFull = final.callPackage libshv {
cli_examples = true;
gui_examples = true;
};
libshvCli = final.callPackage libshv {
visu = false;
cli_examples = true;
};
libshvForClients = final.callPackage libshv {
broker = false;
};
};
default = composeManyExtensions [
necrolog.overlays.default
self.overlays.pkgs
];
};
}
// eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system}.extend self.overlays.default;
in {
packages = {
default = pkgs.libshv;
full = pkgs.libshvFull;
cli = pkgs.libshvCli;
forClients = pkgs.libshvForClients;
};
legacyPackages = pkgs;
formatter = pkgs.alejandra;
});
}