diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..4b67419 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1791048980, + "narHash": "sha256-KgItSKML8Xvte0B7/uGnBDsYzSnnKHcOaiUbgWBXLXw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a7868a727837f3c09cee2ce0ca671c76b1589fed", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..2fff04b --- /dev/null +++ b/flake.nix @@ -0,0 +1,29 @@ +{ + description = "Qt6/C++ GUI for TRYX display control on NixOS"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + outputs = + { self, nixpkgs }: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { + inherit system; + }; + in + { + packages.${system} = rec { + tryx-panorama-manager = pkgs.callPackage ./package.nix { }; + default = tryx-panorama-manager; + }; + + apps.${system}.default = { + type = "app"; + program = "${self.packages.${system}.default}/bin/tryx-panorama-manager"; + }; + + overlays.default = final: prev: { + tryx-panorama-manager = final.callPackage ./package.nix { }; + }; + }; +} diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..fa23b1a --- /dev/null +++ b/package.nix @@ -0,0 +1,68 @@ +{ + lib, + stdenv, + qt6, + protobuf, + libusb1, + systemd, + ffmpeg, + pkg-config, +}: + +stdenv.mkDerivation { + pname = "tryx-panorama-manager"; + version = lib.removeSuffix "\n" (builtins.readFile ./VERSION); + + src = lib.cleanSource ./.; + + nativeBuildInputs = [ + qt6.qmake + qt6.qttools + qt6.wrapQtAppsHook + pkg-config + protobuf + ]; + + buildInputs = [ + qt6.qtbase + qt6.qtdeclarative + protobuf + libusb1 + systemd + ]; + + postPatch = '' + substituteInPlace tryx-panorama.pro \ + --replace-fail '$$system(pkg-config --variable=systemduserunitdir systemd)' /usr/lib/systemd/user \ + --replace-fail '$$system(pkg-config --variable=systemduserpresetdir systemd)' /usr/lib/systemd/user-preset + substituteInPlace systemd/tryx-panorama.service \ + --replace-fail /usr/lib/tryx-panorama-manager/tryx-panorama-runtime \ + $out/lib/tryx-panorama-manager/tryx-panorama-runtime + ''; + + qmakeFlags = [ + "tryx-panorama-all.pro" + "CONFIG+=c++20" + "QT_TOOL.lrelease.binary=${lib.getBin qt6.qttools}/bin/lrelease" + ]; + + installFlags = [ "INSTALL_ROOT=$(out)" ]; + + postInstall = '' + cp -a $out/usr/. $out/ + rm -r $out/usr + ''; + + qtWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [ ffmpeg ]}" ]; + postFixup = '' + wrapQtApp $out/lib/tryx-panorama-manager/tryx-panorama-runtime + ''; + + meta = { + description = "Qt6 GUI and runtime for TRYX Panorama cooler displays"; + homepage = "https://github.com/DXVSI/Tryx-Linux-GUI"; + license = lib.licenses.mit; + platforms = [ "x86_64-linux" ]; + mainProgram = "tryx-panorama-manager"; + }; +}