diff --git a/.envrc b/.envrc index 826f5a6..7e800ba 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,2 @@ export DATABASE_URL=sqlite://$(pwd)/test.db +use flake diff --git a/.gitignore b/.gitignore index 9b499fb..fbbf1da 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ target **/export/export.json test.db* .env +.direnv diff --git a/Cargo.lock b/Cargo.lock index 47ff1f3..d75879a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3474,6 +3474,10 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "panorama-abi" +version = "0.1.0" + [[package]] name = "panorama-app-sdk" version = "0.1.0" diff --git a/apps/codetrack/Makefile b/apps/codetrack/Makefile new file mode 100644 index 0000000..0f7d0df --- /dev/null +++ b/apps/codetrack/Makefile @@ -0,0 +1,4 @@ +SOURCES := $(shell find -name "*.go") + +main.wasm: $(SOURCES) + GOOS=js GOARCH=wasm go build -o main.wasm diff --git a/apps/codetrack/manifest.yml b/apps/codetrack/manifest.yml index 391b5c6..a0b1411 100644 --- a/apps/codetrack/manifest.yml +++ b/apps/codetrack/manifest.yml @@ -3,6 +3,8 @@ version: 0.1.0 panorama_version: 0.1.0 description: Code tracking app similar to WakaTime +module: ./main.wasm + node_types: - name: heartbeat @@ -25,4 +27,4 @@ endpoints: profiles: release: - module: ./main.wasm \ No newline at end of file + module: ./main.wasm diff --git a/apps/journal/Cargo.toml b/apps/journal/Cargo.toml index 3655ebb..a555b0a 100644 --- a/apps/journal/Cargo.toml +++ b/apps/journal/Cargo.toml @@ -2,7 +2,6 @@ name = "panorama-journal" version = "0.1.0" edition = "2021" -default-target = "wasm32-unknown-unknown" [lib] crate-type = ["cdylib", "rlib"] diff --git a/crates/panorama-core/src/state/apps/manifest.rs b/crates/panorama-core/src/state/apps/manifest.rs index 548e0fc..fee2edc 100644 --- a/crates/panorama-core/src/state/apps/manifest.rs +++ b/crates/panorama-core/src/state/apps/manifest.rs @@ -8,9 +8,11 @@ pub struct AppManifest { pub version: Option, pub panorama_version: Option, pub description: Option, - pub installer_path: PathBuf, + pub module: PathBuf, + #[serde(default)] pub endpoints: Vec, + #[serde(default)] pub triggers: Vec, } diff --git a/crates/panorama-core/src/state/apps/mod.rs b/crates/panorama-core/src/state/apps/mod.rs index a3bc3b5..dc8f673 100644 --- a/crates/panorama-core/src/state/apps/mod.rs +++ b/crates/panorama-core/src/state/apps/mod.rs @@ -75,18 +75,23 @@ impl AppState { let app_path = path.as_ref(); let manifest_path = app_path.join("manifest.yml"); let manifest: AppManifest = { - let file = File::open(manifest_path)?; - serde_yaml::from_reader(file)? + let file = File::open(&manifest_path)?; + serde_yaml::from_reader(file).with_context(|| { + format!( + "Could not parse config file from {}", + manifest_path.display() + ) + })? }; println!("Manifest: {:?}", manifest); - let installer_path = app_path.join(manifest.installer_path); + let module_path = app_path.join(manifest.module); let installer_program = { - let mut file = File::open(&installer_path).with_context(|| { + let mut file = File::open(&module_path).with_context(|| { format!( "Could not open installer from path: {}", - installer_path.display() + module_path.display() ) })?; let mut buf = Vec::new(); diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..caef62e --- /dev/null +++ b/flake.lock @@ -0,0 +1,98 @@ +{ + "nodes": { + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1719469637, + "narHash": "sha256-cOA40mIqjIIf+mCdtuglxdP/0to1LDL1Lkef7vqVykc=", + "owner": "nix-community", + "repo": "fenix", + "rev": "3374c72204714eb979719e77a1856009584ba4d7", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "id": "flake-utils", + "type": "indirect" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1719554759, + "narHash": "sha256-B64IsJMis4A9dePPOKi2T5EEs9AJWfsvkMKSh9/NANs=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "44677ecde6c8a7a7e32f9a2709c316975bf89a60", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "fenix": "fenix", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1719378198, + "narHash": "sha256-c1jWpdPlZyL6/a0pWa30680ivP7nMLNBPuz5hMGoifg=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "b33a0cae335b85e11a700df2d9a7c0006a3b80ec", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, + "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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..65f94ef --- /dev/null +++ b/flake.nix @@ -0,0 +1,42 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs"; + fenix = { + url = "github:nix-community/fenix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, flake-utils, fenix }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ fenix.overlays.default ]; + }; + + toolchain = pkgs.fenix.stable; + + flakePkgs = { + #markout = pkgs.callPackage ./. { inherit toolchain; }; + }; + in rec { + packages = flake-utils.lib.flattenTree flakePkgs; + + devShell = pkgs.mkShell { + inputsFrom = with packages; + [ + #markout + ]; + packages = (with pkgs; [ + cargo-watch + cargo-deny + cargo-edit + corepack + nodejs_20 + sqlx-cli + go + ]) ++ (with toolchain; [ cargo rustc rustfmt clippy ]); + }; + }); +}