summaryrefslogtreecommitdiff
path: root/nix/default.nix
diff options
context:
space:
mode:
authorDavi Ribeiro <104164579+Markus328@users.noreply.github.com>2025-08-23 07:21:35 -0300
committerGitHub <noreply@github.com>2025-08-23 20:21:35 +1000
commitf747d82b9336bb7c691d39a1f001c0d30d7bfb95 (patch)
tree3456b6a9ed002382593e653a48a85b141edcc424 /nix/default.nix
parentdashboard: better pfp picker (diff)
downloadcaelestia-shell-f747d82b9336bb7c691d39a1f001c0d30d7bfb95.tar.gz
caelestia-shell-f747d82b9336bb7c691d39a1f001c0d30d7bfb95.tar.bz2
caelestia-shell-f747d82b9336bb7c691d39a1f001c0d30d7bfb95.zip
bar: add idle inhibitor (#459)
* bar: add idle inhibitor * bar: change idle inhibitor button color * nix: link external scripts instead of install * services/idleinhibitor: add IPC handler * better styling * move cpp scripts to assets/cpp --------- Co-authored-by: Soramane <61896496+soramanew@users.noreply.github.com>
Diffstat (limited to 'nix/default.nix')
-rw-r--r--nix/default.nix61
1 files changed, 52 insertions, 9 deletions
diff --git a/nix/default.nix b/nix/default.nix
index e93f74b..6d0f3c8 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -30,6 +30,9 @@
quickshell,
aubio,
pipewire,
+ wayland,
+ wayland-protocols,
+ wayland-scanner,
caelestia-cli,
withCli ? false,
extraRuntimeDeps ? [],
@@ -61,15 +64,15 @@
fontconfig = makeFontsConf {
fontDirectories = [material-symbols rubik nerd-fonts.caskaydia-cove];
};
-in
- stdenv.mkDerivation {
- pname = "caelestia-shell";
- version = "${rev}";
+
+ beatDetector = stdenv.mkDerivation {
+ pname = "beat-detector";
+ version = "1.0";
+
src = ./..;
- nativeBuildInputs = [gcc makeWrapper qt6.wrapQtAppsHook];
- buildInputs = [quickshell aubio pipewire qt6.qtbase];
- propagatedBuildInputs = runtimeDeps;
+ nativeBuildInputs = [gcc];
+ buildInputs = [aubio pipewire];
buildPhase = ''
mkdir -p bin
@@ -77,22 +80,62 @@ in
-I${pipewire.dev}/include/pipewire-0.3 \
-I${pipewire.dev}/include/spa-0.2 \
-I${aubio}/include/aubio \
- assets/beat_detector.cpp \
+ assets/cpp/beat-detector.cpp \
-o bin/beat_detector \
-lpipewire-0.3 -laubio
'';
installPhase = ''
install -Dm755 bin/beat_detector $out/bin/beat_detector
+ '';
+ };
+
+ idleInhibitor = stdenv.mkDerivation {
+ pname = "wayland-idle-inhibitor";
+ version = "1.0";
+
+ src = ./..;
+
+ nativeBuildInputs = [gcc wayland-scanner wayland-protocols];
+ buildInputs = [wayland];
+
+ buildPhase = ''
+ wayland-scanner client-header < ${wayland-protocols}/share/wayland-protocols/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml > idle-inhibitor.h
+ wayland-scanner private-code < ${wayland-protocols}/share/wayland-protocols/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml > idle-inhibitor.c
+ cp assets/cpp/idle-inhibitor.cpp .
+ gcc -o idle-inhibitor.o -c idle-inhibitor.c
+ g++ -o inhibit_idle idle-inhibitor.cpp idle-inhibitor.o -lwayland-client
+ '';
+
+ installPhase = ''
+ mkdir -p $out/bin
+ install -Dm755 inhibit_idle $out/bin/inhibit_idle
+ '';
+ };
+in
+ stdenv.mkDerivation {
+ pname = "caelestia-shell";
+ version = "${rev}";
+ src = ./..;
+
+ nativeBuildInputs = [gcc makeWrapper qt6.wrapQtAppsHook];
+ buildInputs = [quickshell beatDetector idleInhibitor qt6.qtbase];
+ propagatedBuildInputs = runtimeDeps;
+
+ installPhase = ''
mkdir -p $out/share/caelestia-shell
cp -r ./* $out/share/caelestia-shell
makeWrapper ${quickshell}/bin/qs $out/bin/caelestia-shell \
--prefix PATH : "${lib.makeBinPath runtimeDeps}" \
--set FONTCONFIG_FILE "${fontconfig}" \
- --set CAELESTIA_BD_PATH $out/bin/beat_detector \
+ --set CAELESTIA_BD_PATH ${beatDetector}/bin/beat_detector \
+ --set CAELESTIA_II_PATH ${idleInhibitor}/bin/inhibit_idle \
--add-flags "-p $out/share/caelestia-shell"
+
+ ln -sf ${beatDetector}/bin/beat_detector $out/bin
+ ln -sf ${idleInhibitor}/bin/inhibit_idle $out/bin
'';
meta = {