Files

56 lines
2.0 KiB
Nix
Raw Permalink Normal View History

2026-08-26 00:28:35 +02:00
{
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; };
2026-09-26 10:44:23 +02:00
inherit (pkgs) lib stdenv;
2026-08-26 00:28:35 +02:00
2026-09-26 10:44:23 +02:00
# 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;
2026-08-26 00:28:35 +02:00
in {
# Installable build: `nix profile install ./desktop` drops "Photog" into
# the application menu with its icon. wrapQtAppsHook wraps the binary so
2026-09-26 10:44:23 +02:00
# 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
];
2026-09-26 10:44:23 +02:00
buildInputs = [ pkgs.qt6Packages.qtkeychain ] ++ qtModules;
2026-09-26 10:51:39 +02:00
meta.mainProgram = "photog";
};
2026-08-26 00:28:35 +02:00
devShells.default = pkgs.mkShell {
packages = with pkgs; [
cmake
ninja
pkg-config
2026-09-26 10:44:23 +02:00
qt6Packages.qtkeychain # password → Keychain (macOS) / libsecret / kwallet
] ++ qtModules;
2026-08-26 00:28:35 +02:00
shellHook = ''
2026-09-26 10:44:23 +02:00
# Let a binary run straight from the build dir find Qt's platform and
# image-format plugins without wrapQtAppsHook.
2026-08-26 00:28:35 +02:00
export QT_PLUGIN_PATH="${qtPlugins}''${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}"
'';
};
});
}