diff --git a/flake.nix b/flake.nix index ded32d6..bd753d0 100644 --- a/flake.nix +++ b/flake.nix @@ -57,12 +57,13 @@ withI3 = false; }; nova-stats = pkgs.callPackage ./nix/stats-daemon.nix { }; + nova-shaders = pkgs.callPackage ./nix/shaders.nix { }; in rec { - inherit nova-stats; + inherit nova-stats nova-shaders; nova-shell = pkgs.callPackage ./nix/package.nix { quickshell = qs; - inherit nova-stats; + inherit nova-stats nova-shaders; }; nova-shell-cli = pkgs.runCommand "nova-shell-cli" { nativeBuildInputs = [ pkgs.makeWrapper ]; } '' mkdir -p $out/bin diff --git a/nix/package.nix b/nix/package.nix index 6e1600d..d98a984 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -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 = { diff --git a/nix/shaders.nix b/nix/shaders.nix new file mode 100644 index 0000000..302c953 --- /dev/null +++ b/nix/shaders.nix @@ -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 + ''; +}