Files
qyouradio/flake.nix
2025-10-11 02:30:58 +02:00

42 lines
1.6 KiB
Nix
Executable File

{
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:nixos/nixpkgs";
};
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "aarch64-linux" "x86_64-linux" ];
perSystem = { config, pkgs, ... }: {
packages.default = pkgs.qt6Packages.callPackage ./build.nix { };
devShells.default = pkgs.mkShell {
inputsFrom = [ config.packages.default ];
buildInputs = with pkgs; [
gdb
qtcreator
qt6.qttools
# this is for the shellhook portion
makeWrapper
# bashInteractive
];
# set the environment variables that unpatched Qt apps expect
shellHook = ''
export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc)
# Add Qt-related environment variables.
# https://discourse.nixos.org/t/qt-development-environment-on-a-flake-system/23707/5
setQtEnvironment=$(mktemp)
random=$(openssl rand -base64 20 | sed "s/[^a-zA-Z0-9]//g")
makeShellWrapper "$(type -p sh)" "$setQtEnvironment" "''${qtWrapperArgs[@]}" --argv0 "$random"
sed "/$random/d" -i "$setQtEnvironment"
source "$setQtEnvironment"
# qmlls does not account for the import path and bases its search off qtbase's path.
# The actual imports come from qtdeclarative. This directs qmlls to the correct imports.
export QMLLS_BUILD_DIRS=$(pwd)/build:$QML2_IMPORT_PATH
'';
};
};
};
}