Skip to content

Commit faeb699

Browse files
committed
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.
1 parent f252816 commit faeb699

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ qtox
1616
build-*-Release
1717
build-*-Profile
1818
build-*-Debug
19+
.qtox-wrapped
1920

2021
# Folders
2122
_[Bb]uild*/

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,3 +714,12 @@ target_link_libraries(${PROJECT_NAME}
714714

715715
include(Testing)
716716
include(Installation)
717+
718+
if (DEFINED ENV{IN_NIX_SHELL})
719+
# the qtox binary must be "wrapped" to find the Qt platform plugin
720+
# and other dependencies at runtime
721+
add_custom_command(
722+
TARGET ${PROJECT_NAME}
723+
POST_BUILD
724+
COMMAND nix-shell --run "wrapQtApp ${PROJECT_NAME}")
725+
endif()

shell.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{ pkgs ? import <nixpkgs> { } }:
2+
pkgs.mkShell { inputsFrom = with pkgs; [ qtox ]; }

0 commit comments

Comments
 (0)