build: split derivation for extensible wrapper

This commit is contained in:
Rexiel Scarlet 2025-07-18 14:43:09 +04:00
parent ecc4a1249d
commit e55d519c28

View file

@ -43,17 +43,19 @@
withPam ? true,
withHyprland ? true,
withI3 ? true,
}: buildStdenv.mkDerivation {
}: let
unwrapped = buildStdenv.mkDerivation {
pname = "quickshell${lib.optionalString debug "-debug"}";
version = "0.1.0";
src = nix-gitignore.gitignoreSource [] ./.;
src = nix-gitignore.gitignoreSource "/default.nix\n" ./.;
dontWrapQtApps = true; # see wrappers
nativeBuildInputs = [
cmake
ninja
qt6.qtshadertools
spirv-tools
qt6.wrapQtAppsHook
pkg-config
]
++ lib.optional withWayland wayland-scanner;
@ -97,10 +99,37 @@
dontStrip = debug;
meta = with lib; {
homepage = "https://quickshell.outfoxxed.me";
homepage = "https://quickshell.org";
description = "Flexbile QtQuick based desktop shell toolkit";
license = licenses.lgpl3Only;
platforms = platforms.linux;
mainProgram = "quickshell";
};
}
};
wrapper = unwrapped.stdenv.mkDerivation {
inherit (unwrapped) version meta buildInputs;
pname = "${unwrapped.pname}-wrapped";
nativeBuildInputs = unwrapped.nativeBuildInputs ++ [ qt6.wrapQtAppsHook ];
dontUnpack = true;
dontConfigure = true;
dontBuild = true;
installPhase = ''
mkdir -p $out/bin
# cp will create .quickshell-wrapped in path, ln will not. It is occasionally useful.
cp -r ${unwrapped}/bin/* $out/bin
ln -s ${unwrapped}/share $out/share
# not /lib
'';
passthru = {
unwrapped = unwrapped;
withModules = modules: wrapper.overrideAttrs (prev: {
buildInputs = prev.buildInputs ++ modules;
});
};
};
in wrapper