split shaders into separate derivation for incremental builds

This commit is contained in:
Damocles 2026-04-18 13:07:27 +02:00
parent c55ddd95b5
commit 195dd37be5
3 changed files with 58 additions and 28 deletions

View file

@ -57,12 +57,13 @@
withI3 = false; withI3 = false;
}; };
nova-stats = pkgs.callPackage ./nix/stats-daemon.nix { }; nova-stats = pkgs.callPackage ./nix/stats-daemon.nix { };
nova-shaders = pkgs.callPackage ./nix/shaders.nix { };
in in
rec { rec {
inherit nova-stats; inherit nova-stats nova-shaders;
nova-shell = pkgs.callPackage ./nix/package.nix { nova-shell = pkgs.callPackage ./nix/package.nix {
quickshell = qs; quickshell = qs;
inherit nova-stats; inherit nova-stats nova-shaders;
}; };
nova-shell-cli = pkgs.runCommand "nova-shell-cli" { nativeBuildInputs = [ pkgs.makeWrapper ]; } '' nova-shell-cli = pkgs.runCommand "nova-shell-cli" { nativeBuildInputs = [ pkgs.makeWrapper ]; } ''
mkdir -p $out/bin mkdir -p $out/bin

View file

@ -1,40 +1,46 @@
{ {
lib, lib,
stdenvNoCC, stdenvNoCC,
symlinkJoin,
makeWrapper, makeWrapper,
quickshell, quickshell,
qt6,
nova-stats, nova-stats,
nova-shaders,
glib, glib,
}: }:
stdenvNoCC.mkDerivation { let
pname = "nova-shell"; shellSrc = lib.cleanSourceWith {
version = "0.1.0"; src = lib.cleanSource ../.;
filter = path: _type: !(lib.hasSuffix ".frag" path);
};
src = lib.cleanSource ../.; shell = stdenvNoCC.mkDerivation {
pname = "nova-shell-qml";
version = "0.1.0";
nativeBuildInputs = [ src = shellSrc;
makeWrapper
qt6.qtshadertools dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out/share/nova-shell
cp -r shell/shell.qml shell/modules shell/services shell/applets shell/lock shell/assets $out/share/nova-shell/
runHook postInstall
'';
};
in
symlinkJoin {
name = "nova-shell-0.1.0";
paths = [
shell
nova-shaders
]; ];
dontBuild = true; nativeBuildInputs = [ makeWrapper ];
dontWrapQtApps = true;
installPhase = ''
runHook preInstall
mkdir -p $out/share/nova-shell
cp -r shell/shell.qml shell/modules shell/services shell/applets shell/lock shell/assets $out/share/nova-shell/
# Compile fragment shaders to Qt RHI format
qsb --qt6 \
-o $out/share/nova-shell/modules/hex_wave.frag.qsb \
shell/modules/hex_wave.frag
qsb --qt6 \
-o $out/share/nova-shell/modules/reveal_mask.frag.qsb \
shell/modules/reveal_mask.frag
postBuild = ''
mkdir -p $out/bin mkdir -p $out/bin
makeWrapper ${lib.getExe quickshell} $out/bin/nova-shell \ makeWrapper ${lib.getExe quickshell} $out/bin/nova-shell \
--add-flags "-p $out/share/nova-shell/shell.qml" \ --add-flags "-p $out/share/nova-shell/shell.qml" \
@ -44,8 +50,6 @@ stdenvNoCC.mkDerivation {
glib glib
] ]
} }
runHook postInstall
''; '';
meta = { meta = {

25
nix/shaders.nix Normal file
View file

@ -0,0 +1,25 @@
{
lib,
stdenvNoCC,
qt6,
}:
stdenvNoCC.mkDerivation {
pname = "nova-shell-shaders";
version = "0.1.0";
src = lib.sourceFilesBySuffices (lib.cleanSource ../shell/modules) [ ".frag" ];
nativeBuildInputs = [ qt6.qtshadertools ];
dontBuild = true;
dontWrapQtApps = true;
installPhase = ''
runHook preInstall
mkdir -p $out/share/nova-shell/modules
for f in *.frag; do
qsb --qt6 -o "$out/share/nova-shell/modules/''${f}.qsb" "$f"
done
runHook postInstall
'';
}