summaryrefslogtreecommitdiffstats
path: root/setup
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--setup/Cargo.lock7
-rw-r--r--setup/Cargo.toml6
-rw-r--r--setup/src/main.rs55
3 files changed, 68 insertions, 0 deletions
diff --git a/setup/Cargo.lock b/setup/Cargo.lock
new file mode 100644
index 0000000..5c88354
--- /dev/null
+++ b/setup/Cargo.lock
@@ -0,0 +1,7 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 4
+
+[[package]]
+name = "setup"
+version = "0.1.0"
diff --git a/setup/Cargo.toml b/setup/Cargo.toml
new file mode 100644
index 0000000..bb8f741
--- /dev/null
+++ b/setup/Cargo.toml
@@ -0,0 +1,6 @@
+[package]
+name = "setup"
+version = "0.1.0"
+edition = "2024"
+
+[dependencies]
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);
+ }
+}