Add flake

This commit is contained in:
Michael Zhang 2024-06-28 01:28:52 -05:00
parent 99046dba29
commit 0466b64c5a
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
10 changed files with 166 additions and 8 deletions

1
.envrc
View file

@ -1 +1,2 @@
export DATABASE_URL=sqlite://$(pwd)/test.db export DATABASE_URL=sqlite://$(pwd)/test.db
use flake

1
.gitignore vendored
View file

@ -5,3 +5,4 @@ target
**/export/export.json **/export/export.json
test.db* test.db*
.env .env
.direnv

4
Cargo.lock generated
View file

@ -3474,6 +3474,10 @@ dependencies = [
"tracing-subscriber", "tracing-subscriber",
] ]
[[package]]
name = "panorama-abi"
version = "0.1.0"
[[package]] [[package]]
name = "panorama-app-sdk" name = "panorama-app-sdk"
version = "0.1.0" version = "0.1.0"

4
apps/codetrack/Makefile Normal file
View file

@ -0,0 +1,4 @@
SOURCES := $(shell find -name "*.go")
main.wasm: $(SOURCES)
GOOS=js GOARCH=wasm go build -o main.wasm

View file

@ -3,6 +3,8 @@ version: 0.1.0
panorama_version: 0.1.0 panorama_version: 0.1.0
description: Code tracking app similar to WakaTime description: Code tracking app similar to WakaTime
module: ./main.wasm
node_types: node_types:
- name: heartbeat - name: heartbeat
@ -25,4 +27,4 @@ endpoints:
profiles: profiles:
release: release:
module: ./main.wasm module: ./main.wasm

View file

@ -2,7 +2,6 @@
name = "panorama-journal" name = "panorama-journal"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
default-target = "wasm32-unknown-unknown"
[lib] [lib]
crate-type = ["cdylib", "rlib"] crate-type = ["cdylib", "rlib"]

View file

@ -8,9 +8,11 @@ pub struct AppManifest {
pub version: Option<String>, pub version: Option<String>,
pub panorama_version: Option<String>, pub panorama_version: Option<String>,
pub description: Option<String>, pub description: Option<String>,
pub installer_path: PathBuf, pub module: PathBuf,
#[serde(default)]
pub endpoints: Vec<AppManifestEndpoint>, pub endpoints: Vec<AppManifestEndpoint>,
#[serde(default)]
pub triggers: Vec<AppManifestTriggers>, pub triggers: Vec<AppManifestTriggers>,
} }

View file

@ -75,18 +75,23 @@ impl AppState {
let app_path = path.as_ref(); let app_path = path.as_ref();
let manifest_path = app_path.join("manifest.yml"); let manifest_path = app_path.join("manifest.yml");
let manifest: AppManifest = { let manifest: AppManifest = {
let file = File::open(manifest_path)?; let file = File::open(&manifest_path)?;
serde_yaml::from_reader(file)? serde_yaml::from_reader(file).with_context(|| {
format!(
"Could not parse config file from {}",
manifest_path.display()
)
})?
}; };
println!("Manifest: {:?}", manifest); println!("Manifest: {:?}", manifest);
let installer_path = app_path.join(manifest.installer_path); let module_path = app_path.join(manifest.module);
let installer_program = { let installer_program = {
let mut file = File::open(&installer_path).with_context(|| { let mut file = File::open(&module_path).with_context(|| {
format!( format!(
"Could not open installer from path: {}", "Could not open installer from path: {}",
installer_path.display() module_path.display()
) )
})?; })?;
let mut buf = Vec::new(); let mut buf = Vec::new();

98
flake.lock Normal file
View file

@ -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
}

42
flake.nix Normal file
View file

@ -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 ]);
};
});
}