From faeb699fd08d7a6bbd648fed0647cc1f06788b4b Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Mon, 16 Dec 2019 06:50:07 +0000 Subject: [PATCH] feat(build): add nix-shell support Add a metadata file and build rules to build and test from a development shell provided by the Nix package manager. --- .gitignore | 1 + CMakeLists.txt | 9 +++++++++ shell.nix | 2 ++ 3 files changed, 12 insertions(+) create mode 100644 shell.nix diff --git a/.gitignore b/.gitignore index 6c788a27c..849e886af 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ qtox build-*-Release build-*-Profile build-*-Debug +.qtox-wrapped # Folders _[Bb]uild*/ diff --git a/CMakeLists.txt b/CMakeLists.txt index f6d9da221..ef2e859bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -714,3 +714,12 @@ target_link_libraries(${PROJECT_NAME} include(Testing) include(Installation) + +if (DEFINED ENV{IN_NIX_SHELL}) + # the qtox binary must be "wrapped" to find the Qt platform plugin + # and other dependencies at runtime + add_custom_command( + TARGET ${PROJECT_NAME} + POST_BUILD + COMMAND nix-shell --run "wrapQtApp ${PROJECT_NAME}") +endif() diff --git a/shell.nix b/shell.nix new file mode 100644 index 000000000..e92364093 --- /dev/null +++ b/shell.nix @@ -0,0 +1,2 @@ +{ pkgs ? import { } }: +pkgs.mkShell { inputsFrom = with pkgs; [ qtox ]; }