diff --git a/flake.nix b/flake.nix index 559e3bd..57d5e94 100644 --- a/flake.nix +++ b/flake.nix @@ -80,6 +80,24 @@ ); }; + packages = forEachSupportedSystem ( + { pkgs }: + { + default = pkgs.rustPlatform.buildRustPackage { + pname = "fil"; + version = "0.1.0"; + src = ./.; + cargoLock.lockFile = ./Cargo.lock; + cargoLock.outputHashes = { + "egui_graphs-0.30.0" = "sha256-mJuGENPnDeD8SDNBXZZpLwcqrKlLTxuM6yCCx+1dSko="; + }; + + nativeBuildInputs = [ pkgs.pkg-config ]; + buildInputs = [ pkgs.openssl ]; + }; + } + ); + devShells = forEachSupportedSystem ( { pkgs }: { diff --git a/src/tui/components/zk/mod.rs b/src/tui/components/zk/mod.rs index 19df416..edaf3de 100644 --- a/src/tui/components/zk/mod.rs +++ b/src/tui/components/zk/mod.rs @@ -59,12 +59,13 @@ impl Default for Layouts { impl Zk<'_> { pub async fn new(kh: KastenHandle) -> Result { let kt = kh.read().await; + let ws = kt.ws.clone(); let fetch_all = async || -> Result> { Ok(ZettelEntity::load() .with(TagEntity) .order_by_desc(ZettelColumns::ModifiedAt) - .all(&kt.ws.db) + .all(&ws.db) .await? .into_iter() .map(Into::into) @@ -73,9 +74,10 @@ impl Zk<'_> { let mut zettels: Vec = fetch_all().await?; + drop(kt); if zettels.is_empty() { - // we should have a welcome zettel - Zettel::new("Welcome!", &kt.ws).await?; + let z = Zettel::new("Welcome!", &ws).await?; + kh.write().await.process_path(&z.absolute_path(&ws)).await?; zettels = fetch_all().await?; } @@ -96,6 +98,8 @@ impl Zk<'_> { // so technically this might not exist .expect("There must always be one atleast one zettel"); + let kt = kh.read().await; + let zettel = kt .get_node_by_zettel_id(selected_zettel) .expect("")