summary refs log tree commit diff stats
path: root/setup/src
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-03-19 07:45:14 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-03-19 07:45:14 +0100
commitf6a3fb9c4d8dd86f78c9f75a23c1ac35bf35d4eb (patch)
tree5f28fbca03d83921b568f7cb1708374456d9ec42 /setup/src
parentfeat(treewide): Add further buttons (diff)
downloadweb-client-f6a3fb9c4d8dd86f78c9f75a23c1ac35bf35d4eb.zip
feat(treewide): Commit MVP
Diffstat (limited to 'setup/src')
-rw-r--r--setup/src/main.rs55
1 files changed, 55 insertions, 0 deletions
diff --git a/setup/src/main.rs b/setup/src/main.rs
new file mode 100644
index 0000000..90bd23d
--- /dev/null
+++ b/setup/src/main.rs
@@ -0,0 +1,55 @@
+use std::{
+    process::{Child, Command},
+    thread::sleep,
+    time::Duration,
+};
+
+struct Processes {
+    inner: Vec<Child>,
+}
+
+fn main() {
+    let mut processes = Processes { inner: vec![] };
+
+    processes.spawn_in_terminal(&[
+        "bash",
+        "-c",
+        "(cd ../rocie-server && eval \"$(direnv export bash 2>/dev/null)\" && bash -c 'cargo run --package rocie-server -- serve --port 8080')"
+    ]);
+    processes.spawn_in_terminal(&[
+        "bash",
+        "-c",
+        "trunk serve --proxy-backend=http://localhost:8080/ --proxy-rewrite=/api/",
+    ]);
+    processes.spawn_in_terminal(&[
+        "bash",
+        "-c",
+        "nix run n#floorp-bin -- http://localhost:3000",
+    ]);
+
+    loop {
+        sleep(Duration::from_secs(2 * 60 * 60));
+    }
+}
+
+impl Drop for Processes {
+    fn drop(&mut self) {
+        for process in &mut self.inner {
+            process.kill().unwrap();
+        }
+    }
+}
+
+impl Processes {
+    fn spawn_in_terminal(&mut self, args: &[&str]) {
+        let mut alacritty = Command::new("alacritty");
+        alacritty.arg("--hold");
+        alacritty.arg("--command");
+        alacritty.args(args);
+
+        eprintln!("Spawning `{:?}`", alacritty);
+
+        let new_child = alacritty.spawn().unwrap();
+        self.inner.push(new_child);
+    }
+}