Skip to content

Commit

Permalink
🐛 run pre/post hook in build/install/installCheck phases
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierLDff authored Sep 14, 2024
1 parent fad0d05 commit f37e14f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -127,29 +127,41 @@
out = [ "out" ];

buildPhase = ''
runHook preBuild
echo "Building qaterialhotreloadapp version ${version} in ${cmakeConfigType} mode"
cmake --build . --config ${cmakeConfigType} --target \
QaterialHotReloadApp \
--parallel $NIX_BUILD_CORES
runHook postBuild
'';

doCheck = pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform;

installPhase = ''
runHook preInstall
echo "Installing qaterialhotreloadapp version ${version} in ${cmakeConfigType} mode into $out"
mkdir -p $out/bin
cp -r QaterialHotReloadApp $out/bin
runHook postInstall
'';

doInstallCheck = doCheck;
installCheckPhase = pkgs.lib.optionalString doInstallCheck ''
runHook preInstallCheck
echo "Run shell hook"
${shellHook}
xvfb-run dbus-run-session \
--config-file=${pkgs.dbus}/share/dbus-1/session.conf \
$out/bin/QaterialHotReloadApp --help
runHook postInstallCheck
'';
};

Expand Down

0 comments on commit f37e14f

Please sign in to comment.