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

@ -1,40 +1,46 @@
{
lib,
stdenvNoCC,
symlinkJoin,
makeWrapper,
quickshell,
qt6,
nova-stats,
nova-shaders,
glib,
}:
stdenvNoCC.mkDerivation {
pname = "nova-shell";
version = "0.1.0";
let
shellSrc = lib.cleanSourceWith {
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 = [
makeWrapper
qt6.qtshadertools
src = shellSrc;
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;
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
nativeBuildInputs = [ makeWrapper ];
postBuild = ''
mkdir -p $out/bin
makeWrapper ${lib.getExe quickshell} $out/bin/nova-shell \
--add-flags "-p $out/share/nova-shell/shell.qml" \
@ -44,8 +50,6 @@ stdenvNoCC.mkDerivation {
glib
]
}
runHook postInstall
'';
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
'';
}