Skip to content

Commit

Permalink
Updated Nix
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Kirk committed Oct 11, 2023
1 parent 0c1bd31 commit dd7be19
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 50 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ target
*.svg
.direnv/
.vscode/
.nixd.json
41 changes: 20 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@
];

forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = import nixpkgs { inherit system; overlays = [ tdengineOverlay ]; };
pkgs = import nixpkgs { inherit system; overlays = [ (import ./overlays) ]; };
inherit system;
});

tdengineOverlay = final: prev: {
tdengine = prev.callPackage ./overlays/tdengine/default.nix {};
};
in
{
devShells = forAllSystems ({ pkgs, system }: {
Expand All @@ -32,7 +28,6 @@
zlib
zstd
rdkafka
tdengine
]) ++ pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs; [ libiconv ]);
};
});
Expand Down
6 changes: 2 additions & 4 deletions overlays/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{ pkgs }: {
default = final: _prev: {
tdengine-client = pkgs.callPackage ./tdengine {pkgs = final;};
};
final: prev: {
tdengine = final.callPackage ./tdengine { nixpkgs = prev; };
}
49 changes: 32 additions & 17 deletions overlays/tdengine/default.nix
Original file line number Diff line number Diff line change
@@ -1,24 +1,39 @@
{
self,
nixpkgs,
stdenv,
fetchFromGitHub
}:rec {
default = stdenv.mkDerivation {
name = "TDengine-client";
version = "3.0.4.2";
}:
stdenv.mkDerivation {
name = "TDengine-client";
version = "3.0.4.2";

src = fetchFromGitHub {
owner = "taosdata";
repo = "TDEngine";
rev = "ver-${default.version}";
hash = "sha256-CMpfaVhq3LOngugxp9POvXIQMjtpgwqP1VoCj2KkfYE=";
};
nativeBuildInputs = with nixpkgs; [
cmake
];

installPhase = ''
sudo make install
'';
src = fetchFromGitHub {
owner = "taosdata";
repo = "TDEngine";
rev = "ver-${self.version}";
hash = "sha256-CMpfaVhq3LOngugxp9POvXIQMjtpgwqP1VoCj2KkfYE=";
};

dontUseCmakeConfigure=true;

nativeBuildInputs = with nixpkgs; [
cjson
lz4
git
cmake
];

buildPhase = ''
mkdir debug
cd debug
cmake .. -DBUILD_TOOLS=false -DBUILD_HTTP=true
ls
make
ls -f
'';

installPhase = ''
make install
'';
}
8 changes: 6 additions & 2 deletions tdengine/src/tdengine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ impl TDEngine {
.build()
.await
.map_err(TDEngineError::TaosBuilder)?;
let stmt = Stmt::init(&client).await.map_err(TDEngineError::TaosBuilder)?;
let frame_stmt = Stmt::init(&client).await.map_err(TDEngineError::TaosBuilder)?;
let stmt = Stmt::init(&client)
.await
.map_err(TDEngineError::TaosBuilder)?;
let frame_stmt = Stmt::init(&client)
.await
.map_err(TDEngineError::TaosBuilder)?;
Ok(TDEngine {
login,
client,
Expand Down

0 comments on commit dd7be19

Please sign in to comment.