From c75bc681f72a24d690b68eeb96664c921041675e Mon Sep 17 00:00:00 2001 From: Patrizio Bekerle Date: Mon, 20 Jan 2025 20:16:46 +0100 Subject: [PATCH] nix: add script to update qmake symlinks Signed-off-by: Patrizio Bekerle --- scripts/nix-update-qmake-symlinks.sh | 14 ++++++++++++++ shell.nix | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100755 scripts/nix-update-qmake-symlinks.sh diff --git a/scripts/nix-update-qmake-symlinks.sh b/scripts/nix-update-qmake-symlinks.sh new file mode 100755 index 0000000000..caeef836bb --- /dev/null +++ b/scripts/nix-update-qmake-symlinks.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +### +# This script updates the symlinks to the qmake binaries in the nix store +# It will be executed by direnv when entering the project directory via the shell.nix +# The symlinks are to be used in Qt Creator and CLion +### + +# With direnv, the current directory is the project directory +BIN_DIR="$(pwd)/bin" + +mkdir -p "${BIN_DIR}" +ln -sf "$(which qmake)" "${BIN_DIR}/qmake6" && "${BIN_DIR}/qmake6" --version +# Run a pure shell so the shell.nix will not be loaded again by direnv +nix-shell --pure -p which libsForQt5.qt5.qtbase --run "ln -sf \$(which qmake | tail -n1) \$PWD/bin/qmake5" && "${BIN_DIR}/qmake5" --version diff --git a/shell.nix b/shell.nix index a0ccc2d74a..f9bb963a90 100644 --- a/shell.nix +++ b/shell.nix @@ -54,6 +54,6 @@ pkgs.mkShell { ]; shellHook = '' - echo "qmake: $(qmake --version)" + ./scripts/nix-update-qmake-symlinks.sh ''; }