-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
268 lines (244 loc) · 7.16 KB
/
Copy pathflake.nix
File metadata and controls
268 lines (244 loc) · 7.16 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
{
description = "Sugar Labs GTK4 modernization monorepo devShell";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
sugar-artwork-src = {
url = "github:MostlyKIGuess/sugar-artwork";
flake = false;
};
};
outputs = { self, nixpkgs, flake-utils, sugar-artwork-src, ... } @ inputs:
let
overlay = final: prev: {
sugarlabs-monorepo = prev.python311.pkgs.buildPythonPackage {
pname = "sugarlabs-workspace";
version = "0.121.0";
format = "pyproject";
src = self;
nativeBuildInputs = with final; [
wrapGAppsHook4
gobject-introspection
pkg-config
dbus
dbus-glib
];
buildInputs = with final; [
gtk4
gtk4.dev
glib
glib.dev
gobject-introspection
gdk-pixbuf
librsvg
dconf
gsettings-desktop-schemas
hicolor-icon-theme
adwaita-icon-theme
dbus
dbus-glib
];
propagatedBuildInputs = with final.python311.pkgs; [
pygobject3
dbus-python
];
pythonNamespaces = [ "sugar4" "jarabe" ];
};
};
in
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ overlay ];
};
sugar-artwork = pkgs.stdenv.mkDerivation {
pname = "sugar-artwork";
version = "0.121-local";
src = sugar-artwork-src;
nativeBuildInputs = with pkgs; [
autoconf
automake
libtool
pkg-config
intltool
gtk3
gdk-pixbuf
librsvg
xorg.xcursorgen
python3
python3Packages.empy
iconnamingutils
];
buildInputs = with pkgs; [
gtk3
gdk-pixbuf
librsvg
hicolor-icon-theme
gtk2
];
preConfigure = ''
autoreconf -fi
'';
configureFlags = [
"--with-gtk3"
"--without-gtk2"
"--enable-icon-theme"
"--enable-cursor-theme"
];
};
pythonEnv = pkgs.python311.withPackages (ps: with ps; [
pygobject3
dbus-python
pytest
pytest-cov
ruff
mypy
debugpy
sphinx
sphinx-rtd-theme
six
decorator
build
twine
setuptools
wheel
]);
gtkDeps = with pkgs; [
gtk4
gtk4.dev
gobject-introspection
glib
glib.dev
gdk-pixbuf
librsvg
dconf
gsettings-desktop-schemas
hicolor-icon-theme
adwaita-icon-theme
dbus
dbus-glib
gtk3
gtk3.dev
];
waylandDeps = with pkgs; [
wayland
wayland-protocols
wayland-scanner
wlroots_0_20
pixman
xorg.xcbutil
xorg.libxcb
xorg.xcbproto
libxkbcommon
mesa
libdrm
seatd
];
mutterDeps = with pkgs; [
mutter
mutter.dev
graphene
json-glib
libinput
pipewire
libcanberra-gtk3
upower
gnome-desktop
gcr
accountsservice
geoclue2
gnome-settings-daemon
xdg-dbus-proxy
];
in
{
devShells.default = pkgs.mkShell {
name = "sugarlabs-devshell";
buildInputs = [
sugar-artwork
pythonEnv
] ++ gtkDeps ++ waylandDeps ++ mutterDeps ++ (with pkgs; [
git
gnumake
pkg-config
meson
ninja
autoconf
automake
libtool
intltool
gettext
gnome.gnome-common
cairo
pango
atk
wrapGAppsHook4
gobject-introspection
jq
ripgrep
fd
gdb
valgrind
]);
nativeBuildInputs = with pkgs; [
wrapGAppsHook4
gobject-introspection
pkg-config
dbus
dbus-glib
];
GI_TYPELIB_PATH = pkgs.lib.makeSearchPath "lib/girepository-1.0" ([
"${pkgs.gtk4.dev}/lib/girepository-1.0"
"${pkgs.glib.dev}/lib/girepository-1.0"
"${pkgs.glib.out}/lib/girepository-1.0"
"${pkgs.gdk-pixbuf.dev}/lib/girepository-1.0"
"${pkgs.librsvg.dev}/lib/girepository-1.0"
"${pkgs.dbus-glib.out}/lib/girepository-1.0"
"${pkgs.pango.dev}/lib/girepository-1.0"
"${pkgs.atk.dev}/lib/girepository-1.0"
"${pkgs.cairo.dev}/lib/girepository-1.0"
"${pkgs.mutter.dev}/lib/girepository-1.0"
]);
XDG_DATA_DIRS = pkgs.lib.makeSearchPath "share" ([
"${pkgs.gtk4.dev}"
"${pkgs.gsettings-desktop-schemas}"
"${pkgs.hicolor-icon-theme}"
"${pkgs.adwaita-icon-theme}"
"${sugar-artwork}"
] ++ (with pkgs; [
"${mutter}"
"${gnome-desktop}"
]));
GIO_EXTRA_MODULES = "${pkgs.dconf.lib}/lib/gio/modules";
PYTHONPATH = "${toString ./.}/repos/sugar-toolkit-gtk4/src:${toString ./.}/repos/sugar/src";
DBUS_SESSION_BUS_ADDRESS = "unix:path=/run/user/$UID/bus";
WLR_RENDERER = "gles2";
WLR_BACKENDS = "wayland,libinput";
XDG_RUNTIME_DIR = "/run/user/$UID";
CFLAGS = "-I${pkgs.gtk4.dev}/include/gtk-4.0 -I${pkgs.glib.dev}/include -I${pkgs.mutter.dev}/include/mutter-14";
LDFLAGS = "-L${pkgs.gtk4.out}/lib -L${pkgs.glib.out}/lib -L${pkgs.mutter}/lib";
shellHook = ''
echo "Sugar Labs GTK4 modernization devShell"
echo " Python: $(python --version)"
echo " GTK4: $(pkg-config --modversion gtk4 2>/dev/null || echo 'not found')"
echo " Meson: $(meson --version 2>/dev/null || echo 'not found')"
echo ""
echo "Repos:"
echo " sugar (shell): repos/sugar/"
echo " sugar-toolkit-gtk4: repos/sugar-toolkit-gtk4/"
echo " sugar-toolkit-gtk3 (ref):repos/sugar-toolkit-gtk3/"
echo " casilda (compositor): repos/casilda/"
echo ""
echo "Quick start:"
echo " make run # windowed shell"
echo " make debug # shell with debugpy on :5678"
echo " make test # run test suite"
echo " make lint # ruff + mypy"
echo " make format # auto-format"
'';
};
packages.default = self.packages.${system}.sugarlabs-workspace;
packages.sugarlabs-workspace = pkgs.sugarlabs-monorepo;
});
}