Wayland is Linux-only and refuses to evaluate on darwin, so qtwayland is now added only on Linux (macOS uses the Cocoa QPA plugin in qtbase). The package, dev shell, and plugin search path all build from one platform- guarded module list. Evaluates on aarch64-darwin; Linux is unchanged.
55 lines
1.9 KiB
Nix
55 lines
1.9 KiB
Nix
{
|
|
description = "photogallery uploader — Qt6 C++ desktop app";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = import nixpkgs { inherit system; };
|
|
inherit (pkgs) lib stdenv;
|
|
|
|
# Wayland is Linux-only; macOS uses the Cocoa QPA plugin inside qtbase,
|
|
# so qtwayland is added only on Linux (it refuses to evaluate on darwin).
|
|
qtModules = [ pkgs.qt6.qtbase pkgs.qt6.qtimageformats ]
|
|
++ lib.optionals stdenv.hostPlatform.isLinux [ pkgs.qt6.qtwayland ];
|
|
|
|
qtPlugins = lib.makeSearchPathOutput "out" "lib/qt-6/plugins" qtModules;
|
|
in {
|
|
# Installable build: `nix profile install ./desktop` drops "Photog" into
|
|
# the application menu with its icon. wrapQtAppsHook wraps the binary so
|
|
# it finds the Qt platform (Cocoa on macOS; xcb + wayland on Linux) and
|
|
# image-format plugins on its own, without the dev shell.
|
|
packages.default = stdenv.mkDerivation {
|
|
pname = "photog";
|
|
version = "0.1.0";
|
|
src = ./.;
|
|
nativeBuildInputs = with pkgs; [
|
|
cmake
|
|
ninja
|
|
pkg-config
|
|
qt6.wrapQtAppsHook
|
|
];
|
|
buildInputs = [ pkgs.qt6Packages.qtkeychain ] ++ qtModules;
|
|
};
|
|
|
|
devShells.default = pkgs.mkShell {
|
|
packages = with pkgs; [
|
|
cmake
|
|
ninja
|
|
pkg-config
|
|
qt6Packages.qtkeychain # password → Keychain (macOS) / libsecret / kwallet
|
|
] ++ qtModules;
|
|
|
|
shellHook = ''
|
|
# Let a binary run straight from the build dir find Qt's platform and
|
|
# image-format plugins without wrapQtAppsHook.
|
|
export QT_PLUGIN_PATH="${qtPlugins}''${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}"
|
|
'';
|
|
};
|
|
});
|
|
}
|