-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
114 lines (99 loc) · 3.22 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
{
description = "Yet another wayland displays configurator";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
];
perSystem = { config, self', inputs', pkgs, lib, system, ... }:
let
wayland-displays = pkgs.stdenv.mkDerivation
{
name = "wayland-displays";
# Call Makefile targets instead of CMake
dontUseCmakeConfigure = true;
enableParallelBuilding = true; # dontUseCmakeConfigure seems to set this to false
# Filtered list of source files
src = lib.sourceByRegex ./. [
"Makefile"
"CMakeLists.txt"
"^src.*"
"^lib.*"
"^cmake.*"
"^protocols.*"
"^resources.*"
"^tests/unit.*"
];
# Needed at compile time
nativeBuildInputs = with pkgs; [
# C++ Compiler is already part of stdenv
cmake
pkg-config
gtk3
cairo
wayland
wayland-scanner
yaml-cpp
catch2_3
];
buildInputs = [ ];
makeFlags = [
"PREFIX=${placeholder "out"}"
];
doCheck = true;
};
wayland-displays-debug = (config.packages.default.overrideAttrs {
# See https://nixos.wiki/wiki/Debug_Symbols
dontStrip = true;
separateDebugInfo = true;
});
in
{
devShells.default = pkgs.mkShell {
packages = with pkgs;
[
# For clangd
clang-tools_17
# Create .ui files
glade
# Testing sockets
socat
# Experiment with existing tools
way-displays
wdisplays
nwg-displays
kanshi
] ++ config.packages.default.nativeBuildInputs;
};
packages = {
default = wayland-displays;
# Run with nix -L build .#test-vm
test-vm = pkgs.testers.runNixOSTest (import ./tests/vm/test.nix wayland-displays);
};
apps.debug =
let
debug = pkgs.writeShellApplication {
name = "debug";
text = ''
trap "" SIGUSR1
# readelf --debug-dump=line ${config.packages.default.out}/bin/wayland-displays
${pkgs.gdb}/bin/gdb \
--quiet \
--ex "handle SIGUSR1 nostop pass" \
--ex "run" \
--args ${wayland-displays-debug}/bin/wayland-displays "$@"
'';
};
in
{
type = "app";
# Using a derivation in here gets replaced
# with the path to the built output
program = "${debug}/bin/debug";
};
};
};
}