From 59af60394e4483a89f3cfaa91698a9fae17e6e59 Mon Sep 17 00:00:00 2001 From: Alice Carroll Date: Sun, 13 Oct 2024 20:19:44 +0300 Subject: [PATCH] feat: add trieve-cli --- flake.nix | 3 ++- packages/cli.nix | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 packages/cli.nix diff --git a/flake.nix b/flake.nix index 9692beb..109ba99 100644 --- a/flake.nix +++ b/flake.nix @@ -41,7 +41,6 @@ perSystem = { pkgs, - lib, self', ... }: @@ -49,6 +48,8 @@ craneLib = crane.mkLib pkgs; in { + packages.default = self'.packages.cli; + packages.cli = pkgs.callPackage ./packages/cli.nix { inherit craneLib; }; packages.server = pkgs.callPackage ./packages/server { inherit craneLib; }; packages.frontends = pkgs.callPackage ./packages/frontends { }; }; diff --git a/packages/cli.nix b/packages/cli.nix new file mode 100644 index 0000000..294ba7d --- /dev/null +++ b/packages/cli.nix @@ -0,0 +1,33 @@ +{ + craneLib, + fetchFromGitHub, + darwin, + stdenv, + lib, + libiconv, +}: +let + commonArgs = rec { + pname = "trieve-cli"; + version = "0.5.3"; + src = fetchFromGitHub { + owner = "devflowinc"; + repo = pname; + rev = "d4c897c92902999331a23198dc22be3f20683a52"; + hash = "sha256-+O4F9vTqYg4Eju0RBIyQ6aIw8Wb33bchSygUpunfFBs="; + }; + strictDeps = true; + buildInputs = lib.optionals stdenv.isDarwin ( + with darwin.apple_sdk.frameworks; + [ + SystemConfiguration + libiconv + ] + ); + }; + cargoArtifacts = craneLib.buildDepsOnly commonArgs; + totalArgs = commonArgs // { + inherit cargoArtifacts; + }; +in +craneLib.buildPackage (totalArgs // { meta.mainProgram = "trieve"; })