-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathflake.nix
More file actions
134 lines (120 loc) · 3.87 KB
/
Copy pathflake.nix
File metadata and controls
134 lines (120 loc) · 3.87 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default-linux";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = import inputs.systems;
imports = [ inputs.treefmt-nix.flakeModule ];
perSystem =
{ pkgs, lib, ... }:
let
wlroots = pkgs.stdenv.mkDerivation {
pname = "wlroots";
version = "0.10.0";
src = builtins.filterSource (path: type: baseNameOf path != "build") ./.;
# $out for the library and $examples for the example programs (in examples):
outputs = [
"out"
"examples"
];
nativeBuildInputs = tools.dependencies;
inherit buildInputs LDFLAGS;
mesonFlags = [
"-Dlibcap=enabled"
"-Dlogind=enabled"
"-Dxwayland=enabled"
"-Dx11-backend=enabled"
"-Dxcb-icccm=disabled"
"-Dxcb-errors=enabled"
];
postInstall = ''
# Copy the library to $examples
mkdir -p $examples/lib
cp -Pr libwlroots* $examples/lib/
'';
postFixup = ''
# Install ALL example programs to $examples:
# screencopy dmabuf-capture input-inhibitor layer-shell idle-inhibit idle
# screenshot output-layout multi-pointer rotation tablet touch pointer
# simple
mkdir -p $examples/bin
cd ./examples
for binary in $(find . -executable -type f -printf '%P\n' | grep -vE '\.so'); do
cp "$binary" "$examples/bin/wlroots-$binary"
done
'';
meta = {
description = "More or less a pinned version of wlroots that Simula can use (with a few patches)";
homepage = "https://github.com/SimulaVR/wlroots";
license = lib.licenses.mit;
platforms = lib.platforms.linux;
};
};
tools.development = [
# LSP
pkgs.nil # Nix
# Command Runner
pkgs.just
];
tools.dependencies = [
pkgs.meson
pkgs.cmake
pkgs.ninja
pkgs.pkg-config
pkgs.wayland-scanner
];
buildInputs = [
pkgs.wayland
pkgs.libGL
pkgs.wayland-protocols
pkgs.libinput
pkgs.libxkbcommon
pkgs.pixman
pkgs.xcbutilwm
pkgs.libcap
pkgs.xcbutilimage
pkgs.xcbutilerrors
pkgs.libpng
pkgs.ffmpeg_4
pkgs.libX11.dev
pkgs.libxcb.dev
pkgs.xinput
# pkgs.mesa # <- exclude when bumping to newer nixpkgs
pkgs.libdrm # <- include when bumping to newer nixpkgs
pkgs.libgbm # <- include when bumping to newer nixpkgs
pkgs.mesa-gl-headers # <- include when bumping to newer nixpkgs
pkgs.libxcb-errors
];
LDFLAGS = [
"-lX11-xcb"
"-lxcb-xinput"
];
in
{
packages = {
inherit wlroots;
default = wlroots;
};
treefmt = {
projectRootFile = ".git/config";
# Nix
programs.nixfmt.enable = true;
};
devShells.default = pkgs.mkShell {
nativeBuildInputs = tools.dependencies ++ tools.development;
inherit buildInputs LDFLAGS;
};
};
};
}