-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
96 lines (91 loc) · 2.38 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
{
description = "Silicon Heaven in C";
inputs = {
check-suite.url = "github:cynerd/check-suite";
};
outputs = {
self,
flake-utils,
nixpkgs,
check-suite,
}:
with builtins;
with flake-utils.lib;
with nixpkgs.lib; let
packages = pkgs:
with pkgs; rec {
shvc = stdenv.mkDerivation {
pname = "shvc";
version = replaceStrings ["\n"] [""] (readFile ./version);
src = builtins.path {
path = ./.;
filter = path: type: ! hasSuffix ".nix" path;
};
outputs = ["out" "doc"];
buildInputs = [
check
pkgs.check-suite
];
nativeBuildInputs = [
bash
bats
gperf
meson
ninja
pkg-config
doxygen
(sphinxHook.overrideAttrs (oldAttrs: {
propagatedBuildInputs = with python3Packages; [
sphinx_rtd_theme
myst-parser
breathe
];
}))
];
sphinxRoot = "../docs";
};
};
in
{
overlays = {
shvc = final: prev: packages (id prev);
default = composeManyExtensions [
check-suite.overlays.default
self.overlays.shvc
];
};
}
// eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system}.extend self.overlays.default;
in {
packages = rec {
inherit (pkgs) shvc;
default = shvc;
};
legacyPackages = pkgs;
devShells = filterPackages system {
default = pkgs.mkShell {
packages = with pkgs; [
# Linters and formaters
clang-tools_14
cppcheck
editorconfig-checker
flawfinder
muon
shellcheck
shfmt
gitlint
# Testing and code coverage
valgrind
gcovr
# Documentation
sphinx-autobuild
];
inputsFrom = [self.packages.${system}.shvc];
meta.platforms = platforms.linux;
};
};
checks.default = self.packages.${system}.shvc;
formatter = pkgs.alejandra;
});
}