From 7d93354c1e425e9d7a56e602bdff138c35d314b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marijan=20Petri=C4=8Devi=C4=87?= Date: Tue, 9 Jan 2024 15:21:30 +0100 Subject: [PATCH] create cargo workspace --- .github/workflows/check.yml | 2 +- kairos-node/Cargo.lock => Cargo.lock | 2 +- Cargo.toml | 11 +++++++++++ flake.nix | 20 ++++++++++---------- {kairos-node => kairos-cli}/Cargo.toml | 9 ++++++++- {kairos-node/src => kairos-cli/bin}/main.rs | 0 6 files changed, 31 insertions(+), 13 deletions(-) rename kairos-node/Cargo.lock => Cargo.lock (86%) create mode 100644 Cargo.toml rename {kairos-node => kairos-cli}/Cargo.toml (58%) rename {kairos-node/src => kairos-cli/bin}/main.rs (100%) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 5d0d971e..dd69d256 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -23,7 +23,7 @@ jobs: run: nix flake check -L --show-trace - name: kairos-node - run: nix build -L --no-link --show-trace .#packages.x86_64-linux.kairos-node + run: nix build -L --no-link --show-trace .#packages.x86_64-linux.kairos - name: kairos-prover run: nix build -L --no-link --show-trace .#packages.x86_64-linux.kairos-prover diff --git a/kairos-node/Cargo.lock b/Cargo.lock similarity index 86% rename from kairos-node/Cargo.lock rename to Cargo.lock index 297980db..7735db8e 100644 --- a/kairos-node/Cargo.lock +++ b/Cargo.lock @@ -3,5 +3,5 @@ version = 3 [[package]] -name = "kairos-node" +name = "kairos-cli" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 00000000..7c95bfc0 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,11 @@ +[workspace] +resolver = "2" + +members = [ + "kairos-cli", +] + +[workspace.package] +name = "kairos" +version = "0.1.0" +edition = "2021" diff --git a/flake.nix b/flake.nix index 8b359c1a..08d5cc74 100644 --- a/flake.nix +++ b/flake.nix @@ -41,7 +41,7 @@ kairosNodeAttrs = { src = lib.cleanSourceWith { - src = craneLib.path ./kairos-node; + src = craneLib.path ./.; filter = path: type: craneLib.filterCargoSources path type; }; nativeBuildInputs = with pkgs; [ pkg-config openssl.dev ]; @@ -58,29 +58,29 @@ }; packages = { - kairos-node-deps = craneLib.buildDepsOnly (kairosNodeAttrs // { - pname = "kairos-node"; + kairos-deps = craneLib.buildDepsOnly (kairosNodeAttrs // { + pname = "kairos"; }); - kairos-node = craneLib.buildPackage (kairosNodeAttrs // { - cargoArtifacts = self'.packages.kairos-node-deps; + kairos = craneLib.buildPackage (kairosNodeAttrs // { + cargoArtifacts = self'.packages.kairos-deps; }); - default = self'.packages.kairos-node; + default = self'.packages.kairos; - kairos-node-docs = craneLib.cargoDoc (kairosNodeAttrs // { - cargoArtifacts = self'.packages.kairos-node-deps; + kairos-docs = craneLib.cargoDoc (kairosNodeAttrs // { + cargoArtifacts = self'.packages.kairos-deps; }); }; checks = { lint = craneLib.cargoClippy (kairosNodeAttrs // { - cargoArtifacts = self'.packages.kairos-node-deps; + cargoArtifacts = self'.packages.kairos-deps; cargoClippyExtraArgs = "--all-targets -- --deny warnings"; }); coverage-report = craneLib.cargoTarpaulin (kairosNodeAttrs // { - cargoArtifacts = self'.packages.kairos-node-deps; + cargoArtifacts = self'.packages.kairos-deps; }); audit = craneLib.cargoAudit { diff --git a/kairos-node/Cargo.toml b/kairos-cli/Cargo.toml similarity index 58% rename from kairos-node/Cargo.toml rename to kairos-cli/Cargo.toml index fdd51c5c..4a864138 100644 --- a/kairos-node/Cargo.toml +++ b/kairos-cli/Cargo.toml @@ -1,5 +1,12 @@ +[[bin]] +name = "kairos-cli" +path = "bin/main.rs" +version = "0.1.0" +test = false +bench = false + [package] -name = "kairos-node" +name = "kairos-cli" version = "0.1.0" edition = "2021" diff --git a/kairos-node/src/main.rs b/kairos-cli/bin/main.rs similarity index 100% rename from kairos-node/src/main.rs rename to kairos-cli/bin/main.rs