nix: fix + expose lib stuff

Also format
This commit is contained in:
Soramane 2025-08-29 15:30:09 +10:00
parent 416a41affe
commit be5748dff3
4 changed files with 38 additions and 18 deletions

View file

@ -39,15 +39,17 @@ set(INSTALL_QSCONFDIR "etc/xdg/quickshell/caelestia" CACHE STRING "Quickshell co
add_compile_options(-Wall -Wextra) add_compile_options(-Wall -Wextra)
if(NOT DONT_BUILD_ASSETS) if(NOT DONT_BUILD_ASSETS AND NOT PLUGIN_ONLY AND NOT SHELL_ONLY)
add_subdirectory(assets/cpp) add_subdirectory(assets/cpp)
endif() endif()
if(NOT DONT_BUILD_PLUGIN) if(NOT DONT_BUILD_PLUGIN AND NOT ASSETS_ONLY AND NOT SHELL_ONLY)
add_subdirectory(plugin) add_subdirectory(plugin)
endif() endif()
foreach(dir assets components config modules services utils) if(NOT DONT_BUILD_SHELL AND NOT ASSETS_ONLY AND NOT PLUGIN_ONLY)
install(DIRECTORY ${dir} DESTINATION "${INSTALL_QSCONFDIR}") foreach(dir assets components config modules services utils)
endforeach() install(DIRECTORY ${dir} DESTINATION "${INSTALL_QSCONFDIR}")
install(FILES shell.qml LICENSE DESTINATION "${INSTALL_QSCONFDIR}") endforeach()
install(FILES shell.qml LICENSE DESTINATION "${INSTALL_QSCONFDIR}")
endif()

View file

@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.19)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
pkg_check_modules(PIPEWIRE REQUIRED libpipewire-0.3) pkg_check_modules(PIPEWIRE REQUIRED libpipewire-0.3)
pkg_check_modules(AUBIO REQUIRED aubio) pkg_check_modules(AUBIO REQUIRED aubio)

View file

@ -68,28 +68,44 @@
cmakeVersionFlags = [ cmakeVersionFlags = [
(lib.cmakeFeature "VERSION" version) (lib.cmakeFeature "VERSION" version)
(lib.cmakeFeature "GIT_REVISION" rev) (lib.cmakeFeature "GIT_REVISION" rev)
(lib.cmakeFeature "DISTRIBUTOR" "Nix Flake") (lib.cmakeFeature "DISTRIBUTOR" "nix-flake")
]; ];
assets = stdenv.mkDerivation { assets = stdenv.mkDerivation {
name = "caelestia-assets"; name = "caelestia-assets";
src = ./../assets/cpp; src = lib.fileset.toSource {
root = ./..;
fileset = lib.fileset.union ./../CMakeLists.txt ./../assets/cpp;
};
nativeBuildInputs = [cmake ninja pkg-config]; nativeBuildInputs = [cmake ninja pkg-config];
buildInputs = [aubio pipewire]; buildInputs = [aubio pipewire];
cmakeFlags = [(lib.cmakeFeature "INSTALL_LIBDIR" "${placeholder "out"}/lib")] ++ cmakeVersionFlags; cmakeFlags =
[
(lib.cmakeBool "ASSETS_ONLY" true)
(lib.cmakeFeature "INSTALL_LIBDIR" "${placeholder "out"}/lib")
]
++ cmakeVersionFlags;
}; };
plugin = stdenv.mkDerivation { plugin = stdenv.mkDerivation {
name = "caelestia-qml-plugin"; name = "caelestia-qml-plugin";
src = ./../plugin; src = lib.fileset.toSource {
root = ./..;
fileset = lib.fileset.union ./../CMakeLists.txt ./../plugin;
};
nativeBuildInputs = [cmake ninja]; nativeBuildInputs = [cmake ninja];
buildInputs = [qt6.qtbase qt6.qtdeclarative]; buildInputs = [qt6.qtbase qt6.qtdeclarative];
dontWrapQtApps = true; dontWrapQtApps = true;
cmakeFlags = [(lib.cmakeFeature "INSTALL_QMLDIR" qt6.qtbase.qtQmlPrefix)] ++ cmakeVersionFlags; cmakeFlags =
[
(lib.cmakeBool "PLUGIN_ONLY" true)
(lib.cmakeFeature "INSTALL_QMLDIR" qt6.qtbase.qtQmlPrefix)
]
++ cmakeVersionFlags;
}; };
in in
stdenv.mkDerivation { stdenv.mkDerivation {
@ -102,11 +118,12 @@ in
propagatedBuildInputs = runtimeDeps; propagatedBuildInputs = runtimeDeps;
cmakeBuildType = "Release"; cmakeBuildType = "Release";
cmakeFlags = [ cmakeFlags =
(lib.cmakeBool "DONT_BUILD_PLUGIN" true) [
(lib.cmakeBool "DONT_BUILD_ASSETS" true) (lib.cmakeBool "SHELL_ONLY" true)
(lib.cmakeFeature "INSTALL_QSCONFDIR" "${placeholder "out"}/share/caelestia-shell") (lib.cmakeFeature "INSTALL_QSCONFDIR" "${placeholder "out"}/share/caelestia-shell")
] ++ cmakeVersionFlags; ]
++ cmakeVersionFlags;
prePatch = '' prePatch = ''
substituteInPlace assets/pam.d/fprint \ substituteInPlace assets/pam.d/fprint \
@ -120,6 +137,9 @@ in
--set CAELESTIA_LIB_DIR ${assets}/lib \ --set CAELESTIA_LIB_DIR ${assets}/lib \
--set CAELESTIA_XKB_RULES_PATH ${xkeyboard-config}/share/xkeyboard-config-2/rules/base.lst \ --set CAELESTIA_XKB_RULES_PATH ${xkeyboard-config}/share/xkeyboard-config-2/rules/base.lst \
--add-flags "-p $out/share/caelestia-shell" --add-flags "-p $out/share/caelestia-shell"
mkdir -p $out/lib
ln -s ${assets}/lib/* $out/lib/
''; '';
passthru = { passthru = {

View file

@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.19)
find_package(Qt6 REQUIRED COMPONENTS Core Qml) find_package(Qt6 REQUIRED COMPONENTS Core Qml)
if(QT_KNOWN_POLICY_QTP0001) if(QT_KNOWN_POLICY_QTP0001)