cargo, nix flake and licenses

master
Niko PLP 1 year ago
parent c62334edeb
commit 53ae2db364
  1. 2039
      Cargo.lock
  2. 10
      Cargo.toml
  3. 22
      LICENSE
  4. 16
      LICENSE-APACHE2
  5. 22
      LICENSE-MIT
  6. 89
      README.md
  7. 94
      flake.lock
  8. 107
      flake.nix
  9. 20
      p2p-stores-lmdb/Cargo.toml

2039
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -0,0 +1,10 @@
[workspace]
members = [
"p2p-repo",
"p2p-net",
"p2p-broker",
"p2p-client",
"p2p-stores-lmdb",
"ngcli",
"ngd",
]

@ -1,21 +1 @@
MIT License
Copyright (c) 2022 NextGraph.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT OR Apache-2.0

@ -0,0 +1,16 @@
Apache 2.0 License
Copyright (c) 2022-2023 Niko Bonnieure, Par le Peuple, NextGraph.org developers
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

@ -0,0 +1,22 @@
MIT License
Copyright (c) 2022-2023 Niko Bonnieure, Par le Peuple, NextGraph.org developers
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -9,6 +9,95 @@ This repository is in active development at [https://git.nextgraph.org/NextGraph
> NextGraph brings about the convergence between P2P and Semantic Web technologies, towards a decentralized, secure and privacy-preserving cloud, based on CRDTs.
>
> This open source ecosystem provides solutions for end-users and software developers alike, wishing to use or create **decentralized** apps featuring: **live collaboration** on rich-text documents, peer to peer communication with end-to-end encryption, offline-first, **local-first**, portable and interoperable data, total ownership of data and software, security and privacy. Centered on repositories containing **semantic data** (RDF), **rich text**, and structured data formats like **JSON**, synced between peers belonging to permissioned groups of users, it offers strong eventual consistency, thanks to the use of **CRDTs**. Documents can be linked together, signed, shared securely, queried using the **SPARQL** language and organized into sites and containers.
>
> More info here [https://nextgraph.org](https://nextgraph.org)
## Support
Documentation can be found here [https://docs.nextgraph.org](https://docs.nextgraph.org)
And our community forum where you can ask questions is here [https://forum.nextgraph.org](https://forum.nextgraph.org)
## How to use NextGraph
NextGraph is not ready yet. You can subscribe to [our newsletter](https://list.nextgraph.org/subscription/form) to get updates, and support us with a [donation](https://nextgraph.org/donate/).
## For developers
Read our [getting started guide](https://docs.nextgraph.org/en/getting-started/).
## For contributors
- [Install Rust](https://www.rust-lang.org/tools/install)
- Install the [Nix package manager](https://nixos.org/download.html)
- and [Nix Flakes](https://nixos.wiki/wiki/Flakes)
```
git clone git@git.nextgraph.org:NextGraph/nextgraph-rs.git
cd nextgraph-rs
nix develop
cargo build
```
### Run
Build & run executables:
```
cargo run --bin ngd // runs the daemon
cargo run --bin ngcli // runs the client
```
### Test
Test all:
```
cargo test --all --verbose -- --nocapture
```
Test a single module:
```
cargo test --package p2p-repo --lib -- branch::test --nocapture
```
### Build a package
Build the default package (`.#ngd`):
```
nix build
```
Bulid a specific package:
```
nix build '.#ngcli'
```
### Generate documentation
Generate documentation for all packages without their dependencies:
```
cargo doc --no-deps
```
The generated documentation can be found in `target/doc/<crate-name>`.
### Contributions license
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you shall be dual licensed as below, without any
additional terms or conditions.
## License
Licensed under either of
* Apache License, Version 2.0 ([LICENSE-APACHE2](LICENSE-APACHE2) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
`SPDX-License-Identifier: Apache-2.0 OR MIT`
---

@ -0,0 +1,94 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1672580127,
"narHash": "sha256-3lW3xZslREhJogoOkjeZtlBtvFMyxHku7I/9IVehhT8=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "0874168639713f547c05947c76124f78441ea46c",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-22.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1665296151,
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "14ccaaedd95a488dd7ae142757884d8e125b3363",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay",
"utils": "utils"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1677465082,
"narHash": "sha256-b82PmPWkt0pAsxmc477Yowq1Ez1VyjA5wnxE+yoIOWg=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "2924bfce2fadc1ded4a2b8cfce7f2fd4ef41c36f",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"utils": {
"locked": {
"lastModified": 1676283394,
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

@ -0,0 +1,107 @@
{
description = "NextGraph";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
inputs.utils.url = "github:numtide/flake-utils";
inputs.rust-overlay.url = "github:oxalica/rust-overlay";
outputs = {
self,
nixpkgs,
utils,
rust-overlay,
}:
utils.lib.eachDefaultSystem (system: let
overlays = [
(import rust-overlay)
];
pkgs = import nixpkgs rec {
inherit system overlays;
};
rust = pkgs.rust-bin.stable."1.67.1".default.override {
extensions = ["rust-src"];
};
buildRustPackage =
(pkgs.makeRustPlatform {
cargo = rust;
rustc = rust;
})
.buildRustPackage;
myNativeBuildInputs = with pkgs;
[
pkgconfig
]
++ lib.optionals stdenv.isLinux
(with pkgs; [
cargo-kcov
]);
myBuildInputs = with pkgs;
[
openssl
]
++ lib.optionals stdenv.isDarwin
(with darwin.apple_sdk.frameworks; [
Security
]);
myBuildRustPackage = attrs:
buildRustPackage ({
version = "0.1.0";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"lmdb-crypto-rs-0.14.0" = "sha256-HKbDK9jKPwYhPytdxnfwCFmve88Voy+cGZM2pt6xUjs=";
"rkv-0.18.0" = "sha256-5+CU7z6FCUI2N8amMMaa2VBLI/LVQiRPaWA1Wkz6Q5A=";
};
};
nativeBuildInputs = myNativeBuildInputs;
buildInputs = myBuildInputs;
RUST_BACKTRACE = 1;
}
// attrs);
in rec {
packages = rec {
p2p-repo = myBuildRustPackage rec {
pname = "p2p-repo";
buildAndTestSubdir = "./p2p-repo";
};
p2p-net = myBuildRustPackage rec {
pname = "p2p-net";
buildAndTestSubdir = "./p2p-net";
};
p2p-broker = myBuildRustPackage rec {
pname = "p2p-broker";
buildAndTestSubdir = "./p2p-broker";
};
p2p-client = myBuildRustPackage rec {
pname = "p2p-client";
buildAndTestSubdir = "./p2p-client";
};
p2p-stores-lmdb = myBuildRustPackage rec {
pname = "stores-lmdb";
buildAndTestSubdir = "./stores-lmdb";
};
ngcli = myBuildRustPackage rec {
pname = "ngcli";
buildAndTestSubdir = "./ngcli";
};
ngd = myBuildRustPackage rec {
pname = "ngd";
buildAndTestSubdir = "./ngd";
};
default = ngd;
};
apps = rec {
ngd = utils.lib.mkApp {
drv = packages.ngd;
exePath = "/bin/ngd";
};
ngcli = utils.lib.mkApp {
drv = packages.ngcli;
exePath = "/bin/ngcli";
};
default = ngd;
};
});
}

@ -0,0 +1,20 @@
[package]
name = "p2p-stores-lmdb"
version = "0.1.0"
edition = "2021"
license = "MIT/Apache-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
p2p-repo = { path = "../p2p-repo" }
debug_print = "1.0.0"
serde = { version = "1.0.142", features = ["derive"] }
serde_bare = "0.5.0"
tempfile = "3"
hex = "0.4.3"
[dependencies.rkv]
git = "https://git.nextgraph.org/NextGraph/rkv.git"
rev = "f04b03957b52ebc802e58438f430cd569e55a24d"
features = [ "lmdb" ]
Loading…
Cancel
Save