From bb5498edef22ef2d2b1ef5c98c1306f2e0de1369 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Thu, 2 Oct 2025 16:38:34 -0400 Subject: [PATCH] feat: add nix flake feat: add nix flake test --- cpp/CMakeLists.txt | 18 ++++++++++++++ flake.lock | 27 ++++++++++++++++++++ flake.nix | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 107 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 38189b8..14cc6a8 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -39,4 +39,22 @@ target_include_directories(logos_sdk PUBLIC # Set output directories for static library set_target_properties(logos_sdk PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" +) + +# Install the library +install(TARGETS logos_sdk + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin +) + +# Install headers +install(FILES + logos_api.h + logos_api_client.h + logos_api_consumer.h + logos_api_provider.h + module_proxy.h + token_manager.h + DESTINATION include ) \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..1c380f7 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1759036355, + "narHash": "sha256-0m27AKv6ka+q270dw48KflE0LwQYrO7Fm4/2//KCVWg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e9f00bd893984bc8ce46c895c3bf7cac95331127", + "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..7a6de24 --- /dev/null +++ b/flake.nix @@ -0,0 +1,62 @@ +{ + description = "Logos C++ SDK"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + outputs = { self, nixpkgs }: + let + systems = [ "aarch64-darwin" "x86_64-darwin" "aarch64-linux" "x86_64-linux" ]; + forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f { + pkgs = import nixpkgs { inherit system; }; + }); + in + { + packages = forAllSystems ({ pkgs }: { + default = pkgs.stdenv.mkDerivation rec { + pname = "logos-cpp-sdk"; + version = "0.1.0"; + + src = ./.; + + + nativeBuildInputs = [ + pkgs.cmake + pkgs.ninja + pkgs.pkg-config + pkgs.qt6.wrapQtAppsNoGuiHook + ]; + buildInputs = [ + pkgs.qt6.qtbase + pkgs.qt6.qtremoteobjects + ]; + + + cmakeFlags = [ "-GNinja" ]; + + configurePhase = '' + cd cpp + cmakeConfigurePhase + ''; + + meta = with pkgs.lib; { + description = "Logos C++ SDK"; + platforms = platforms.unix; + }; + }; + }); + + devShells = forAllSystems ({ pkgs }: { + default = pkgs.mkShell { + nativeBuildInputs = [ + pkgs.cmake + pkgs.ninja + pkgs.pkg-config + ]; + buildInputs = [ + pkgs.qt6.qtbase + pkgs.qt6.qtremoteobjects + ]; + }; + }); + }; +}