-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
94 lines (94 loc) · 3.12 KB
/
Copy pathflake.nix
File metadata and controls
94 lines (94 loc) · 3.12 KB
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
{
description = "Nix flake C++23 cross development environment";
nixConfig = {
extra-substituters = [ "https://cache.garnix.io" ];
extra-trusted-public-keys = [ "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" ];
};
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
engine.url = "https://github.com/ProjetISIE/SmartPianoEngine/archive/main.tar.gz";
};
outputs =
{
self,
nixpkgs,
engine,
}:
let
forSystems = nixpkgs.lib.genAttrs [
"x86_64-linux" # "aarch64-linux"
"aarch64-darwin"
];
in
{
packages = forSystems (
system:
let
pkgs = import nixpkgs { inherit system; };
mkUi =
p:
p.callPackage ./ui.nix {
inherit (p) glfw;
engine =
engine.packages.${pkgs.stdenv.hostPlatform.system}.${
if pkgs.stdenv.hostPlatform.system == p.stdenv.hostPlatform.system then
"default"
else
"${p.stdenv.hostPlatform.system}-default"
};
stdenv = p.clangStdenv;
};
in
{
default = mkUi pkgs;
smart-piano = mkUi pkgs;
}
// nixpkgs.lib.optionalAttrs (system == "x86_64-linux") {
aarch64-linux-default = mkUi pkgs.pkgsCross.aarch64-multiplatform;
aarch64-linux-smart-piano = mkUi pkgs.pkgsCross.aarch64-multiplatform;
}
);
devShells = forSystems (
system:
let
pkgs = import nixpkgs { inherit system; };
defaultPkg = self.packages.${system}.default;
in
{
default =
pkgs.mkShell.override
{
stdenv = pkgs.clangStdenv; # Clang instead of GCC
}
{
packages =
with pkgs;
[
bashInteractive
clang-tools # Clang CLIs, including LSP
cmake-format # CMake formatter
cmake-language-server # Cmake LSP
doctest # Testing framework (-DBUILD_TESTING=ON builds)
doxygen # Documentation generator
lldb # Clang debug adapter
]
++ lib.optionals stdenv.isLinux [
alsa-utils # aconnect…
clang-uml # UML diagram generator
cppcheck # C++ Static analysis
fluidsynth # JACK Synthesizer
qsynth # FluidSynth GUI
socat # Serial terminal for manual testing
valgrind # Debugging and profiling
];
inputsFrom = [ defaultPkg ];
shellHook = ''
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath defaultPkg.buildInputs}:$LD_LIBRARY_PATH"
cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Debug \
-DCOVERAGE=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON # -S .
'';
};
}
);
};
}