Skip to content

Commit b383ffe

Browse files
shymegajohnrizzo1
andcommitted
feat(nix): Add Nix Flake to Breezy
This derives from @johnrizzo1's Nix packages for the Nix Flake, which were REALLY helpful for me. Co-authored-by: John Rizzo <johnrizzo1@gmail.com>
1 parent 3ba62cf commit b383ffe

6 files changed

Lines changed: 395 additions & 0 deletions

File tree

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
self,
3+
version,
4+
lib,
5+
stdenv,
6+
glib,
7+
}: let
8+
extensionUuid = "breezydesktop@xronlinux.com";
9+
in
10+
stdenv.mkDerivation (finalAttrs: {
11+
pname = "gnome-shell-extension-breezy-desktop";
12+
inherit version;
13+
14+
src = self;
15+
16+
nativeBuildInputs = [
17+
glib # for glib-compile-schemas
18+
];
19+
20+
dontConfigure = true;
21+
dontBuild = true;
22+
23+
passthru = {
24+
inherit extensionUuid;
25+
};
26+
27+
installPhase = ''
28+
runHook preInstall
29+
30+
extDir=$out/share/gnome-shell/extensions/${extensionUuid}
31+
mkdir -p $extDir
32+
33+
# JavaScript source files
34+
cd gnome/src
35+
for f in *.js metadata.json; do
36+
install -Dm644 "$f" "$extDir/$f"
37+
done
38+
39+
# Fragment shader (resolve symlink)
40+
cp -L Sombrero.frag "$extDir/Sombrero.frag"
41+
42+
# D-Bus interfaces
43+
mkdir -p "$extDir/dbus-interfaces"
44+
cp dbus-interfaces/*.xml "$extDir/dbus-interfaces/"
45+
46+
# Textures (resolve symlinks)
47+
mkdir -p "$extDir/textures"
48+
cp -L textures/* "$extDir/textures/"
49+
50+
# GSettings schema (resolve symlink and compile)
51+
mkdir -p "$extDir/schemas"
52+
cp -L schemas/*.xml "$extDir/schemas/"
53+
glib-compile-schemas "$extDir/schemas"
54+
55+
runHook postInstall
56+
'';
57+
58+
meta = {
59+
description = "GNOME Shell extension for Breezy Desktop XR virtual display";
60+
homepage = "https://github.com/wheaney/breezy-desktop";
61+
license = lib.licenses.gpl3Only;
62+
platforms = lib.platforms.linux;
63+
};
64+
})
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
{
2+
self,
3+
version,
4+
lib,
5+
stdenv,
6+
fetchFromGitHub,
7+
cmake,
8+
pkg-config,
9+
kdePackages,
10+
libepoxy,
11+
}:
12+
stdenv.mkDerivation (finalAttrs: {
13+
pname = "breezy-kwin";
14+
inherit version;
15+
16+
src = self;
17+
18+
sourceRoot = ".";
19+
20+
unpackPhase = ''
21+
cp -r $src $TMPDIR/breezy-desktop
22+
chmod -R u+w $TMPDIR/breezy-desktop
23+
cd $TMPDIR/breezy-desktop/kwin
24+
'';
25+
26+
nativeBuildInputs = [
27+
cmake
28+
kdePackages.extra-cmake-modules
29+
kdePackages.wrapQtAppsHook
30+
pkg-config
31+
];
32+
33+
buildInputs = with kdePackages; [
34+
kconfig
35+
kconfigwidgets
36+
kcoreaddons
37+
kglobalaccel
38+
ki18n
39+
kcmutils
40+
kwindowsystem
41+
kxmlgui
42+
kwin
43+
qtbase
44+
qtdeclarative
45+
qt3d
46+
qtquick3d
47+
libepoxy
48+
];
49+
50+
postPatch = ''
51+
# VERSION is read relative to kwin/src/../VERSION = kwin/VERSION
52+
# and also from kwin/../VERSION for the top-level CMakeLists.txt
53+
echo "${finalAttrs.version}" > ../VERSION
54+
echo "${finalAttrs.version}" > VERSION
55+
56+
# Copy files expected by CMake install but located elsewhere in the mono-repo
57+
cp ../ui/modules/PyXRLinuxDriverIPC/xrdriveripc.py src/xrdriveripc/xrdriveripc.py
58+
cp ../ui/data/icons/hicolor/scalable/apps/com.xronlinux.BreezyDesktop.svg src/kcm/com.xronlinux.BreezyDesktop.svg
59+
60+
# Fix hardcoded /usr/include/kwin path
61+
substituteInPlace cmake/info.cmake \
62+
--replace-fail '/usr/include/kwin/effect/effect.h' \
63+
'${kdePackages.kwin.dev}/include/kwin/effect/effect.h'
64+
65+
# Fix QtQuick3D QML module detection - bypass qmake query
66+
substituteInPlace CMakeLists.txt \
67+
--replace-fail 'execute_process(
68+
COMMAND ''${QT6_QMAKE_EXECUTABLE} -query QT_INSTALL_QML
69+
OUTPUT_VARIABLE QT6_QML_DIR
70+
OUTPUT_STRIP_TRAILING_WHITESPACE
71+
)' 'set(QT6_QML_DIR "${kdePackages.qtquick3d}/lib/qt-6/qml")'
72+
73+
# Remove the hardcoded /usr/include reference
74+
substituteInPlace src/CMakeLists.txt \
75+
--replace-fail 'target_include_directories(breezy_desktop PRIVATE /usr/include/kwin)' \
76+
'target_include_directories(breezy_desktop PRIVATE ${kdePackages.kwin.dev}/include/kwin)'
77+
'';
78+
79+
cmakeFlags = [
80+
"-DCMAKE_BUILD_TYPE=Release"
81+
];
82+
83+
meta = {
84+
description = "KWin effect plugin for Breezy Desktop XR virtual display";
85+
homepage = "https://github.com/wheaney/breezy-desktop";
86+
license = lib.licenses.gpl3Only;
87+
platforms = lib.platforms.linux;
88+
};
89+
})
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
self,
3+
version,
4+
lib,
5+
stdenv,
6+
fetchFromGitHub,
7+
meson,
8+
ninja,
9+
pkg-config,
10+
gettext,
11+
glib,
12+
gtk4,
13+
libadwaita,
14+
desktop-file-utils,
15+
gobject-introspection,
16+
wrapGAppsHook4,
17+
python3Packages,
18+
python3,
19+
gst_all_1,
20+
appstream,
21+
}:
22+
stdenv.mkDerivation (finalAttrs: {
23+
pname = "breezy-desktop-ui";
24+
inherit version;
25+
26+
# Use the ui/ subtree but need root for VERSION file
27+
src = self;
28+
sourceRoot = "ui";
29+
30+
# The source is a nix store path, not a directory name
31+
unpackPhase = ''
32+
cp -r $src $TMPDIR/breezy-desktop
33+
chmod -R u+w $TMPDIR/breezy-desktop
34+
cd $TMPDIR/breezy-desktop/ui
35+
sourceRoot=$(pwd)
36+
'';
37+
38+
nativeBuildInputs = [
39+
meson
40+
ninja
41+
pkg-config
42+
gettext
43+
glib # glib-compile-schemas
44+
gtk4 # gtk-update-icon-cache
45+
desktop-file-utils
46+
gobject-introspection
47+
wrapGAppsHook4
48+
appstream # appstreamcli for validation
49+
];
50+
51+
buildInputs = [
52+
gtk4
53+
libadwaita
54+
glib
55+
gst_all_1.gstreamer
56+
gst_all_1.gst-plugins-base
57+
(python3.withPackages (ps:
58+
with ps; [
59+
pygobject3
60+
pydbus
61+
]))
62+
];
63+
64+
# Patch the entry scripts to use Nix store paths instead of XDG_DATA_HOME
65+
postPatch = ''
66+
substituteInPlace src/breezydesktop.in \
67+
--replace-fail "appdir = os.getenv('APPDIR', xdg_data_home)" \
68+
"appdir = os.getenv('APPDIR', '$out/share')"
69+
substituteInPlace src/virtualdisplay.in \
70+
--replace-fail "appdir = os.getenv('APPDIR', xdg_data_home)" \
71+
"appdir = os.getenv('APPDIR', '$out/share')" || true
72+
73+
# Upstream bug: virtualdisplayrow.py is missing from meson.build install list
74+
substituteInPlace src/meson.build \
75+
--replace-fail "'virtualdisplay.py'," "'virtualdisplay.py', 'virtualdisplayrow.py',"
76+
'';
77+
78+
# Skip tests that need network or display
79+
mesonFlags = [
80+
];
81+
82+
# wrapGAppsHook4 handles GI_TYPELIB_PATH, GDK_PIXBUF, etc.
83+
84+
meta = {
85+
description = "GTK4 settings UI for Breezy Desktop XR";
86+
homepage = "https://github.com/wheaney/breezy-desktop";
87+
license = lib.licenses.gpl3Only;
88+
platforms = lib.platforms.linux;
89+
};
90+
})
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
self,
3+
version,
4+
lib,
5+
stdenv,
6+
fetchFromGitHub,
7+
meson,
8+
ninja,
9+
pkg-config,
10+
glslang,
11+
spirv-headers,
12+
vulkan-headers,
13+
vulkan-loader,
14+
libx11,
15+
}:
16+
stdenv.mkDerivation (finalAttrs: {
17+
pname = "breezy-vulkan";
18+
inherit version;
19+
20+
src = "${self}/vulkan/modules/vkBasalt";
21+
22+
nativeBuildInputs = [
23+
meson
24+
ninja
25+
pkg-config
26+
glslang
27+
];
28+
29+
buildInputs = [
30+
spirv-headers
31+
vulkan-headers
32+
vulkan-loader
33+
libx11
34+
];
35+
36+
postInstall = let
37+
sombreroSrc = "${self}/modules/sombrero";
38+
vulkanSrc = "${self}/vulkan";
39+
in ''
40+
# Install sombrero shaders
41+
mkdir -p $out/share/breezy-vulkan/shaders
42+
cp ${sombreroSrc}/Sombrero.frag $out/share/breezy-vulkan/shaders/
43+
cp ${sombreroSrc}/calibrating.png $out/share/breezy-vulkan/shaders/ || true
44+
45+
# Install breezy vulkan config
46+
install -Dm644 ${vulkanSrc}/config/vkBasalt.conf $out/share/breezy-vulkan/vkBasalt.conf
47+
48+
# Install custom banner
49+
cp ${vulkanSrc}/custom_banner.png $out/share/breezy-vulkan/ || true
50+
'';
51+
52+
meta = {
53+
description = "Vulkan post-processing layer for Breezy Desktop XR gaming";
54+
homepage = "https://github.com/wheaney/breezy-desktop";
55+
license = lib.licenses.gpl3Only;
56+
platforms = ["x86_64-linux"];
57+
};
58+
})

flake.lock

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)