New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding TypeDB #125350
Closed
Closed
Adding TypeDB #125350
Changes from 15 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
58af248
typedb: init at 2.1.1
haskie-lambda f4bb177
maintainers: add haskie
haskie-lambda 1ce0419
typedb: add typedb to all-packages and completed install/patch procedure
haskie-lambda 68151ee
Merge branch 'NixOS:master' into master
haskie-lambda 985789b
typedb: added test
haskie-lambda 5f86c9e
typedb: moved tests to installCheckPhase as discussed in https://www.…
haskie-lambda 4d786b4
Merge branch 'NixOS:master' into master
haskie-lambda 05b06cf
typedb: using fetchurl instead of fetchTarball now
haskie-lambda a93b019
typedb: merge remote-tracking branch 'upstream/master'
haskie-lambda 4cab489
typedb: changed implementation to suggestions by roberth
haskie-lambda 46058a2
typedb: Merge remote-tracking branch 'upstream/master'
haskie-lambda 4e28da1
implemented fix suggested by roberth
haskie-lambda ddd56f8
typedb: merge remote-tracking branch 'upstream/master'
haskie-lambda b4d3ebb
typedb: merge remote-tracking branch 'upstream/master'
haskie-lambda 9e9146a
typedb: added wrapper script again to supply options as variables
haskie-lambda 16a0318
typedb: fixed install- and installCheck-phase
haskie-lambda 6de79fa
typedb: merge remote-tracking branch 'upstream/master'
haskie-lambda 092a461
typedb: removed unneccessary file
haskie-lambda c25bc44
typedb: reformatted using `nixpkgs-fmt`
haskie-lambda 80a7680
typedb: removed trailing whitespace
haskie-lambda 6a0830e
typedb: added passthrough tests
haskie-lambda a774de5
typedb: updated hash of darwin sources
haskie-lambda 6953e98
typedb: merge remote-tracking branch 'upstream/master'
haskie-lambda 4fa8793
typedb: Merge branch 'NixOS:master' into master
haskie-lambda File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,113 @@ | ||||||
{ stdenv, lib, openjdk, system, fetchzip, fetchurl, server-data ? "~/.typedb_home", server-port ? "1729", server-logs ? "~/.typedb_home/logs" }: | ||||||
let | ||||||
typedbVersion = "2.1.1"; | ||||||
systems = { | ||||||
x86_64-linux = { | ||||||
src = fetchurl { | ||||||
url = "https://github.com/vaticle/typedb/releases/download/2.1.1/typedb-all-linux-2.1.1.tar.gz"; | ||||||
sha256 = "00wvkiahmrys32ckp6r59bbrzfd7jzsphniyjdj4p9bh7k339gn2"; | ||||||
}; | ||||||
dir = "typedb-all-linux-${typedbVersion}"; | ||||||
}; | ||||||
x86_64-darwin = { | ||||||
src = fetchzip { | ||||||
url = "https://github.com/vaticle/typedb/releases/download/2.1.1/typedb-all-mac-2.1.1.zip"; | ||||||
sha256 = "16hlfy6kh2rnvcralz206q13mghb0rv8wazpg6q3h324p5rdys54"; | ||||||
}; | ||||||
dir = "typedb-all-mac-${typedbVersion}"; | ||||||
}; | ||||||
x86_64-windows = { | ||||||
src = fetchzip { | ||||||
url = "https://github.com/vaticle/typedb/releases/download/2.1.1/typedb-all-windows-2.1.1.zip"; | ||||||
sha256 = "0vd66gfshkg697z07nhy957mwqzlli4r4pmn67hx58n9mkg024kq"; | ||||||
}; | ||||||
dir = "typedb-all-windows-${typedbVersion}"; | ||||||
}; | ||||||
}; | ||||||
|
||||||
currentSystem = systems.${system} or (throw "unsupported system ${system}"); | ||||||
typedbDir = currentSystem.dir; | ||||||
srcFolder = currentSystem.src; | ||||||
javaPatch = '' | ||||||
20c20 | ||||||
< JAVA_BIN=java | ||||||
--- | ||||||
> JAVA_BIN=${openjdk}/bin/java | ||||||
''; | ||||||
typedb-properties-patch = '' | ||||||
19c19 | ||||||
< server.data=server/data/ | ||||||
--- | ||||||
> server.data=${server-data} | ||||||
22c22 | ||||||
< server.logs=server/logs/ | ||||||
--- | ||||||
> server.logs=${server-logs} | ||||||
24c24 | ||||||
< server.port=1729 | ||||||
--- | ||||||
> server.port=${server-port} | ||||||
''; | ||||||
typedbWrapper = '' | ||||||
[ -z "$TYPEDB_SERVER_DATA" ] && $TYPEDB_SERVER_DATA="${server-data}" | ||||||
[ -z "$TYPEDB_SERVER_LOGS" ] && $TYPEDB_SERVER_LOGS="${server-logs}" | ||||||
[ -z "$TYPEDB_SERVER_PORT" ] && $TYPEDB_SERVER_PORT="${server-port}" | ||||||
|
||||||
../typedb server --data $TYPEDB_SERVER_DATA --logs $TYPEDB_SERVER_LOGS --port $TYPEDB_SERVER_PORT | ||||||
''; | ||||||
|
||||||
in | ||||||
stdenv.mkDerivation rec { | ||||||
pname = "typedb"; | ||||||
version = typedbVersion; | ||||||
|
||||||
src = srcFolder; | ||||||
|
||||||
dontBuild = true; | ||||||
#phases = [unpackPhase installPhase installCheckPhase]; | ||||||
unpackPhase = '' | ||||||
haskie-lambda marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
echo "here" | ||||||
ls | ||||||
echo "here2" | ||||||
if [[ "${system}" -eq "x86_64-linux" ]]; then | ||||||
tar -xf typedb-all-linux-2.1.1.tar.gz | ||||||
fi # the rest is already unpacked by fetchzip | ||||||
''; | ||||||
|
||||||
installPhase = '' | ||||||
#patch before install | ||||||
echo "${javaPatch}" > typedb_java.patch | ||||||
# echo "${typedb-properties-patch}" > typedb-properties.patch | ||||||
|
||||||
patch ./typedb typedb_java.patch | ||||||
patch ./server/conf/typedb.properties typedb-properties.patch | ||||||
mkdir $out | ||||||
cp -r ./* $out | ||||||
mkdir $out/bin | ||||||
|
||||||
echo "${typedbWrapper}" > $out/bin/typedb | ||||||
|
||||||
''; | ||||||
|
||||||
doInstallCheck = true; | ||||||
installCheckPhase = '' | ||||||
#$out/typedb --help > /dev/null | ||||||
#res=`$out/typedb client` | ||||||
#echo "--" | ||||||
#echo $res | ||||||
''; | ||||||
doCheck = true; | ||||||
|
||||||
meta = with lib; { | ||||||
description = "A distributed knowledge graph, a logical database to organise large and complex networks of data as one body of knowledge"; | ||||||
longDescription = '' | ||||||
TypeDB is a distributed knowledge graph: a logical database to organise large and complex networks of data as one body of knowledge. | ||||||
TypeDB provides the knowledge engineering tools for developers to easily leverage the power of Knowledge Representation and Automated | ||||||
Reasoning when building complex systems. Ultimately, TypeDB serves as the knowledge-base foundation for intelligent systems. | ||||||
''; | ||||||
homepage = "https://www.grakn.ai/"; | ||||||
license = licenses.gpl3Plus; | ||||||
platforms = lib.attrNames systems; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
maintainers = [ maintainers.haskie ]; | ||||||
}; | ||||||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While it's already much better, this is still a bit awkward. Ideally changes in configuration would not require a rebuild.
If we're lucky, we might still be able to use an environment variable instead of hardcoding it into the store path, although that's not the default property file behavior.
Somewhat relevant discussion https://stackoverflow.com/questions/2263929/regarding-application-properties-file-and-environment-variable. If it's built on apache commons, we're lucky.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to specify properties or property files at runtime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to the typedb team not;
only at startup as a cli option or in the config file;
I decided to add a wrapper script again that makes it possible to change the three configuration options via environment variables.
at least until I am able to change the implementation of the property file reader in the typedb.
I am still debugging it, but at least it builds and the tests run fine now;
there are still some issues though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The config file is not really a config file if it's packaged immutably with the software, so cli options are probably the easiest option. Do you plan to write a NixOS service as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't think about this before;
but I could actually do that, have to read up on that though ^^