added AGENTS.md
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -22,3 +22,6 @@
|
|||||||
[submodule "src/doom"]
|
[submodule "src/doom"]
|
||||||
path = src/doom
|
path = src/doom
|
||||||
url = https://github.com/doomemacs/core
|
url = https://github.com/doomemacs/core
|
||||||
|
[submodule "src/vicinae"]
|
||||||
|
path = src/vicinae
|
||||||
|
url = git@github.com:ppc-social/vicinae.git
|
||||||
|
|||||||
12
AGENTS.md
Normal file
12
AGENTS.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
# c2vi's dotfiles monorepo
|
||||||
|
this is c2vi's dotfiles repo and also monorepo where projects of active development are kept as submodules.
|
||||||
|
|
||||||
|
if you hear anything about parts refer to `mize/docs/part-system.md` for how Mize parts work.
|
||||||
|
|
||||||
|
also anything which adds new functionality should be made as a mize part, where possible.
|
||||||
|
make a new one in `./parts` using the following naming schema for the folder `c2vi.vibed.<name-of-part>` or expand an existing part. (but ask the user before doing that)
|
||||||
|
|
||||||
|
ask before making changes to anything which is outside of `./parts/c2vi.vibed.*`.
|
||||||
|
|
||||||
|
when developing a new part. present it's config options and methods to the human first.
|
||||||
@@ -384,11 +384,11 @@ output "HDMI-A-1" {
|
|||||||
|
|
||||||
|
|
||||||
### Key bindings
|
### Key bindings
|
||||||
# ppc ne
|
# sci ne
|
||||||
bindsym F12 exec ppc ne
|
bindsym F12 exec mize run sci ne
|
||||||
bindsym F11 exec ppc ne -b
|
bindsym F11 exec mize run sci ne -b
|
||||||
bindsym XF86AudioRaiseVolume exec ppc ne
|
bindsym XF86AudioRaiseVolume exec mize run sci ne
|
||||||
bindsym XF86AudioLowerVolume exec ppc ne -b
|
bindsym XF86AudioLowerVolume exec mize run sci ne -b
|
||||||
|
|
||||||
# QuickLaunch
|
# QuickLaunch
|
||||||
bindsym $mod+i mode "QuickLaunch"
|
bindsym $mod+i mode "QuickLaunch"
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
|
|
||||||
name = "c2vi"
|
|
||||||
@@ -1,771 +0,0 @@
|
|||||||
#![feature(oneshot_channel)]
|
|
||||||
|
|
||||||
use std::fs;
|
|
||||||
use std::fs::OpenOptions;
|
|
||||||
use std::io::BufReader;
|
|
||||||
use std::io::Read;
|
|
||||||
use std::io::Write;
|
|
||||||
use std::sync::oneshot;
|
|
||||||
use std::thread;
|
|
||||||
use std::time::Duration;
|
|
||||||
use chrono::TimeDelta;
|
|
||||||
use clap::ArgAction;
|
|
||||||
use marts::generated::spacetime::RemoteProcedures;
|
|
||||||
use marts::generated::spacetime::export_timetrack;
|
|
||||||
|
|
||||||
use chrono::Local;
|
|
||||||
use marts::generated::spacetime::first_timetrack_date;
|
|
||||||
use marts::timetrack;
|
|
||||||
use marts::generated::spacetime::add_thought;
|
|
||||||
use tracing::info;
|
|
||||||
use ciborium::Value;
|
|
||||||
use clap::Arg;
|
|
||||||
use clap::ArgMatches;
|
|
||||||
use clap::Command;
|
|
||||||
use cmd_lib::run_cmd as sh;
|
|
||||||
use cmd_lib::run_fun as shc;
|
|
||||||
use dioxus::html::g::format;
|
|
||||||
use indoc::concatdoc as str;
|
|
||||||
use marts::CliPart;
|
|
||||||
use marts::ClientAuth;
|
|
||||||
use mize::Mize;
|
|
||||||
use mize::MizeError;
|
|
||||||
use mize::MizePart;
|
|
||||||
use mize::MizePartCreate;
|
|
||||||
use mize::MizeResult;
|
|
||||||
use mize::data;
|
|
||||||
use mize::item::{IntoItemData, ItemData};
|
|
||||||
use mize::mize_err;
|
|
||||||
use mize::mize_part;
|
|
||||||
use mize::prelude::*;
|
|
||||||
use mize::proto::MessageCmd;
|
|
||||||
use mize::proto::MizeMessage;
|
|
||||||
|
|
||||||
static MIZE_SRC: &str = "/home/me/work/config/mize";
|
|
||||||
static SRC: &str = "/home/me/work/config";
|
|
||||||
static RSYNC_EXCLUDES: &str = "--exclude=node_modules --exclude=target --exclude=mize_config.toml --exclude=rust_dist --exclude=deno_dist --exclude=dist --exclude=result --exclude=pkg";
|
|
||||||
|
|
||||||
pub fn lush_os_main() -> MizeResult<()> {
|
|
||||||
println!("main on lush...");
|
|
||||||
|
|
||||||
let mut config = ItemData::from_cbor(data! {
|
|
||||||
//spacetime.url = ""
|
|
||||||
});
|
|
||||||
config.set_path("store", "/home/me/host/mize")?;
|
|
||||||
config.set_path("data_dir", "/home/me/host/mize/misc")?;
|
|
||||||
config.set_path("log.level", "debug")?;
|
|
||||||
config.set_path("log.stderr.enable", true)?;
|
|
||||||
config.set_path("cli.daemonMode", true)?;
|
|
||||||
config.set_path("c2vi.dash.enable", true)?;
|
|
||||||
config.set_path("auth.client.refresh_thread", true)?;
|
|
||||||
|
|
||||||
let mut mize = mize::Mize::with_config(config)?;
|
|
||||||
|
|
||||||
marts::cli(&mut mize)?;
|
|
||||||
marts::part_client_auth(&mut mize)?;
|
|
||||||
|
|
||||||
marts::spacetime(&mut mize)?;
|
|
||||||
marts::timetrack::timetrack(&mut mize)?;
|
|
||||||
|
|
||||||
marts::part_c2vi(&mut mize)?;
|
|
||||||
|
|
||||||
mize.run()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn remote_deploy(matches: &ArgMatches, _: Mize, hostname: &str) -> MizeResult<()> {
|
|
||||||
unsafe {
|
|
||||||
/*
|
|
||||||
std::env::set_var(
|
|
||||||
"PATH",
|
|
||||||
"/home/me/work/path-extra/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/home/me/.local/state/nix/profile/bin:/home/me/.nix-profile/bin",
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
std::env::set_var("SRC", SRC);
|
|
||||||
std::env::set_var("HOSTNAME", hostname);
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut do_mize_restart = false;
|
|
||||||
|
|
||||||
let bin = match matches.get_one::<String>("bin") {
|
|
||||||
Some(val) => val.to_owned(),
|
|
||||||
None => {
|
|
||||||
do_mize_restart = true;
|
|
||||||
format!("{}-os", hostname)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let remote_src_dir = match hostname {
|
|
||||||
"lush" => "/home/me/here/config",
|
|
||||||
"mac" => "/data/external/config",
|
|
||||||
"files" => "/home/files/here/config",
|
|
||||||
"nico" => "/root/work/config-c2vi",
|
|
||||||
"ppc-hosting" => "/root/host/c2vi-config",
|
|
||||||
_ => "main-idk",
|
|
||||||
};
|
|
||||||
let mize_store_dir = match hostname {
|
|
||||||
"lush" => "/home/me/host/mize",
|
|
||||||
"mac" => "/home/me/host/mize",
|
|
||||||
"files" => "/home/files/storage/files/mize",
|
|
||||||
"nico" => "/root/work/app-data/mize",
|
|
||||||
"ppc-hosting" => "/root/host/mize",
|
|
||||||
_ => "/tmp/idk",
|
|
||||||
};
|
|
||||||
let rclone_flag = match hostname {
|
|
||||||
"nico" => "--chown=root:root",
|
|
||||||
_ => "",
|
|
||||||
};
|
|
||||||
|
|
||||||
sh!(rsync -r -u -v -a --delete --perms $rclone_flag --include=".git/" --include=".git/**" --exclude="target" --mkpath $RSYNC_EXCLUDES $SRC/ $hostname:$remote_src_dir)?;
|
|
||||||
|
|
||||||
let ssh_cmd = format!(
|
|
||||||
r#"
|
|
||||||
if ! tmux has-session -t mize-deploy 2>/dev/null; then
|
|
||||||
echo "Created new tmux session...."
|
|
||||||
tmux new-session -d -s mize-deploy "nix develop git+file://{remote_src_dir}/mize#buildShell --max-jobs 1"
|
|
||||||
else
|
|
||||||
echo "using existing session..."
|
|
||||||
fi
|
|
||||||
|
|
||||||
tmux send-keys -t mize-deploy "DO_MIZE_RESTART={do_mize_restart}" Enter
|
|
||||||
tmux send-keys -t mize-deploy "cargo build --manifest-path {remote_src_dir}/Cargo.toml --bin {bin}" Enter
|
|
||||||
tmux send-keys -t mize-deploy 'BUILD_SUCCESS=$?' Enter
|
|
||||||
tmux send-keys -t mize-deploy '[[ "$BUILD_SUCCESS" == "0" ]] && echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" > {mize_store_dir}/daemon.env' Enter
|
|
||||||
tmux send-keys -t mize-deploy '[[ "$BUILD_SUCCESS" == "0" ]] && echo "MIZE_CONFIG_FILES={mize_store_dir}/config.toml" >> {mize_store_dir}/daemon.env' Enter
|
|
||||||
tmux send-keys -t mize-deploy '[[ "$BUILD_SUCCESS" == "0" ]] && [[ "$HOSTNAME" == "nico" ]] && echo "PATH=/root/work/path-extra:$PATH" >> {mize_store_dir}/daemon.env' Enter
|
|
||||||
tmux send-keys -t mize-deploy '[[ "$BUILD_SUCCESS" == "0" ]] && [[ "$DO_MIZE_RESTART" == "true" ]] && systemctl --user restart mize' Enter
|
|
||||||
"#
|
|
||||||
);
|
|
||||||
|
|
||||||
sh!(ssh $hostname $ssh_cmd)?;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[mize_part]
|
|
||||||
#[derive(Default)]
|
|
||||||
struct MizeDev {
|
|
||||||
mize: Mize,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl MizePart for MizeDev {}
|
|
||||||
impl MizePartCreate for MizeDev {}
|
|
||||||
|
|
||||||
pub fn md(mize: &mut Mize) -> MizeResult<()> {
|
|
||||||
let mut cli = mize.get_part_native::<CliPart>("cli")?;
|
|
||||||
cli.set_command("md");
|
|
||||||
|
|
||||||
let bin_arg = Arg::new("bin").short('b');
|
|
||||||
|
|
||||||
cli.subcommand(
|
|
||||||
Command::new("deploy-lush").alias("dlu").arg(&bin_arg),
|
|
||||||
Box::new(move |matches: &ArgMatches, mize| remote_deploy(matches, mize, "lush")),
|
|
||||||
)?;
|
|
||||||
cli.subcommand(
|
|
||||||
Command::new("deploy-mac").alias("dmc").arg(&bin_arg),
|
|
||||||
Box::new(move |matches: &ArgMatches, mize| remote_deploy(matches, mize, "mac")),
|
|
||||||
)?;
|
|
||||||
cli.subcommand(
|
|
||||||
Command::new("deploy-files").alias("dfi").arg(&bin_arg),
|
|
||||||
Box::new(move |matches: &ArgMatches, mize| remote_deploy(matches, mize, "files")),
|
|
||||||
)?;
|
|
||||||
cli.subcommand(
|
|
||||||
Command::new("deploy-ppc").alias("dpp").arg(&bin_arg),
|
|
||||||
Box::new(move |matches: &ArgMatches, mize| remote_deploy(matches, mize, "ppc-hosting")),
|
|
||||||
)?;
|
|
||||||
cli.subcommand(
|
|
||||||
Command::new("deploy-nico").alias("dni").arg(&bin_arg),
|
|
||||||
Box::new(move |matches: &ArgMatches, mize| remote_deploy(matches, mize, "nico")),
|
|
||||||
)?;
|
|
||||||
cli.subcommand(
|
|
||||||
Command::new("deploy-main").alias("dma").arg(&bin_arg),
|
|
||||||
Box::new(main_deploy),
|
|
||||||
)?;
|
|
||||||
cli.subcommand(
|
|
||||||
Command::new("deploy-obsidian").alias("do").arg(&bin_arg),
|
|
||||||
Box::new(obsidian_deploy),
|
|
||||||
)?;
|
|
||||||
cli.subcommand(
|
|
||||||
Command::new("deploy-spacetime").alias("dsp").arg(&bin_arg),
|
|
||||||
Box::new(deploy_spacetime),
|
|
||||||
)?;
|
|
||||||
cli.subcommand(
|
|
||||||
Command::new("generate").alias("gen").arg(&bin_arg),
|
|
||||||
Box::new(md_generate),
|
|
||||||
)?;
|
|
||||||
|
|
||||||
mize.register_part(Box::new(MizeDev { mize: mize.clone() }))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn gen_file(path: &str, content: &str) -> MizeResult<()> {
|
|
||||||
sh!(touch $SRC/generated/$path)?;
|
|
||||||
std::fs::write(format!("{}/generated/{}", SRC, path), content)?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn gen_file_absolute(path: &str, content: &str) -> MizeResult<()> {
|
|
||||||
sh!(touch $path)?;
|
|
||||||
std::fs::write(path, content)?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn gen_main_rs(name: &str) -> MizeResult<()> {
|
|
||||||
let fn_name = name.replace("-", "_");
|
|
||||||
let fn_name = format!("{}_main", fn_name);
|
|
||||||
gen_file(format!("{}.rs", name).as_str(), format!(r#"
|
|
||||||
fn main() {{
|
|
||||||
if let Err(err) = c2vi_part::{fn_name}() {{
|
|
||||||
err.log();
|
|
||||||
}}
|
|
||||||
}}
|
|
||||||
"#).as_str())?;
|
|
||||||
OpenOptions::new().append(true).open(format!("{}/generated/Cargo.toml", SRC))?.write(format!(r#"
|
|
||||||
[[bin]]
|
|
||||||
name = "{name}"
|
|
||||||
path = "{name}.rs"
|
|
||||||
"#).as_bytes())?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn md_generate(_: &ArgMatches, mize: Mize) -> MizeResult<()> {
|
|
||||||
|
|
||||||
sh!(touch $SRC/generated/Cargo.toml)?;
|
|
||||||
sh!(mkdir -p $SRC/generated/src)?;
|
|
||||||
fs::write(format!("{}/generated/Cargo.toml", SRC), format!(r#"
|
|
||||||
[package]
|
|
||||||
name = "generated-c2vi-dev-part"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2024"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
c2vi-dev-part.path = "../dev-part"
|
|
||||||
"#).as_bytes())?;
|
|
||||||
|
|
||||||
gen_main_rs("lush-os")?;
|
|
||||||
gen_main_rs("main-os")?;
|
|
||||||
gen_main_rs("mac-os")?;
|
|
||||||
gen_main_rs("nico-os")?;
|
|
||||||
|
|
||||||
gen_main_rs("mppc")?;
|
|
||||||
gen_main_rs("timetrack-waybar")?;
|
|
||||||
gen_main_rs("md")?;
|
|
||||||
gen_main_rs("dev")?;
|
|
||||||
|
|
||||||
gen_file_absolute(format!("{SRC}/mize/marts/generated/Cargo.toml").as_str(), str!(r#"
|
|
||||||
[package]
|
|
||||||
name = "generated"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "generated"
|
|
||||||
path = "src/lib.rs"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
spacetimedb-sdk = "2.6.0"
|
|
||||||
|
|
||||||
[features]
|
|
||||||
target-js = [ "spacetimedb-sdk/browser" ]
|
|
||||||
"#))?;
|
|
||||||
gen_file_absolute(format!("{SRC}/mize/marts/generated/src/lib.rs").as_str(), str!(r#"
|
|
||||||
pub mod spacetime;
|
|
||||||
"#))?;
|
|
||||||
|
|
||||||
sh!(RUST_LOG=error RUST_BACKTRACE=0 spacetime generate --build-options="--lint-dir=" -p $SRC/mize/marts/spacetime -o $SRC/mize/marts/generated/src/spacetime --lang rust)?;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn deploy_spacetime(_: &ArgMatches, _: Mize) -> MizeResult<()> {
|
|
||||||
unsafe {
|
|
||||||
/*
|
|
||||||
std::env::set_var(
|
|
||||||
"PATH",
|
|
||||||
"/home/me/work/path-extra/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/home/me/.local/state/nix/profile/bin:/home/me/.nix-profile/bin",
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
std::env::set_var("SRC", SRC);
|
|
||||||
}
|
|
||||||
|
|
||||||
let cmd = format!(
|
|
||||||
r#"
|
|
||||||
if ! tmux has-session -t mize-deploy 2>/dev/null; then
|
|
||||||
echo "Created new tmux session...."
|
|
||||||
systemd-run --user --scope --description="mize deploy tmux session" tmux new-session -d -s mize-deploy "nix develop git+file://$SRC/mize --impure"
|
|
||||||
else
|
|
||||||
echo "using existing session..."
|
|
||||||
tmux send-keys -t mize-deploy "echo hoooooooooooooo" Enter
|
|
||||||
fi
|
|
||||||
|
|
||||||
tmux send-keys -t mize-deploy "spacetime publish -p $SRC/mize/packages/spacetime/ --yes mize" Enter
|
|
||||||
"#
|
|
||||||
);
|
|
||||||
sh!(/bin/sh -c "$cmd")?;
|
|
||||||
Ok(())
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn obsidian_deploy(_: &ArgMatches, _: Mize) -> MizeResult<()> {
|
|
||||||
unsafe {
|
|
||||||
std::env::set_var(
|
|
||||||
"PATH",
|
|
||||||
"/home/me/work/path-extra/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/home/me/.local/state/nix/profile/bin:/home/me/.nix-profile/bin",
|
|
||||||
);
|
|
||||||
std::env::set_var("SRC", SRC);
|
|
||||||
}
|
|
||||||
let cmd = format!(
|
|
||||||
r#"
|
|
||||||
if ! tmux has-session -t mize-deploy 2>/dev/null; then
|
|
||||||
echo "Created new tmux session...."
|
|
||||||
systemd-run --user --scope --description="mize deploy tmux session" tmux new-session -d -s mize-deploy "nix develop git+file://$SRC/mize --impure"
|
|
||||||
else
|
|
||||||
echo "using existing session..."
|
|
||||||
fi
|
|
||||||
tmux send-keys -t mize-deploy "deno run --config {SRC}/mize/apps/obsidian-plugin/deno.json build" Enter
|
|
||||||
tmux send-keys -t mize-deploy "cp -r {SRC}/mize/apps/obsidian-plugin/dist/* ~/work/things/.obsidian/plugins/mize/" Enter
|
|
||||||
"#
|
|
||||||
);
|
|
||||||
sh!(/bin/sh -c "$cmd")?;
|
|
||||||
Ok(())
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn main_deploy(_: &ArgMatches, _: Mize) -> MizeResult<()> {
|
|
||||||
unsafe {
|
|
||||||
std::env::set_var(
|
|
||||||
"PATH",
|
|
||||||
"/home/me/work/path-extra/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/home/me/.local/state/nix/profile/bin:/home/me/.nix-profile/bin",
|
|
||||||
);
|
|
||||||
std::env::set_var("SRC", SRC);
|
|
||||||
}
|
|
||||||
let cmd = str!(
|
|
||||||
r#"
|
|
||||||
if ! tmux has-session -t mize-deploy 2>/dev/null; then
|
|
||||||
systemd-run --user --scope --description="mize deploy tmux session" tmux new-session -d -s mize-deploy "nix develop git+file://$SRC/mize#buildShell"
|
|
||||||
tmux send-keys -t mize-deploy "set -e" Enter
|
|
||||||
tmux send-keys -t mize-deploy "cargo build --manifest-path $SRC/parts/Cargo.toml --bin main-os" Enter
|
|
||||||
tmux send-keys -t mize-deploy 'echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" > /home/me/work/app-data/mize/daemon.env' Enter
|
|
||||||
tmux send-keys -t mize-deploy "systemctl --user restart mize" Enter
|
|
||||||
else
|
|
||||||
echo "using existing session..."
|
|
||||||
tmux send-keys -t mize-deploy "cargo build --manifest-path $SRC/parts/Cargo.toml --bin main-os" Enter
|
|
||||||
tmux send-keys -t mize-deploy 'echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" > /home/me/work/app-data/mize/daemon.env' Enter
|
|
||||||
tmux send-keys -t mize-deploy "systemctl --user restart mize" Enter
|
|
||||||
fi
|
|
||||||
"#
|
|
||||||
);
|
|
||||||
sh!(/bin/sh -c "$cmd")?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn main_os_main() -> MizeResult<()> {
|
|
||||||
println!("os daemon on main...");
|
|
||||||
|
|
||||||
let mut config = ItemData::new();
|
|
||||||
config.set_path("store", "/home/me/work/app-data/mize")?;
|
|
||||||
config.set_path("log.level", "debug")?;
|
|
||||||
config.set_path("log.stderr.enable", true)?;
|
|
||||||
config.set_path("cli.daemonMode", true)?;
|
|
||||||
config.set_path("c2vi.dash.enable", false)?;
|
|
||||||
config.set_path("auth.client.refresh_thread", true)?;
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
std::env::set_var("RUST_BACKTRACE", "1");
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut mize = mize::Mize::with_config(config)?;
|
|
||||||
|
|
||||||
marts::cli(&mut mize)?;
|
|
||||||
marts::part_client_auth(&mut mize)?;
|
|
||||||
let mut auth = mize.get_part_native::<marts::auth::client::ClientAuth>("client_auth")?;
|
|
||||||
if auth.secrets().is_none() {
|
|
||||||
auth.login()?;
|
|
||||||
}
|
|
||||||
drop(auth);
|
|
||||||
|
|
||||||
md(&mut mize)?;
|
|
||||||
|
|
||||||
marts::spacetime(&mut mize)?;
|
|
||||||
marts::timetrack::timetrack(&mut mize)?;
|
|
||||||
part_add_thought(&mut mize)?;
|
|
||||||
|
|
||||||
marts::part_c2vi(&mut mize)?;
|
|
||||||
|
|
||||||
//ppc::daemon(&mut mize)?;
|
|
||||||
|
|
||||||
// testing(&mut mize)?;
|
|
||||||
|
|
||||||
mize.run()?;
|
|
||||||
mize.wait();
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn testing(mize: &mut mize::Mize) -> MizeResult<()> {
|
|
||||||
let test = str! {r#"
|
|
||||||
a = "hello"
|
|
||||||
# a comment
|
|
||||||
b = true
|
|
||||||
"#};
|
|
||||||
//let a = mizelang::parse(test)?;
|
|
||||||
//println!("data: {}", a);
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn mize_thin_cli_client(bin_name: Option<&str>) -> MizeResult<()> {
|
|
||||||
use std::io::Write;
|
|
||||||
use std::os::unix::net::UnixStream;
|
|
||||||
|
|
||||||
let store_path =
|
|
||||||
std::env::var("MIZE_STORE").map_err(|_| mize_err!("MIZE_STORE not set in environment"))?;
|
|
||||||
let sock_path = store_path + "/sock";
|
|
||||||
println!("sock_path: {}", sock_path);
|
|
||||||
let mut cmd_line = std::env::args().collect::<Vec<_>>();
|
|
||||||
if let Some(bin_name) = bin_name {
|
|
||||||
cmd_line[0] = bin_name.to_owned();
|
|
||||||
}
|
|
||||||
let msg = MizeMessage::new_custom("cli", cmd_line, 0);
|
|
||||||
|
|
||||||
let mut stream = UnixStream::connect(sock_path)?;
|
|
||||||
|
|
||||||
stream.write_all(&msg.bytes())?;
|
|
||||||
|
|
||||||
// Optional: Ensure all buffered data is pushed to the socket
|
|
||||||
stream.flush()?;
|
|
||||||
let mut reader = BufReader::new(stream.try_clone()?);
|
|
||||||
|
|
||||||
loop {
|
|
||||||
let msg: Value = ciborium::from_reader(&mut reader)?;
|
|
||||||
let mut msg = MizeMessage::new(msg, 0);
|
|
||||||
match msg.cmd()? {
|
|
||||||
MessageCmd::Custom(kind) => {
|
|
||||||
if kind == "cli.done".into_item_data() {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if kind == "cli.stdout".into_item_data() {
|
|
||||||
println!("{}", msg.data()?.value_string()?);
|
|
||||||
}
|
|
||||||
if kind == "cli.stderr".into_item_data() {
|
|
||||||
eprintln!("{}", msg.data()?.value_string()?);
|
|
||||||
}
|
|
||||||
if kind == "cli.spawn".into_item_data() {
|
|
||||||
let cmd = msg.data()?.value_string()?;
|
|
||||||
std::process::Command::new("/bin/sh")
|
|
||||||
.arg("-c")
|
|
||||||
.arg(&cmd)
|
|
||||||
.status()?;
|
|
||||||
let done_msg = MizeMessage::new_custom("cli.spawn_done", ItemData::new(), 0);
|
|
||||||
stream.write_all(&done_msg.bytes())?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn dma_local() -> MizeResult<()> {
|
|
||||||
println!("running dma_local...");
|
|
||||||
unsafe {
|
|
||||||
std::env::set_var(
|
|
||||||
"PATH",
|
|
||||||
"/home/me/work/path-extra/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/home/me/.local/state/nix/profile/bin:/home/me/.nix-profile/bin",
|
|
||||||
);
|
|
||||||
std::env::set_var("SRC", SRC);
|
|
||||||
}
|
|
||||||
let cmd = str!(
|
|
||||||
r#"
|
|
||||||
if ! tmux has-session -t mize-deploy 2>/dev/null; then
|
|
||||||
echo "Created new tmux session...."
|
|
||||||
systemd-run --user --scope --description="mize deploy tmux session" tmux new-session -d -s mize-deploy "NIXPKGS_ALLOW_UNFREE=1 nix develop git+file://$SRC/mize --impure"
|
|
||||||
else
|
|
||||||
echo "using existing session..."
|
|
||||||
fi
|
|
||||||
|
|
||||||
tmux send-keys -t mize-deploy "cargo build --manifest-path $SRC/Cargo.toml --bin main-os" Enter
|
|
||||||
tmux send-keys -t mize-deploy 'echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" > /home/me/work/app-data/mize/daemon.env' Enter
|
|
||||||
tmux send-keys -t mize-deploy 'echo "PATH=$PATH" >> /home/me/work/app-data/mize/daemon.env' Enter
|
|
||||||
tmux send-keys -t mize-deploy "systemctl --user restart mize" Enter
|
|
||||||
"#
|
|
||||||
);
|
|
||||||
sh!(/bin/sh -c "$cmd")?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn md_main() -> MizeResult<()> {
|
|
||||||
// run md dma locally
|
|
||||||
let args: Vec<String> = std::env::args().collect();
|
|
||||||
if args.get(1).map(|s| s.as_str()) == Some("dma") {
|
|
||||||
dma_local()?;
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
if args.get(1).map(|s| s.as_str()) == Some("dev") {
|
|
||||||
sh!(dx serve --hot-reload true --bin dev)?;
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
|
|
||||||
mize_thin_cli_client(None)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn mppc_main() -> MizeResult<()> {
|
|
||||||
mize_thin_cli_client(Some("ppc"))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn dev_main() -> MizeResult<()> {
|
|
||||||
use dioxus::desktop::{Config, WindowBuilder, muda::Menu};
|
|
||||||
use dioxus::prelude::*;
|
|
||||||
|
|
||||||
let mize = Mize::new();
|
|
||||||
let mize_clone = mize.clone();
|
|
||||||
LaunchBuilder::new()
|
|
||||||
.with_context_provider(move || Box::new(mize_clone.clone()))
|
|
||||||
.with_cfg(desktop! {
|
|
||||||
Config::new().with_window(WindowBuilder::new().with_decorations(false).with_title("PPC"))
|
|
||||||
})
|
|
||||||
.launch(marts::ppc::main_page);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn timetrack_waybar_main() -> MizeResult<()> {
|
|
||||||
use std::io::Write;
|
|
||||||
use std::os::unix::net::UnixStream;
|
|
||||||
|
|
||||||
let store_path =
|
|
||||||
std::env::var("MIZE_STORE").map_err(|_| mize_err!("MIZE_STORE not set in environment"))?;
|
|
||||||
let sock_path = store_path + "/sock";
|
|
||||||
let out_msg = MizeMessage::new_custom("timetrack.sub_current", ItemData::new(), 0);
|
|
||||||
|
|
||||||
let mut stream = UnixStream::connect(&sock_path)?;
|
|
||||||
|
|
||||||
stream.write_all(&out_msg.bytes())?;
|
|
||||||
|
|
||||||
// Optional: Ensure all buffered data is pushed to the socket
|
|
||||||
stream.flush()?;
|
|
||||||
let mut reader = BufReader::new(stream.try_clone()?);
|
|
||||||
|
|
||||||
loop {
|
|
||||||
let msg: Value = match ciborium::from_reader(&mut reader) {
|
|
||||||
Ok(val) => val,
|
|
||||||
Err(_) => {
|
|
||||||
fn read_msg(out_msg: &MizeMessage, sock_path: &String) -> MizeResult<Value> {
|
|
||||||
thread::sleep(Duration::from_secs(12));
|
|
||||||
let mut stream = UnixStream::connect(sock_path)?;
|
|
||||||
|
|
||||||
stream.write_all(&out_msg.bytes())?;
|
|
||||||
|
|
||||||
stream.flush()?;
|
|
||||||
let mut reader = BufReader::new(stream.try_clone()?);
|
|
||||||
let val: Value = ciborium::from_reader(&mut reader)?;
|
|
||||||
Ok(val)
|
|
||||||
};
|
|
||||||
match read_msg(&out_msg, &sock_path) {
|
|
||||||
Ok(val) => val,
|
|
||||||
Err(_) => {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let mut msg = MizeMessage::new(msg, 0);
|
|
||||||
match msg.cmd()? {
|
|
||||||
MessageCmd::Custom(kind) => {
|
|
||||||
if kind == "timetrack.current".into_item_data() {
|
|
||||||
//println!("----> {} <----", msg.data()?.value_string()?);
|
|
||||||
println!("<b>{}</b>", msg.data()?.value_string()?);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn mac_os_main() -> MizeResult<()> {
|
|
||||||
println!("os daemon on mac...");
|
|
||||||
|
|
||||||
let mut config = ItemData::new();
|
|
||||||
config.set_path("store", "/home/me/host/mize")?;
|
|
||||||
config.set_path("data_dir", "/home/me/host/mize/misc")?;
|
|
||||||
config.set_path("log.level", "debug")?;
|
|
||||||
config.set_path("log.stderr.enable", true)?;
|
|
||||||
config.set_path("cli.daemonMode", true)?;
|
|
||||||
config.set_path("c2vi.dash.enable", false)?;
|
|
||||||
config.set_path("auth.client.refresh_thread", true)?;
|
|
||||||
|
|
||||||
//unsafe { std::env::set_var("RUST_BACKTRACE", "1"); }
|
|
||||||
|
|
||||||
let mut mize = mize::Mize::with_config(config)?;
|
|
||||||
|
|
||||||
marts::cli(&mut mize)?;
|
|
||||||
marts::part_client_auth(&mut mize)?;
|
|
||||||
|
|
||||||
let mut auth = mize.get_part_native::<ClientAuth>("client_auth")?;
|
|
||||||
if auth.secrets().is_none() {
|
|
||||||
tracing::info!("main: auth.secrets is none");
|
|
||||||
auth.login()?;
|
|
||||||
}
|
|
||||||
drop(auth);
|
|
||||||
|
|
||||||
md(&mut mize)?;
|
|
||||||
|
|
||||||
marts::spacetime(&mut mize)?;
|
|
||||||
marts::timetrack::timetrack(&mut mize)?;
|
|
||||||
part_add_thought(&mut mize)?;
|
|
||||||
|
|
||||||
marts::part_c2vi(&mut mize)?;
|
|
||||||
|
|
||||||
mize.run()?;
|
|
||||||
mize.wait();
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn nico_os_main() -> MizeResult<()> {
|
|
||||||
println!("os daemon on nico...");
|
|
||||||
|
|
||||||
let mut config = ItemData::new();
|
|
||||||
config.set_path("store", "/root/work/app-data/mize")?;
|
|
||||||
config.set_path("data_dir", "/root/work/app-data/mize/misc")?;
|
|
||||||
config.set_path("log.level", "debug")?;
|
|
||||||
config.set_path("log.stderr.enable", true)?;
|
|
||||||
config.set_path("cli.daemonMode", true)?;
|
|
||||||
config.set_path("c2vi.dash.enable", false)?;
|
|
||||||
config.set_path("auth.client.refresh_thread", true)?;
|
|
||||||
config.set_path("sc2.userNotesDir", "/root/work/nico/notes/c2vi")?;
|
|
||||||
|
|
||||||
let mut mize = mize::Mize::with_config(config)?;
|
|
||||||
|
|
||||||
marts::cli(&mut mize)?;
|
|
||||||
marts::part_client_auth(&mut mize)?;
|
|
||||||
|
|
||||||
let mut auth = mize.get_part_native::<ClientAuth>("client_auth")?;
|
|
||||||
if auth.secrets().is_none() {
|
|
||||||
tracing::info!("main: auth.secrets is none");
|
|
||||||
auth.login()?;
|
|
||||||
}
|
|
||||||
drop(auth);
|
|
||||||
|
|
||||||
marts::spacetime(&mut mize)?;
|
|
||||||
|
|
||||||
part_timetrack_export(&mut mize)?;
|
|
||||||
|
|
||||||
// notes sync
|
|
||||||
let mize_clone = mize.clone();
|
|
||||||
mize.spawn_background("nico_notes_sync", || nico_notes_sync_thread(mize_clone))?;
|
|
||||||
|
|
||||||
|
|
||||||
marts::part_c2vi(&mut mize)?;
|
|
||||||
|
|
||||||
mize.run()?;
|
|
||||||
mize.wait();
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
pub fn part_add_thought(mize: &mut Mize) -> MizeResult<()> {
|
|
||||||
use marts::generated::spacetime::add_thought;
|
|
||||||
let mut cli = mize.get_part_native::<marts::CliPart>("cli")?;
|
|
||||||
cli.set_command("ppc");
|
|
||||||
cli.subcommand(Command::new("inputThought").alias("ti"), |matches, mut mize| {
|
|
||||||
|
|
||||||
let tmp_file = std::env::temp_dir().join(format!(
|
|
||||||
"sc2-input-thought-{}.txt",
|
|
||||||
chrono::Utc::now().timestamp()
|
|
||||||
));
|
|
||||||
marts::cli_spawn(format!("nvim {}", tmp_file.display()))?;
|
|
||||||
let new_file_content = std::fs::read_to_string(&tmp_file)
|
|
||||||
.map_err(|e| mize_err!("Failed to read temp file: {}", e))?;
|
|
||||||
let _ = std::fs::remove_file(&tmp_file);
|
|
||||||
let spacetime = mize.get_part_native::<marts::SpacetimePart>("spacetime")?;
|
|
||||||
spacetime.con().reducers.add_thought(new_file_content)?;
|
|
||||||
Ok(())
|
|
||||||
})?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn part_timetrack_export(mize: &mut Mize) -> MizeResult<()> {
|
|
||||||
use std::path::Path;
|
|
||||||
let mut cli = mize.get_part_native::<marts::CliPart>("cli")?;
|
|
||||||
|
|
||||||
cli.set_command("ppc");
|
|
||||||
cli.subcommand(Command::new("exportTimetrack").alias("et").arg(Arg::new("date").short('d')).arg(Arg::new("all").short('a').action(ArgAction::SetTrue)), |matches , mut mize| {
|
|
||||||
let spacetime = mize.get_part_native::<marts::SpacetimePart>("spacetime")?;
|
|
||||||
let notes_dir = mize.get_config("sc2.userNotesDir").unwrap_or_default().value_string()?;
|
|
||||||
let today = Local::now().format("%Y-%m-%d").to_string();
|
|
||||||
let mut date = matches.get_one::<String>("date").unwrap_or(&today);
|
|
||||||
std::fs::create_dir_all(Path::new(¬es_dir).join("timetrack_exports"))?;
|
|
||||||
let all = matches.get_flag("all");
|
|
||||||
if all {
|
|
||||||
let (tx, rx) = oneshot::channel();
|
|
||||||
spacetime.con().procedures.first_timetrack_date_then("c2vi".to_string(), |_, res| {tx.send(res);});
|
|
||||||
let res = rx.recv()???;
|
|
||||||
let dates = dates_until_today(&res)?;
|
|
||||||
for date in dates {
|
|
||||||
out!("date: {}", date);
|
|
||||||
let (tx, rx) = oneshot::channel();
|
|
||||||
spacetime.con().procedures.export_timetrack_then("c2vi".to_string(), date.to_owned(), |_, res| {tx.send(res);});
|
|
||||||
let res = rx.recv()???;
|
|
||||||
let mut file = OpenOptions::new().create(true).write(true).open(Path::new(¬es_dir).join("timetrack_exports").join(format!("timetrack_export_{}.md", date)))?;
|
|
||||||
file.write_all(res.as_bytes())?;
|
|
||||||
}
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
out!("date: {}", date);
|
|
||||||
let (tx, rx) = oneshot::channel();
|
|
||||||
spacetime.con().procedures.export_timetrack_then("c2vi".to_string(), date.to_owned(), |_, res| {tx.send(res);});
|
|
||||||
let res = rx.recv()???;
|
|
||||||
let mut file = OpenOptions::new().create(true).write(true).open(Path::new(¬es_dir).join("timetrack_exports").join(format!("timetrack_export_{}.md", date)))?;
|
|
||||||
file.write_all(res.as_bytes())?;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
})?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn dates_until_today(start: &str) -> Result<Vec<String>, chrono::ParseError> {
|
|
||||||
use chrono::NaiveDate;
|
|
||||||
let mut current = NaiveDate::parse_from_str(start, "%Y-%m-%d")?;
|
|
||||||
let today = Local::now().date_naive();
|
|
||||||
|
|
||||||
let mut dates = Vec::new();
|
|
||||||
|
|
||||||
while current <= today {
|
|
||||||
dates.push(current.format("%Y-%m-%d").to_string());
|
|
||||||
current += TimeDelta::days(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(dates)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn nico_notes_sync_thread(mize: Mize) -> MizeResult<()> {
|
|
||||||
tracing::info!("starting nico_notes_sync_thread");
|
|
||||||
loop {
|
|
||||||
let res = sh!(/bin/bash -c r#"
|
|
||||||
cd /root/work/nico/notes/c2vi
|
|
||||||
git add .
|
|
||||||
git commit -m "nico notes sync"
|
|
||||||
git pull --rebase
|
|
||||||
git push
|
|
||||||
|
|
||||||
cd /root/work/nico/notes/nexus
|
|
||||||
git add .
|
|
||||||
git commit -m "nico nexus notes sync"
|
|
||||||
git pull --rebase
|
|
||||||
git push
|
|
||||||
|
|
||||||
cd /root/work/nico/notes/ppc-wiki
|
|
||||||
git add .
|
|
||||||
git commit -m "nico ppc-wiki notes sync"
|
|
||||||
git pull --rebase
|
|
||||||
git push
|
|
||||||
"#);
|
|
||||||
if let Err(e) = res {
|
|
||||||
tracing::error!("error in nico_notes_sync_thread: {}", e);
|
|
||||||
};
|
|
||||||
std::thread::sleep(std::time::Duration::from_mins(2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
fn main() {
|
|
||||||
println!("Hello, world!");
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{"rustc_fingerprint":12679484821923032738,"outputs":{"17747080675513052775":{"success":true,"status":"","code":0,"stdout":"rustc 1.95.0-nightly (f60a0f1bc 2026-02-02)\nbinary: rustc\ncommit-hash: f60a0f1bcc5a2a6dd8eb2d2021da79b40f5fbae9\ncommit-date: 2026-02-02\nhost: x86_64-unknown-linux-gnu\nrelease: 1.95.0-nightly\nLLVM version: 22.1.0\n","stderr":""},"7971740275564407648":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/nix/store/k7bh855izql4rli5hh0s5lsphzc0gnc2-rust-mixed\noff\npacked\nunpacked\n___\ndebug_assertions\nemscripten_wasm_eh\nfmt_debug=\"full\"\noverflow_checks\npanic=\"unwind\"\nproc_macro\nrelocation_model=\"pic\"\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"x87\"\ntarget_has_atomic\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_has_atomic_equal_alignment=\"16\"\ntarget_has_atomic_equal_alignment=\"32\"\ntarget_has_atomic_equal_alignment=\"64\"\ntarget_has_atomic_equal_alignment=\"8\"\ntarget_has_atomic_equal_alignment=\"ptr\"\ntarget_has_atomic_load_store\ntarget_has_atomic_load_store=\"16\"\ntarget_has_atomic_load_store=\"32\"\ntarget_has_atomic_load_store=\"64\"\ntarget_has_atomic_load_store=\"8\"\ntarget_has_atomic_load_store=\"ptr\"\ntarget_has_reliable_f128\ntarget_has_reliable_f16\ntarget_has_reliable_f16_math\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_thread_local\ntarget_vendor=\"unknown\"\nub_checks\nunix\n","stderr":""},"11857020428658561806":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/nix/store/k7bh855izql4rli5hh0s5lsphzc0gnc2-rust-mixed\noff\npacked\nunpacked\n___\ndebug_assertions\nemscripten_wasm_eh\nfmt_debug=\"full\"\noverflow_checks\npanic=\"unwind\"\nproc_macro\nrelocation_model=\"pic\"\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"x87\"\ntarget_has_atomic\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_has_atomic_equal_alignment=\"16\"\ntarget_has_atomic_equal_alignment=\"32\"\ntarget_has_atomic_equal_alignment=\"64\"\ntarget_has_atomic_equal_alignment=\"8\"\ntarget_has_atomic_equal_alignment=\"ptr\"\ntarget_has_atomic_load_store\ntarget_has_atomic_load_store=\"16\"\ntarget_has_atomic_load_store=\"32\"\ntarget_has_atomic_load_store=\"64\"\ntarget_has_atomic_load_store=\"8\"\ntarget_has_atomic_load_store=\"ptr\"\ntarget_has_reliable_f128\ntarget_has_reliable_f16\ntarget_has_reliable_f16_math\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_thread_local\ntarget_vendor=\"unknown\"\nub_checks\nunix\n","stderr":""}},"successes":{}}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{"rustc_fingerprint":12679484821923032738,"outputs":{"17747080675513052775":{"success":true,"status":"","code":0,"stdout":"rustc 1.95.0-nightly (f60a0f1bc 2026-02-02)\nbinary: rustc\ncommit-hash: f60a0f1bcc5a2a6dd8eb2d2021da79b40f5fbae9\ncommit-date: 2026-02-02\nhost: x86_64-unknown-linux-gnu\nrelease: 1.95.0-nightly\nLLVM version: 22.1.0\n","stderr":""},"7971740275564407648":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/nix/store/k7bh855izql4rli5hh0s5lsphzc0gnc2-rust-mixed\noff\npacked\nunpacked\n___\ndebug_assertions\nemscripten_wasm_eh\nfmt_debug=\"full\"\noverflow_checks\npanic=\"unwind\"\nproc_macro\nrelocation_model=\"pic\"\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"x87\"\ntarget_has_atomic\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_has_atomic_equal_alignment=\"16\"\ntarget_has_atomic_equal_alignment=\"32\"\ntarget_has_atomic_equal_alignment=\"64\"\ntarget_has_atomic_equal_alignment=\"8\"\ntarget_has_atomic_equal_alignment=\"ptr\"\ntarget_has_atomic_load_store\ntarget_has_atomic_load_store=\"16\"\ntarget_has_atomic_load_store=\"32\"\ntarget_has_atomic_load_store=\"64\"\ntarget_has_atomic_load_store=\"8\"\ntarget_has_atomic_load_store=\"ptr\"\ntarget_has_reliable_f128\ntarget_has_reliable_f16\ntarget_has_reliable_f16_math\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_thread_local\ntarget_vendor=\"unknown\"\nub_checks\nunix\n","stderr":""}},"successes":{}}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
error: manifest path `/home/me/work/config/dev-part/Cargo.toml` does not exist
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
use axum::{Json, http::StatusCode};
|
|
||||||
use serde_json::{Value, json};
|
|
||||||
use std::str::FromStr;
|
|
||||||
|
|
||||||
use axum::{
|
|
||||||
Router,
|
|
||||||
error_handling::HandleErrorLayer,
|
|
||||||
http::Uri,
|
|
||||||
response::IntoResponse,
|
|
||||||
routing::{any, get},
|
|
||||||
};
|
|
||||||
use axum_oidc::handle_oidc_redirect;
|
|
||||||
use axum_oidc::{
|
|
||||||
EmptyAdditionalClaims, OidcAuthLayer, OidcClaims, OidcClient, OidcLoginLayer,
|
|
||||||
OidcRpInitiatedLogout, error::MiddlewareError,
|
|
||||||
};
|
|
||||||
use base64::{
|
|
||||||
Engine,
|
|
||||||
alphabet::STANDARD,
|
|
||||||
engine::{GeneralPurpose, GeneralPurposeConfig},
|
|
||||||
};
|
|
||||||
use clap::Command;
|
|
||||||
use dioxus::prelude::*;
|
|
||||||
use mize::Mize;
|
|
||||||
use mize::MizeResult;
|
|
||||||
use openidconnect::Scope;
|
|
||||||
use openidconnect::{ClientId, ClientSecret, IssuerUrl};
|
|
||||||
use tower::ServiceBuilder;
|
|
||||||
use tower_sessions::{
|
|
||||||
Expiry, MemoryStore, SessionManagerLayer,
|
|
||||||
cookie::{SameSite, time::Duration},
|
|
||||||
};
|
|
||||||
|
|
||||||
pub async fn server(mize: &mut Mize) -> MizeResult<()> {
|
|
||||||
dioxus::logger::initialize_default();
|
|
||||||
|
|
||||||
let listen_addr = mize.get_config("server.listen_addr")?.value_string()?;
|
|
||||||
let port = mize.get_config("server.port")?.value_string()?;
|
|
||||||
let issuer = mize.get_config("auth.issuer")?.value_string()?;
|
|
||||||
let client_id = mize.get_config("auth.client_id")?.value_string()?;
|
|
||||||
let client_secret = mize.get_config("auth.client_secret")?.value_string()?;
|
|
||||||
let url = mize.get_config("web.url")?.value_string()?;
|
|
||||||
let redirect_url = format!("{url}/oidc");
|
|
||||||
|
|
||||||
let session_store = MemoryStore::default();
|
|
||||||
let session_layer = SessionManagerLayer::new(session_store)
|
|
||||||
.with_secure(false)
|
|
||||||
.with_same_site(SameSite::Lax)
|
|
||||||
.with_expiry(Expiry::OnInactivity(Duration::seconds(120)));
|
|
||||||
|
|
||||||
let oidc_login_service = ServiceBuilder::new()
|
|
||||||
.layer(HandleErrorLayer::new(|e: MiddlewareError| async {
|
|
||||||
dbg!(&e);
|
|
||||||
e.into_response()
|
|
||||||
}))
|
|
||||||
.layer(OidcLoginLayer::<EmptyAdditionalClaims>::new());
|
|
||||||
|
|
||||||
let oidc_client = OidcClient::<EmptyAdditionalClaims>::builder()
|
|
||||||
.with_default_http_client()
|
|
||||||
.with_redirect_url(Uri::from_str(redirect_url.as_str())?)
|
|
||||||
.with_client_id(ClientId::new(client_id))
|
|
||||||
.add_scope(Scope::new("profile".into()))
|
|
||||||
.add_scope(Scope::new("email".into()))
|
|
||||||
// Optional: add untrusted audiences. If the `aud` claim contains any of these audiences, the token is rejected.
|
|
||||||
//.add_untrusted_audience(Audience::new("123456789".to_string()))
|
|
||||||
.with_client_secret(ClientSecret::new(client_secret))
|
|
||||||
.discover(IssuerUrl::new(issuer.into()).expect("Invalid IssuerUrl"))
|
|
||||||
.await
|
|
||||||
.unwrap()
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let oidc_auth_service = ServiceBuilder::new()
|
|
||||||
.layer(HandleErrorLayer::new(|e: MiddlewareError| async {
|
|
||||||
dbg!(&e);
|
|
||||||
e.into_response()
|
|
||||||
}))
|
|
||||||
.layer(OidcAuthLayer::new(oidc_client));
|
|
||||||
|
|
||||||
let app = Router::new()
|
|
||||||
// private routes
|
|
||||||
.route("/foo", get(authenticated))
|
|
||||||
.route("/logout", get(logout))
|
|
||||||
.layer(oidc_login_service)
|
|
||||||
.route("/bar", get(maybe_authenticated))
|
|
||||||
.route("/oidc", any(handle_oidc_redirect::<EmptyAdditionalClaims>))
|
|
||||||
.layer(oidc_auth_service)
|
|
||||||
.layer(session_layer)
|
|
||||||
.layer(tower_http::trace::TraceLayer::new_for_http())
|
|
||||||
//
|
|
||||||
// not authenticated routes
|
|
||||||
.route("/", get(mize_main_page))
|
|
||||||
.route("/oidc_display_code_and_state", get(display_code_and_state))
|
|
||||||
|
|
||||||
tracing::info!("Running on http://{listen_addr}:{port}");
|
|
||||||
|
|
||||||
let listener = tokio::net::TcpListener::bind(format!("{listen_addr}:{port}"))
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
axum::serve(listener, app.into_make_service())
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn mize_main_page() -> impl IntoResponse {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -31,9 +31,6 @@
|
|||||||
|
|
||||||
|
|
||||||
;;; projectile find file - quick switcher
|
;;; projectile find file - quick switcher
|
||||||
(after! evil
|
|
||||||
(map! :gnv "C-e" #'projectile-find-file)
|
|
||||||
)
|
|
||||||
(after! 'better-jumper
|
(after! 'better-jumper
|
||||||
(map! :gnv "C-i" #'projectile-find-file)
|
(map! :gnv "C-i" #'projectile-find-file)
|
||||||
)
|
)
|
||||||
@@ -158,7 +155,7 @@
|
|||||||
:config
|
:config
|
||||||
(emms-all) ;; Loads stable EMMS features
|
(emms-all) ;; Loads stable EMMS features
|
||||||
(setq emms-source-file-default-directory "~/work/music/"
|
(setq emms-source-file-default-directory "~/work/music/"
|
||||||
emms-player-list '(emms-player-vlc))
|
emms-player-list '(emms-player-mpv))
|
||||||
)
|
)
|
||||||
|
|
||||||
;;; infrasonic
|
;;; infrasonic
|
||||||
@@ -166,72 +163,145 @@
|
|||||||
(defvar my-subsonic-client
|
(defvar my-subsonic-client
|
||||||
(infrasonic-make-client :url "tunes.c2vi.dev")
|
(infrasonic-make-client :url "tunes.c2vi.dev")
|
||||||
)
|
)
|
||||||
(defun my-play-playlist (playlist-id)
|
(defun my-pick-song ()
|
||||||
"Fetch a Subsonic playlist by PLAYLIST-ID using infrasonic.el and load it into EMMS."
|
(interactive)
|
||||||
(interactive "sEnter Subsonic Playlist ID: ")
|
(let* (
|
||||||
(message "Fetching Subsonic playlist %s..." playlist-id)
|
(playlist (infrasonic-get-playlist my-subsonic-client "6ad5avelak6Lnu2yEbWwjj"))
|
||||||
|
(entries (cdr (assoc 'entry playlist)))
|
||||||
|
(candidates (list))
|
||||||
|
(urls '())
|
||||||
|
(void (dolist (song entries)
|
||||||
|
(let* (
|
||||||
|
(artist (cdr (assoc 'artist song)))
|
||||||
|
(cropped-artist (truncate-string-to-width artist 50))
|
||||||
|
(title (cdr (assoc 'title song)))
|
||||||
|
(id (cdr (assoc 'id song)))
|
||||||
|
(line (format "%-50s - %s" cropped-artist title))
|
||||||
|
(stream-url (infrasonic-get-stream-url my-subsonic-client id))
|
||||||
|
)
|
||||||
|
(add-to-list 'candidates line)
|
||||||
|
(push (cons line stream-url) urls)
|
||||||
|
)
|
||||||
|
))
|
||||||
|
(completion-result (completing-read "Select track: " candidates))
|
||||||
|
(url (cdr (assoc completion-result urls)))
|
||||||
|
)
|
||||||
|
(emms-play-url url)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defun my-load-playlist ()
|
||||||
|
(interactive)
|
||||||
|
(emms-playlist-mode-go)
|
||||||
|
(emms-playlist-clear)
|
||||||
|
|
||||||
(let* (
|
(let* (
|
||||||
(playlist-id "6I9sKLo2NfnyzdtShKwreO")
|
(playlist-id "6ad5avelak6Lnu2yEbWwjj")
|
||||||
(playlist (infrasonic-get-playlist
|
(playlist (infrasonic-get-playlist
|
||||||
my-subsonic-client
|
my-subsonic-client
|
||||||
playlist-id
|
playlist-id
|
||||||
))
|
))
|
||||||
(entries (cdr (assoc 'entry playlist)))
|
(entries (cdr (assoc 'entry playlist)))
|
||||||
(track-count 0)
|
(track-count 0)
|
||||||
|
(void (dolist (track entries)
|
||||||
|
(let* (
|
||||||
|
(track-id (cdr (assoc 'id track)))
|
||||||
|
(title (cdr (assoc 'title track)))
|
||||||
|
(artist (cdr (assoc 'artist track)))
|
||||||
|
(stream-url (infrasonic-get-stream-url my-subsonic-client track-id))
|
||||||
|
(emmstrack (emms-track 'url stream-url))
|
||||||
|
)
|
||||||
|
;(message title)
|
||||||
|
(emms-track-set emmstrack 'info-title title)
|
||||||
|
(emms-track-set emmstrack 'info-artist artist)
|
||||||
|
(funcall emms-playlist-insert-track-function emmstrack)
|
||||||
|
)
|
||||||
|
))
|
||||||
)
|
)
|
||||||
|
|
||||||
(dolist (track entries)
|
|
||||||
(let* (
|
|
||||||
(track-id (cdr (assoc 'id track)))
|
|
||||||
(stream-url (infrasonic-get-stream-url my-subsonic-client track-id))
|
|
||||||
)
|
|
||||||
;(emms-add-url stream-url)
|
|
||||||
;(emms-add-track
|
|
||||||
;(emms-track 'url stream-url))
|
|
||||||
;(setq track-count (1+ track-count))
|
|
||||||
;(emms-playlist-select-first)
|
|
||||||
;(emms-start)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
entries
|
|
||||||
(infrasonic-get-stream-url my-subsonic-client "7id7XzpofiHmnJPqfORA0O")
|
|
||||||
)
|
|
||||||
|
|
||||||
(lambda (playlist-data)
|
|
||||||
;; This callback executes on a successful API response
|
|
||||||
(let*
|
|
||||||
(
|
|
||||||
|
|
||||||
;; Ensure EMMS is ready and clear old queue if desired
|
|
||||||
(emms-playlist-ensure-playlist-buffer)
|
|
||||||
|
|
||||||
;; 3. Loop through every track returned by the API
|
|
||||||
(dolist (track entries)
|
|
||||||
(let* ((track-id (plist-get track :id))
|
|
||||||
;; Generate the authenticated streaming URL using infrasonic
|
|
||||||
(stream-url (infrasonic-stream-url client track-id)))
|
|
||||||
|
|
||||||
;; 4. Insert the URL track directly into the EMMS track ecosystem
|
|
||||||
(emms-add-track
|
|
||||||
(emms-track 'url stream-url))
|
|
||||||
(setq track-count (1+ track-count))))
|
|
||||||
|
|
||||||
(message "Successfully loaded %d tracks into EMMS from playlist!" track-count)
|
|
||||||
|
|
||||||
;; 5. Start playback immediately if nothing is playing
|
|
||||||
(unless emms-player-playing-p
|
|
||||||
(emms-playlist-select-first)
|
|
||||||
(emms-start))))
|
|
||||||
|
|
||||||
;; Error callback handling
|
|
||||||
(lambda (error-data)
|
|
||||||
(error "Infrasonic playlist fetch failed: %S" error-data)))
|
|
||||||
)
|
)
|
||||||
(defun my-play-work () (interactive)(my-play-playlist "6I9sKLo2NfnyzdtShKwreO"))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;; my finder
|
||||||
|
(defun my/obsidian--extra-files ()
|
||||||
|
"Return Markdown files from additional directories."
|
||||||
|
(let ((directory "~/notes/reference"))
|
||||||
|
(when (file-directory-p directory)
|
||||||
|
(directory-files-recursively
|
||||||
|
(expand-file-name directory)
|
||||||
|
"\\.md\\'"))))
|
||||||
|
|
||||||
|
(defun my/obsidian--candidate-data ()
|
||||||
|
"Return `(DISPLAY . FILE)' candidates for the Obsidian finder."
|
||||||
|
(let (result)
|
||||||
|
|
||||||
|
;; Files known to obsidian.el.
|
||||||
|
(maphash
|
||||||
|
(lambda (file metadata)
|
||||||
|
(let* ((tags (gethash 'tags metadata))
|
||||||
|
(aliases (gethash 'aliases metadata))
|
||||||
|
(title (file-name-base file))
|
||||||
|
(display
|
||||||
|
(concat
|
||||||
|
title
|
||||||
|
(when aliases
|
||||||
|
(format " [%s]" (string-join aliases ", ")))
|
||||||
|
(when tags
|
||||||
|
(format " #%s"
|
||||||
|
(string-join tags " #"))))))
|
||||||
|
(push (cons display file) result)))
|
||||||
|
obsidian-vault-cache)
|
||||||
|
|
||||||
|
;; Files in the additional directory.
|
||||||
|
(dolist (file (my/obsidian--extra-files))
|
||||||
|
(unless (assoc (file-name-base file) result)
|
||||||
|
(push (cons (file-name-base file) file) result)))
|
||||||
|
|
||||||
|
result))
|
||||||
|
|
||||||
|
(defun my-switcher ()
|
||||||
|
"Fuzzy-find all my stuff"
|
||||||
|
(interactive)
|
||||||
|
|
||||||
|
;; Make sure obsidian.el's cache is current.
|
||||||
|
;;(obsidian-update)
|
||||||
|
|
||||||
|
(let* ((data (my/obsidian--candidate-data))
|
||||||
|
(candidates (mapcar #'car data))
|
||||||
|
(choice
|
||||||
|
(completing-read
|
||||||
|
"things: "
|
||||||
|
candidates
|
||||||
|
nil
|
||||||
|
nil ; allow a new/non-existing note
|
||||||
|
nil
|
||||||
|
nil
|
||||||
|
nil)))
|
||||||
|
|
||||||
|
(if-let ((file (cdr (assoc choice data))))
|
||||||
|
;; Existing note.
|
||||||
|
(find-file file)
|
||||||
|
|
||||||
|
;; New note.
|
||||||
|
(let ((file
|
||||||
|
(expand-file-name
|
||||||
|
(if (string-suffix-p ".md" choice)
|
||||||
|
choice
|
||||||
|
(concat choice ".md"))
|
||||||
|
(expand-file-name obsidian-inbox-directory
|
||||||
|
obsidian-directory))))
|
||||||
|
(make-directory (file-name-directory file) t)
|
||||||
|
(find-file file)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(after! evil
|
||||||
|
(map! :gnv "C-e" #'my-switcher)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;; scratch
|
;;; scratch
|
||||||
@@ -240,17 +310,8 @@
|
|||||||
(lookup-key corfu-map (kbd "C-i"))
|
(lookup-key corfu-map (kbd "C-i"))
|
||||||
(define-key corfu-map (kbd "C-i") 'my/corfu-insert-first)
|
(define-key corfu-map (kbd "C-i") 'my/corfu-insert-first)
|
||||||
|
|
||||||
(plz 'get "https://tunes.c2vi.dev")
|
|
||||||
(infrasonic-get-playlist
|
|
||||||
my-subsonic-client
|
|
||||||
"6I9sKLo2NfnyzdtShKwreO"
|
|
||||||
)
|
|
||||||
(infrasonic-ping my-subsonic-client)
|
|
||||||
(infrasonic-api-call my-subsonic-client "ping" nil (lambda () (message "hi")) (lambda (e) (message e)))
|
|
||||||
(shell-command-to-string "curl https://tunes.c2vi.dev")
|
|
||||||
|
|
||||||
(emms-play-url "https://tunes.c2vi.dev/rest/stream.view?u=c2vi&t=618e0d04594b0e72c865d7989b6dad38&s=5b08708ee057af16caab55db98c3dd03&v=1.16.1&c=infrasonic&f=json&id=7id7XzpofiHmnJPqfORA0O")
|
|
||||||
|
|
||||||
|
|
||||||
|
(emms-insert-url "https://tunes.c2vi.dev/rest/stream.view?u=c2vi&t=59248d02914f93abee797adcf0f14d6a&s=8a3988f950895ee7bd87e17651e65eb1&v=1.16.1&c=infrasonic&f=json&id=0FnN5Sb3mCItKdIiJZcG7x")
|
||||||
|
(message emms-playlist-buffer)
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -145,7 +145,7 @@
|
|||||||
####################### MIZE ###########################
|
####################### MIZE ###########################
|
||||||
mize.enable = true;
|
mize.enable = true;
|
||||||
mize.enableConfigFile = false;
|
mize.enableConfigFile = false;
|
||||||
mize.debugBinary = "/home/me/here/config/target/debug/lush-os";
|
mize.debugBinary = "/home/me/here/config/mize/target/debug/mize";
|
||||||
systemd.user.services.mize.environment.LOG= "trace";
|
systemd.user.services.mize.environment.LOG= "trace";
|
||||||
systemd.user.services.mize.environment.MIZE_STORE= "/home/me/host/mize";
|
systemd.user.services.mize.environment.MIZE_STORE= "/home/me/host/mize";
|
||||||
systemd.user.services.mize.serviceConfig.EnvironmentFile = "/home/me/host/mize/daemon.env";
|
systemd.user.services.mize.serviceConfig.EnvironmentFile = "/home/me/host/mize/daemon.env";
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export DOOMDIR="$CONFIG_DIR/doomdir"
|
|||||||
mkdir -p $LOG_DIR
|
mkdir -p $LOG_DIR
|
||||||
|
|
||||||
# arch path
|
# arch path
|
||||||
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||||
export PATH=$PATH:$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin # nix path
|
export PATH=$PATH:$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin # nix path
|
||||||
|
|
||||||
# main stuff
|
# main stuff
|
||||||
|
|||||||
@@ -3,10 +3,14 @@
|
|||||||
if [[ -v IS_RUNIT ]]; then
|
if [[ -v IS_RUNIT ]]; then
|
||||||
exec 2>$LOG_DIR/mize
|
exec 2>$LOG_DIR/mize
|
||||||
exec 1>$LOG_DIR/mize
|
exec 1>$LOG_DIR/mize
|
||||||
exec /home/me/work/config/mize/target/debug/mize --config $CONFIG_DIR/hosts/main/mize.toml --secrets $SECRETS_DIR/mize-secrets.toml run
|
exec /home/me/work/config/mize/target/debug/mize --config $CONFIG_DIR/hosts/main/mize.toml -o cli.daemonMode --secrets $SECRETS_DIR/mize-secrets.toml run
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export LD_LIBRARY_PATH=/nix/store/992h4k1s2c0ma186wyc7a3080wrh1cc6-xdotool-4.20260303.1/lib:/nix/store/rsdvlq7wb59hdiwhhvkhx2xvxdkalkzc-webkitgtk-2.52.4+abi=4.1/lib:/nix/store/90ln3xz5m2x3r0ykad4mkg9gnwgrjpzg-pango-1.57.1/lib:/nix/store/l0vl4dali2mvbpi30a8da1f71jl85myg-openssl-3.6.2/lib:/nix/store/s2bjqqzdjs4ji71qm1wwnkiy7g3afdz6-at-spi2-core-2.60.4/lib:/nix/store/fzhjg6xris850npqr92g4m4pskj88brn-atkmm-2.28.5/lib:/nix/store/4zwifnznmqsg3zl8y5yyfafwp4sws6rs-cairo-1.18.4/lib:/nix/store/rgr3i966i5wnblv62fvkid3v3lxy1ivb-gdk-pixbuf-2.44.6/lib:/nix/store/7dl2py4dnp4ffj92r1lq0i54ik1v8kzn-glib-2.88.1/lib:/nix/store/7c73fgj9w0k8qrpq3j1h8h976bk7gqsp-gtk+3-3.24.52/lib:/nix/store/49i3fhgpfffwh3xm3j58ma4z7221sqbq-harfbuzz-13.2.1/lib:/nix/store/na21ka09652cgigpv9wlw904wpq8bnvz-librsvg-2.62.1/lib:/nix/store/jc4y9v7ci45vas65kyl00pzpam3dnbfk-libsoup-3.6.6/lib:/nix/store/3kncz3fkk7sv9xc61x096jnbxvxfnx1k-libxkbcommon-1.13.1/lib:/nix/store/a4h98420m9h8c84r2igrpdd94xsrc9b6-alsa-lib-1.2.15.3/lib:/nix/store/hngmi01i8wgi25a0byrxcn4ysz5j79mw-gcc-15.2.0-lib/lib:/nix/store/xpzd2xmvqpkv1la78qkfpybkfwak27xd-libxcb-1.17.0/lib:/nix/store/6y2b9qs1npwsvcsl9m66hjarzj0yagb4-pipewire-1.6.5/lib:/nix/store/clvzgv5kqq953s4azqhkg3ddgpvgl9wc-wayland-1.25.0/lib:/nix/store/8gyg3xn9i8xdz42yhbl0d3vmmz8phcs0-bzip2-1.0.8/lib
|
export LD_LIBRARY_PATH=/nix/store/992h4k1s2c0ma186wyc7a3080wrh1cc6-xdotool-4.20260303.1/lib:/nix/store/rsdvlq7wb59hdiwhhvkhx2xvxdkalkzc-webkitgtk-2.52.4+abi=4.1/lib:/nix/store/90ln3xz5m2x3r0ykad4mkg9gnwgrjpzg-pango-1.57.1/lib:/nix/store/l0vl4dali2mvbpi30a8da1f71jl85myg-openssl-3.6.2/lib:/nix/store/s2bjqqzdjs4ji71qm1wwnkiy7g3afdz6-at-spi2-core-2.60.4/lib:/nix/store/fzhjg6xris850npqr92g4m4pskj88brn-atkmm-2.28.5/lib:/nix/store/4zwifnznmqsg3zl8y5yyfafwp4sws6rs-cairo-1.18.4/lib:/nix/store/rgr3i966i5wnblv62fvkid3v3lxy1ivb-gdk-pixbuf-2.44.6/lib:/nix/store/7dl2py4dnp4ffj92r1lq0i54ik1v8kzn-glib-2.88.1/lib:/nix/store/7c73fgj9w0k8qrpq3j1h8h976bk7gqsp-gtk+3-3.24.52/lib:/nix/store/49i3fhgpfffwh3xm3j58ma4z7221sqbq-harfbuzz-13.2.1/lib:/nix/store/na21ka09652cgigpv9wlw904wpq8bnvz-librsvg-2.62.1/lib:/nix/store/jc4y9v7ci45vas65kyl00pzpam3dnbfk-libsoup-3.6.6/lib:/nix/store/3kncz3fkk7sv9xc61x096jnbxvxfnx1k-libxkbcommon-1.13.1/lib:/nix/store/a4h98420m9h8c84r2igrpdd94xsrc9b6-alsa-lib-1.2.15.3/lib:/nix/store/hngmi01i8wgi25a0byrxcn4ysz5j79mw-gcc-15.2.0-lib/lib:/nix/store/xpzd2xmvqpkv1la78qkfpybkfwak27xd-libxcb-1.17.0/lib:/nix/store/6y2b9qs1npwsvcsl9m66hjarzj0yagb4-pipewire-1.6.5/lib:/nix/store/clvzgv5kqq953s4azqhkg3ddgpvgl9wc-wayland-1.25.0/lib:/nix/store/8gyg3xn9i8xdz42yhbl0d3vmmz8phcs0-bzip2-1.0.8/lib
|
||||||
|
|
||||||
exec /home/me/work/config/mize/target/debug/mize --config $CONFIG_DIR/hosts/main/mize.toml --secrets $SECRETS_DIR/mize-secrets.toml "$@"
|
exec /home/me/work/config/mize/target/debug/mize --config $CONFIG_DIR/hosts/main/mize.toml --secrets $SECRETS_DIR/mize-secrets.toml "$@"
|
||||||
|
|
||||||
|
# alias sci="cargo run --manifest-path ~/work/config/mize/Cargo.toml --bin mize -- --config $CONFIG_DIR/hosts/main/mize.toml --secrets $SECRETS_DIR/mize-secrets.toml run sci"
|
||||||
|
# alias mr="cargo run --manifest-path ~/work/config/mize/Cargo.toml --bin mize -- --config $CONFIG_DIR/hosts/main/mize.toml --secrets $SECRETS_DIR/mize-secrets.toml run"
|
||||||
|
# alias md="cargo run --manifest-path ~/work/config/mize/Cargo.toml --bin mize -- --config $CONFIG_DIR/hosts/main/mize.toml --secrets $SECRETS_DIR/mize-secrets.toml run dev"
|
||||||
|
|||||||
@@ -16,3 +16,5 @@
|
|||||||
100.88.116.225 nico
|
100.88.116.225 nico
|
||||||
100.88.245.227 phone
|
100.88.245.227 phone
|
||||||
100.88.69.32 ti
|
100.88.69.32 ti
|
||||||
|
|
||||||
|
# other
|
||||||
|
|||||||
@@ -213,10 +213,10 @@ hl.monitor({
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- ppc ne
|
-- ppc ne
|
||||||
hl.bind("F12", hl.dsp.exec_cmd("ppc ne"))
|
hl.bind("F12", hl.dsp.exec_cmd("mize run sci ne"))
|
||||||
hl.bind("F11", hl.dsp.exec_cmd("ppc ne -b"))
|
hl.bind("F11", hl.dsp.exec_cmd("mize run sci ne -b"))
|
||||||
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("ppc ne"))
|
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("mize run sci ne"))
|
||||||
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("ppc ne -b"))
|
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("mize run sci ne -b"))
|
||||||
|
|
||||||
-- Layout toggles
|
-- Layout toggles
|
||||||
-- hl.bind(mod .. "+comma", hl.dsp.layout)
|
-- hl.bind(mod .. "+comma", hl.dsp.layout)
|
||||||
|
|||||||
@@ -5,5 +5,6 @@ hostname = "mac"
|
|||||||
ips = ["192.168.4.3"]
|
ips = ["192.168.4.3"]
|
||||||
port = 4410
|
port = 4410
|
||||||
position = "right"
|
position = "right"
|
||||||
|
activate_on_startup = true
|
||||||
|
|
||||||
[authorized_fingerprints]
|
[authorized_fingerprints]
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ store = "/home/me/work/app-data/mize"
|
|||||||
spacetime.url = "100.88.46.87:8005"
|
spacetime.url = "100.88.46.87:8005"
|
||||||
namespace = "priv.c2vi.dev"
|
namespace = "priv.c2vi.dev"
|
||||||
|
|
||||||
enable = [ "cli", "auth", "" ]
|
enable = [ "cli", "auth", "sci.timetrack", "sci", "c2vi", "spacetime", "dev" ]
|
||||||
|
timetrack.dailyNotesPath = "/home/me/work/things/nico/daily"
|
||||||
|
|
||||||
|
|
||||||
[web]
|
[web]
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1089
|
1158
|
||||||
|
|||||||
Binary file not shown.
@@ -1 +1 @@
|
|||||||
591144
|
1159
|
||||||
|
|||||||
Binary file not shown.
@@ -1 +1 @@
|
|||||||
1088
|
1160
|
||||||
|
|||||||
Binary file not shown.
34
hosts/te.nix
34
hosts/te.nix
@@ -16,8 +16,15 @@ in {
|
|||||||
../users/me/gui.nix
|
../users/me/gui.nix
|
||||||
../users/root/default.nix
|
../users/root/default.nix
|
||||||
../common/nixos-wayland.nix
|
../common/nixos-wayland.nix
|
||||||
|
inputs.mize.nixosModules.default
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
mize.enable = true;
|
||||||
|
mize.debugBinary = "/home/me/here/mize";
|
||||||
|
mize.debugConfigFile = "/home/me/host/mize/config.toml";
|
||||||
|
|
||||||
|
|
||||||
programs.nix-ld.enable = true;
|
programs.nix-ld.enable = true;
|
||||||
|
|
||||||
networking.hostName = "te";
|
networking.hostName = "te";
|
||||||
@@ -201,6 +208,7 @@ in {
|
|||||||
ExecStart = "${pkgs.writeShellScriptBin "run" ''
|
ExecStart = "${pkgs.writeShellScriptBin "run" ''
|
||||||
name=$(ip link | awk -F: '/^[0-9]+: wl/ {print $2}' | sed 's/^ //')
|
name=$(ip link | awk -F: '/^[0-9]+: wl/ {print $2}' | sed 's/^ //')
|
||||||
nmcli connection modify pw connection.interface-name $name
|
nmcli connection modify pw connection.interface-name $name
|
||||||
|
nmcli connection modify gw connection.interface-name $name
|
||||||
''}/bin/run";
|
''}/bin/run";
|
||||||
};
|
};
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
@@ -235,6 +243,32 @@ in {
|
|||||||
method = "auto";
|
method = "auto";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
gw = {
|
||||||
|
connection = {
|
||||||
|
id = "gw";
|
||||||
|
uuid = "de655c52-1af2-4b46-b7b2-8ddad9edb52f";
|
||||||
|
type = "wifi";
|
||||||
|
interface-name = "wlo1";
|
||||||
|
autoconnect-priority = "300";
|
||||||
|
};
|
||||||
|
|
||||||
|
wifi = {
|
||||||
|
hidden = "true";
|
||||||
|
mode = "infrastructure";
|
||||||
|
ssid = builtins.readFile "${secretsDir}/gw-ssid";
|
||||||
|
};
|
||||||
|
|
||||||
|
wifi-security = {
|
||||||
|
key-mgmt = "wpa-psk";
|
||||||
|
psk = builtins.readFile "${secretsDir}/gw-password";
|
||||||
|
};
|
||||||
|
|
||||||
|
ipv4 = {
|
||||||
|
#address1 = "192.168.20.11/24";
|
||||||
|
dns = "100.88.218.34;";
|
||||||
|
method = "auto";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
pt = {
|
pt = {
|
||||||
connection = {
|
connection = {
|
||||||
|
|||||||
2
mize
2
mize
Submodule mize updated: c19de1ed84...a7db7da9d2
@@ -8,7 +8,14 @@ export XAUTHORITY=$HOME/.Xauthority
|
|||||||
|
|
||||||
cd ~
|
cd ~
|
||||||
|
|
||||||
# nix build hosts
|
### mize aliases
|
||||||
|
alias mg="mize get"
|
||||||
|
alias mr="mize run"
|
||||||
|
alias ms="mize set"
|
||||||
|
alias md="mize run dev"
|
||||||
|
alias sci="mize run sci"
|
||||||
|
|
||||||
|
### nix build hosts
|
||||||
export acern="ssh://acern x86_64-linux,aarch64-linux - 20 10 big-parallel - -"
|
export acern="ssh://acern x86_64-linux,aarch64-linux - 20 10 big-parallel - -"
|
||||||
export fe="ssh://fe x86_64-linux,aarch64-linux - 20 10 big-parallel - -"
|
export fe="ssh://fe x86_64-linux,aarch64-linux - 20 10 big-parallel - -"
|
||||||
export fusu="ssh://fusu x86_64-linux,aarch64-linux - 20 10 big-parallel - -"
|
export fusu="ssh://fusu x86_64-linux,aarch64-linux - 20 10 big-parallel - -"
|
||||||
@@ -16,7 +23,7 @@ export mac="ssh://mac x86_64-linux,aarch64-linux - 8 5 big-parallel - -"
|
|||||||
export mosatop="ssh://mosatop x86_64-linux,aarch64-linux - 8 5 big-parallel - -"
|
export mosatop="ssh://mosatop x86_64-linux,aarch64-linux - 8 5 big-parallel - -"
|
||||||
export hpm="ssh://hpm x86_64-linux,aarch64-linux - 8 5 big-parallel - -"
|
export hpm="ssh://hpm x86_64-linux,aarch64-linux - 8 5 big-parallel - -"
|
||||||
|
|
||||||
## ssh completions
|
### ssh completions
|
||||||
_ssh_completion() {
|
_ssh_completion() {
|
||||||
local cur prev opts
|
local cur prev opts
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
@@ -27,7 +34,30 @@ _ssh_completion() {
|
|||||||
COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
|
COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
complete -F _ssh_completion ssh scp sftp
|
_scp_completion() {
|
||||||
|
local cur opts
|
||||||
|
COMPREPLY=()
|
||||||
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
local OLD_WORDBREAKS=$COMP_WORDBREAKS
|
||||||
|
COMP_WORDBREAKS=${COMP_WORDBREAKS//:/}
|
||||||
|
|
||||||
|
|
||||||
|
# 2. Generate host choices using your existing logic
|
||||||
|
opts=$(awk '/^Host / && $2 !~ /[*?]/ {print $2}' $CONFIG_DIR/hosts/main/ssh_config 2>/dev/null; \
|
||||||
|
awk '{split($1,a,","); print a[1]}' ~/.ssh/known_hosts 2>/dev/null | tr -d '[]')
|
||||||
|
|
||||||
|
|
||||||
|
# 3. Combine both hosts and local files into the initial completion pool
|
||||||
|
# This allows typing 'sc[TAB]' to see both local files and your SSH hosts.
|
||||||
|
COMPREPLY=( $(compgen -S ":" -W "$opts" -- "$cur") $(compgen -f -- "$cur") )
|
||||||
|
|
||||||
|
# Enable filename formatting so local directory trailing slashes work
|
||||||
|
compopt -o filenames 2>/dev/null
|
||||||
|
return 0
|
||||||
|
|
||||||
|
}
|
||||||
|
complete -F _ssh_completion ssh sftp
|
||||||
|
complete -F _scp_completion -o nospace scp
|
||||||
|
|
||||||
|
|
||||||
# my prompt
|
# my prompt
|
||||||
|
|||||||
@@ -284,6 +284,7 @@ in {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
config = { config, pkgs, lib, ... }: {
|
config = { config, pkgs, lib, ... }: {
|
||||||
|
environment.systemPackages = [ pkgs.tmux ];
|
||||||
imports = [
|
imports = [
|
||||||
./fesu-hosting-base.nix
|
./fesu-hosting-base.nix
|
||||||
];
|
];
|
||||||
@@ -296,13 +297,10 @@ in {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
systemd.services.ppc = {
|
systemd.services.ppc = {
|
||||||
environment = {
|
|
||||||
MIZE_CONFIG_FILES = "/root/host/ppc-website-config.toml";
|
|
||||||
};
|
|
||||||
description = "PPC Website";
|
description = "PPC Website";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "/root/host/ppc-src/target/release/mize run";
|
ExecStart = "/root/host/mize --config /root/host/ppc-website-config.toml run";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -482,6 +480,7 @@ in {
|
|||||||
{ name = "oxi"; domain = "oxi.ppc.social"; host = "ppc-hosting"; port = 8009; }
|
{ name = "oxi"; domain = "oxi.ppc.social"; host = "ppc-hosting"; port = 8009; }
|
||||||
{ name = "c2vi-tunes"; domain = "tunes.c2vi.dev"; host = "fasu"; port = 8001; middlewares = [ "oidc-c2vi-navidrome" ]; }
|
{ name = "c2vi-tunes"; domain = "tunes.c2vi.dev"; host = "fasu"; port = 8001; middlewares = [ "oidc-c2vi-navidrome" ]; }
|
||||||
{ name = "c2vi-lidarr"; domain = "lidarr.c2vi.dev"; host = "fasu"; port = 8000; middlewares = [ "oidc-c2vi-lidarr" ]; }
|
{ name = "c2vi-lidarr"; domain = "lidarr.c2vi.dev"; host = "fasu"; port = 8000; middlewares = [ "oidc-c2vi-lidarr" ]; }
|
||||||
|
{ name = "c2vi-spot"; domain = "spot.c2vi.dev"; host = "fasu"; port = 8006; middlewares = [ "oidc-c2vi-lidarr" ]; }
|
||||||
|
|
||||||
#{ name = "spacetime"; domain = "spacetime.ppc.social"; host = "ppc-hosting"; port = 8005; extraRouterConfig = {
|
#{ name = "spacetime"; domain = "spacetime.ppc.social"; host = "ppc-hosting"; port = 8005; extraRouterConfig = {
|
||||||
# rule = "Host(`spacetime.ppc.social`) && PathPrefix(`/v1/database`)";
|
# rule = "Host(`spacetime.ppc.social`) && PathPrefix(`/v1/database`)";
|
||||||
|
|||||||
1
src/vicinae
Submodule
1
src/vicinae
Submodule
Submodule src/vicinae added at 8c63ae2ef1
@@ -7,6 +7,9 @@
|
|||||||
// custom settings, run `zed: open default settings` from the
|
// custom settings, run `zed: open default settings` from the
|
||||||
// command palette (cmd-shift-p / ctrl-shift-p)
|
// command palette (cmd-shift-p / ctrl-shift-p)
|
||||||
{
|
{
|
||||||
|
"terminal": {
|
||||||
|
"font_size": 18.0
|
||||||
|
},
|
||||||
"icon_theme": "Zed (Default)",
|
"icon_theme": "Zed (Default)",
|
||||||
"format_on_save": "off",
|
"format_on_save": "off",
|
||||||
"search": {
|
"search": {
|
||||||
@@ -168,13 +171,24 @@
|
|||||||
"host": "nico",
|
"host": "nico",
|
||||||
"args": [],
|
"args": [],
|
||||||
"projects": []
|
"projects": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"host": "fasu",
|
||||||
|
"args": [],
|
||||||
|
"projects": [
|
||||||
|
{
|
||||||
|
"paths": [
|
||||||
|
"/home/me/host/src/spotiarr"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"vim": {
|
"vim": {
|
||||||
"use_system_clipboard": "never"
|
"use_system_clipboard": "never"
|
||||||
},
|
},
|
||||||
"ui_font_weight": 250.0,
|
"ui_font_weight": 250.0,
|
||||||
"agent_ui_font_size": 14.0,
|
"agent_ui_font_size": 24.0,
|
||||||
"outline_panel": {
|
"outline_panel": {
|
||||||
"dock": "left",
|
"dock": "left",
|
||||||
"button": true,
|
"button": true,
|
||||||
@@ -220,7 +234,7 @@
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
"vim_mode": true,
|
"vim_mode": true,
|
||||||
"ui_font_size": 15.0,
|
"ui_font_size": 19.0,
|
||||||
"buffer_font_size": 15.0,
|
"buffer_font_size": 15.0,
|
||||||
"theme": {
|
"theme": {
|
||||||
"mode": "dark",
|
"mode": "dark",
|
||||||
|
|||||||
Reference in New Issue
Block a user