Basic package structure

This commit is contained in:
Kiana Sheibani 2023-08-26 03:37:24 -04:00
parent 1987cdaaf8
commit 44c21d95ae
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
9 changed files with 2098 additions and 0 deletions

3
.envrc Normal file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
use flake

1962
Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

5
Cargo.toml Normal file
View file

@ -0,0 +1,5 @@
[workspace]
members = [
"scheme",
"cli"
]

13
cli/Cargo.toml Normal file
View file

@ -0,0 +1,13 @@
[package]
name = "cli"
version = "0.1.0"
edition = "2021"
[dependencies]
scheme.path = "../scheme"
cynic = { version = "3.2", features = ["http-surf"] }
surf = "2"
[build-dependencies]
cynic-codegen = "3.2"

3
cli/src/main.rs Normal file
View file

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}

60
flake.lock Normal file
View file

@ -0,0 +1,60 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1692799911,
"narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1693029596,
"narHash": "sha256-jFSmUmXjxBMNYAC+oC3ZfgeNveGd0cjPdu6SXvzSexE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "203f0a1f3a41e67f2161aa50acff2a76f32a3f91",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

26
flake.nix Normal file
View file

@ -0,0 +1,26 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = inputs@{ self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system; };
in {
packages.ggelo = pkgs.rustPlatform.buildRustPackage {
pname = "ggelo";
version = "0.1.0";
src = ./.;
cargoBuildFlags = "-p cli";
cargoLock.lockFile = ./Cargo.lock;
};
packages.default = self.packages.${system}.ggelo;
devShells.default = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.ggelo ];
packages = [ pkgs.rust-analyzer ];
};
});
}

12
scheme/Cargo.toml Normal file
View file

@ -0,0 +1,12 @@
[package]
name = "scheme"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
cynic = "3.2"
[build-dependencies]
cynic-codegen = "3.2"

14
scheme/src/lib.rs Normal file
View file

@ -0,0 +1,14 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}