Compare commits
6 Commits
2139920fbc
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72a707299f | ||
|
|
a347145348 | ||
|
|
3307802360 | ||
|
|
f4662022a8 | ||
|
|
318ed7da50 | ||
|
|
a78d55965c |
@@ -1 +1 @@
|
|||||||
flake-profile-22-link
|
flake-profile-28-link
|
||||||
@@ -1 +0,0 @@
|
|||||||
/nix/store/j6p36ni1qcnyj14ymix6x7744bbzxqpm-nix-shell-env
|
|
||||||
1
.direnv/flake-profile-28-link
Symbolic link
1
.direnv/flake-profile-28-link
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/nix/store/hi26lq3gdw91m2zjx6yx0czi0k5d9w2f-nix-shell-env
|
||||||
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 = parts/vicinae
|
||||||
|
url = git@github.com:ppc-social/vicinae.git
|
||||||
|
|||||||
@@ -8,14 +8,14 @@
|
|||||||
"initialization_options": {
|
"initialization_options": {
|
||||||
"linkedProjects": [
|
"linkedProjects": [
|
||||||
"mize/Cargo.toml",
|
"mize/Cargo.toml",
|
||||||
//"forked-zed/Cargo.toml",
|
"Cargo.toml",
|
||||||
],
|
],
|
||||||
"cargo": {
|
"cargo": {
|
||||||
"features": [ "target-js", "target-obsidian" ]
|
//"features": [ "target-js", "target-obsidian" ]
|
||||||
//"features": "all"
|
//"features": "all"
|
||||||
},
|
},
|
||||||
"check": {
|
"check": {
|
||||||
"features": [ "target-js", "target-obsidian" ]
|
//"features": [ "target-js", "target-obsidian" ]
|
||||||
//"features": "all"
|
//"features": "all"
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
25
AGENTS.md
Normal file
25
AGENTS.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
# c2vi's dotfiles monorepo
|
||||||
|
this is c2vi's dotfiles repo and also monorepo where projects of active development are kept as git submodules.
|
||||||
|
|
||||||
|
for any coding work read these two guides:
|
||||||
|
@./mize/docs/general-agent-guide.md
|
||||||
|
@./mize/USING-MIZE-FOR-AGENTS.md
|
||||||
|
|
||||||
|
## other notes
|
||||||
|
to modify an existing application: wrappers, config files
|
||||||
|
to create new functionality: mize parts
|
||||||
|
- if not specified otherwise create the part under `./parts/c2vi.vibed.<name-of-part>` for anything related to c2vi (the owner of these dotfiles) or `./mize/parts/vibed.<name-of-part>` for anything generally usefull to the mize project.
|
||||||
|
|
||||||
|
## the dotfile system
|
||||||
|
- most importantly my dotfile system does not install anything to any system locations. there is one symlink of the bashrc to add extra paths. all other programms are wrappers inside the dotfiles repo pointing to config files also in this repository via cmdline flags or env vars. (any new config should apply to this convention)
|
||||||
|
|
||||||
|
folders:
|
||||||
|
- ./shared ... any config files which are shared between hosts
|
||||||
|
- ./hosts/<hostname> ... host specific config files (or partial config files which are included in the shared ones)
|
||||||
|
- ./hosts/<hostname>/bin ... added to the path of a specific host
|
||||||
|
- ./bin ... added to the path on every host.
|
||||||
|
|
||||||
|
the wrappers need to include the shared config file as well as the host-specific one if it exists. In case the programm does not allow specifying two config files the wrapper should cat both of them into one file in `$TMPDIR/combined-config-of-<prg-name>` everytime the programm is run. (a good example of a wrapper is `./bin/mize`)
|
||||||
|
|
||||||
|
longer config files are split up into smaller pieces seperated by a comment like `/////////////// does this and that /////////////` grouping config sections into functional units of sorts. new functionality would get it's own section.
|
||||||
6243
Cargo.lock
generated
Normal file
6243
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
11
Cargo.toml
Normal file
11
Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
[workspace]
|
||||||
|
members = [
|
||||||
|
"parts/*",
|
||||||
|
]
|
||||||
|
exclude = [
|
||||||
|
"parts/vicinae",
|
||||||
|
]
|
||||||
|
|
||||||
|
[workspace.dependencies]
|
||||||
|
mize = { path = "./mize/core" }
|
||||||
@@ -1,12 +1,32 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# do special stuff if it is run as a daemon by runit.
|
||||||
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
|
||||||
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONFIG_DIR/mize/target/debug
|
||||||
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/nix/store/k7bh855izql4rli5hh0s5lsphzc0gnc2-rust-mixed/lib/rustlib/x86_64-unknown-linux-gnu/lib/
|
||||||
|
|
||||||
exec /home/me/work/config/mize/target/debug/mize --config $CONFIG_DIR/hosts/main/mize.toml --secrets $SECRETS_DIR/mize-secrets.toml "$@"
|
# get some config values from mize
|
||||||
|
get_config mize.runBuild DO_BUILD
|
||||||
|
get_config mize.startDev START_DEV
|
||||||
|
get_config mize.backtrace DO_BACKTRACE
|
||||||
|
if [[ "$DO_BACKTRACE" == "true" ]] then
|
||||||
|
export RUST_BACKTRACE=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# a special dev mode which runs the current development version of the program right from the src code. (has mode to recompile as well)
|
||||||
|
if [[ "$START_DEV" == "true" ]] then
|
||||||
|
source $MIZE_STORE/misc/build-env.sh
|
||||||
|
[[ "$DO_BUILD" == "true" ]] && cargo build --manifest-path $CONFIG_DIR/mize/Cargo.toml --workspace
|
||||||
|
[[ "$?" != "0" ]] && [[ "$DO_BUILD" == "true" ]] && echo "build failed" && exit 1
|
||||||
|
exec $MIZE_SRC/target/debug/mize --config $CONFIG_DIR/hosts/main/mize.toml --secrets $SECRETS_DIR/mize-secrets.toml "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# exec the main program with config file parameters
|
||||||
|
exec /home/me/mize --config $CONFIG_DIR/hosts/main/mize.toml --secrets $SECRETS_DIR/mize-secrets.toml "$@"
|
||||||
@@ -313,11 +313,11 @@ output "HDMI-A-1" {
|
|||||||
}
|
}
|
||||||
#################### end from nwg-display
|
#################### end from nwg-display
|
||||||
|
|
||||||
set $disp2 "DP-1"
|
set $disp2 "eDP-1"
|
||||||
set $disp1 "eDP-1"
|
set $disp1 "DP-1"
|
||||||
|
|
||||||
workspace 7 output eDP-1
|
workspace 7 output eDP-1
|
||||||
workspace 0 output HEADLESS-1
|
workspace 0 output eDP-1
|
||||||
|
|
||||||
### Input configuration
|
### Input configuration
|
||||||
input type:keyboard {
|
input type:keyboard {
|
||||||
@@ -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"
|
||||||
@@ -397,7 +397,7 @@ output "HDMI-A-1" {
|
|||||||
bindsym Escape mode "default"
|
bindsym Escape mode "default"
|
||||||
}
|
}
|
||||||
|
|
||||||
bindsym --locked $mod+d exec wlr-randr --output eDP-1 --on
|
bindsym --locked $mod+d exec wlr-randr --output eDP-1 --on --right-of DP-1
|
||||||
bindsym --locked $mod+Shift+d exec wlr-randr --output eDP-1 --off
|
bindsym --locked $mod+Shift+d exec wlr-randr --output eDP-1 --off
|
||||||
|
|
||||||
bindsym $mod+Shift+Return exec $term
|
bindsym $mod+Shift+Return exec $term
|
||||||
@@ -502,11 +502,15 @@ output "HDMI-A-1" {
|
|||||||
bindsym $mod+Shift+0 move container to workspace number 10
|
bindsym $mod+Shift+0 move container to workspace number 10
|
||||||
|
|
||||||
# default display outputs for workspaces with fallback to disp1
|
# default display outputs for workspaces with fallback to disp1
|
||||||
workspace 1 output $disp2 $disp1
|
workspace 1 output eDP-1
|
||||||
workspace 6 output $disp2 $disp1
|
workspace 6 output eDP-1
|
||||||
workspace 4 output $disp2 $disp1
|
workspace 4 output eDP-1
|
||||||
workspace 8 output $disp2 $disp1
|
workspace 8 output eDP-1
|
||||||
workspace 9 output $disp2 $disp1
|
workspace 9 output DP-1
|
||||||
|
#assign [title="SCI display"] 3
|
||||||
|
for_window [title="SCI display"] move container to workspace 9, fullscreen enable
|
||||||
|
|
||||||
|
|
||||||
workspace 7 output eDP-1
|
workspace 7 output eDP-1
|
||||||
workspace 0 output eDP-1
|
workspace 0 output eDP-1
|
||||||
|
|
||||||
|
|||||||
@@ -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 {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,100 +1,39 @@
|
|||||||
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
|
|
||||||
|
|
||||||
;; Place your private configuration here! Remember, you do not need to run 'doom
|
|
||||||
;; sync' after modifying this file!
|
|
||||||
|
|
||||||
|
|
||||||
;; Some functionality uses this to identify you, e.g. GPG configuration, email
|
|
||||||
;; clients, file templates and snippets. It is optional.
|
|
||||||
;; (setq user-full-name "Sebastian Moser"
|
|
||||||
;; user-mail-address "c2vi.dev@gmail.com")
|
|
||||||
|
|
||||||
;; Doom exposes five (optional) variables for controlling fonts in Doom:
|
|
||||||
;;
|
|
||||||
;; - `doom-font' -- the primary font to use
|
|
||||||
;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable)
|
|
||||||
;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for
|
|
||||||
;; presentations or streaming.
|
|
||||||
;; - `doom-symbol-font' -- for symbols
|
|
||||||
;; - `doom-serif-font' -- for the `fixed-pitch-serif' face
|
|
||||||
;;
|
|
||||||
;; See 'C-h v doom-font' for documentation and more examples of what they
|
|
||||||
;; accept. For example:
|
|
||||||
;;
|
|
||||||
;;(setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'semi-light)
|
|
||||||
;; doom-variable-pitch-font (font-spec :family "Fira Sans" :size 13))
|
|
||||||
;;
|
|
||||||
;; If you or Emacs can't find your font, use 'M-x describe-font' to look them
|
|
||||||
;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to
|
|
||||||
;; refresh your font settings. If Emacs still can't find your font, it likely
|
|
||||||
;; wasn't installed correctly. Font issues are rarely Doom issues!
|
|
||||||
|
|
||||||
;; There are two ways to load a theme. Both assume the theme is installed and
|
;;; relative line numbers
|
||||||
;; available. You can either set `doom-theme' or manually load a theme with the
|
(setq display-line-numbers 'relative)
|
||||||
;; `load-theme' function. This is the default:
|
|
||||||
(setq doom-theme 'doom-one)
|
|
||||||
;; Specify both a dark and light theme, like so and Doom will choose which one
|
|
||||||
;; to load based on your system light/dark setting:
|
|
||||||
;;
|
|
||||||
;; (setq doom-theme '(doom-one . doom-one-light)) ; (DARK . LIGHT)
|
|
||||||
;;
|
|
||||||
;; If you want more pro-active theme switching based on OS light/dark mode, look
|
|
||||||
;; up the `auto-dark' package.
|
|
||||||
|
|
||||||
;; This determines the style of line numbers in effect. If set to `nil', line
|
|
||||||
;; numbers are disabled. For relative line numbers, set this to `relative'.
|
|
||||||
(setq display-line-numbers-type "relative")
|
|
||||||
|
|
||||||
;; If you use `org' and don't want your org files in the default location below,
|
;;; set my org directory
|
||||||
;; change `org-directory'. It must be set before org loads!
|
|
||||||
(setq org-directory "~/work/things/org")
|
(setq org-directory "~/work/things/org")
|
||||||
|
|
||||||
|
|
||||||
;; Whenever you reconfigure a package, make sure to wrap your config in an
|
;;; set my name and email
|
||||||
;; `with-eval-after-load' block, otherwise Doom's defaults may override your
|
(setq user-full-name "Sebastian Moser"
|
||||||
;; settings. E.g.
|
user-mail-address "c2vi.dev@gmail.com")
|
||||||
;;
|
|
||||||
;; (with-eval-after-load 'PACKAGE
|
|
||||||
;; (setq x y))
|
|
||||||
;;
|
|
||||||
;; The exceptions to this rule:
|
|
||||||
;;
|
|
||||||
;; - Setting file/directory variables (like `org-directory')
|
|
||||||
;; - Setting variables which explicitly tell you to set them before their
|
|
||||||
;; package is loaded (see 'C-h v VARIABLE' to look them up).
|
|
||||||
;; - Setting doom variables (which start with 'doom-' or '+').
|
|
||||||
;;
|
|
||||||
;; Here are some additional functions/macros that will help you configure Doom.
|
|
||||||
;;
|
|
||||||
;; - `load!' for loading external *.el files relative to this one
|
|
||||||
;; - `add-load-path!' for adding directories to the `load-path', relative to
|
|
||||||
;; this file. Emacs searches the `load-path' when you load packages with
|
|
||||||
;; `require' or `use-package'.
|
|
||||||
;; - `map!' for binding new keys
|
|
||||||
;;
|
|
||||||
;; To get information about any of these functions/macros, move the cursor over
|
|
||||||
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
|
|
||||||
;; This will open documentation for it, including demos of how they are used.
|
|
||||||
;; Alternatively, use `C-h o' to look up a symbol (functions, variables, faces,
|
|
||||||
;; etc).
|
|
||||||
;;
|
|
||||||
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
|
|
||||||
;; they are implemented.
|
|
||||||
|
|
||||||
|
|
||||||
|
;;; theme
|
||||||
|
(setq doom-theme 'doom-one)
|
||||||
|
|
||||||
|
|
||||||
|
;;; C-p to be M-x
|
||||||
(map! "C-p" #'execute-extended-command)
|
(map! "C-p" #'execute-extended-command)
|
||||||
;;(map! :leader "a" #'execute-extended-command)
|
;;(map! :leader "a" #'execute-extended-command)
|
||||||
;;(map! :nv ":" #'execute-extended-command)
|
;;(map! :nv ":" #'execute-extended-command)
|
||||||
|
|
||||||
(after! evil
|
(after! evil
|
||||||
;;(map! :nv ":" #'execute-extended-command)
|
;;(map! :nv ":" #'execute-extended-command)
|
||||||
(map! :gnv "C-p" #'execute-extended-command)
|
(map! :gnv "C-p" #'execute-extended-command)
|
||||||
(map! :gnv "C-e" #'projectile-find-file)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;; projectile find file - quick switcher
|
||||||
(after! 'better-jumper
|
(after! 'better-jumper
|
||||||
(map! :gnv "C-i" #'projectile-find-file)
|
(map! :gnv "C-i" #'projectile-find-file)
|
||||||
)
|
)
|
||||||
|
|
||||||
(with-eval-after-load 'projectile
|
(with-eval-after-load 'projectile
|
||||||
(add-to-list 'projectile-globally-ignored-directories "node_modules")
|
(add-to-list 'projectile-globally-ignored-directories "node_modules")
|
||||||
(add-to-list 'projectile-globally-ignored-directories ".obsidian")
|
(add-to-list 'projectile-globally-ignored-directories ".obsidian")
|
||||||
@@ -102,17 +41,20 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;; obsidian
|
||||||
(after! obsidian
|
(after! obsidian
|
||||||
(setq obsidian-directory "~/work/things"
|
(setq obsidian-directory "~/work/things"
|
||||||
obsidian-inbox-directory "semi-public"
|
obsidian-inbox-directory "semi-public"
|
||||||
markdown-enable-wiki-links t
|
markdown-enable-wiki-links t
|
||||||
)
|
)
|
||||||
|
|
||||||
(global-obsidian-mode t)
|
(global-obsidian-mode t)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;; clipboard
|
;;; clipboard
|
||||||
(after! evil
|
(after! evil
|
||||||
(setq interprogram-cut-function nil
|
(setq interprogram-cut-function nil
|
||||||
@@ -142,6 +84,11 @@
|
|||||||
:i "C-v" #'my/clipboard-paste) ; insert-state paste, terminal-style
|
:i "C-v" #'my/clipboard-paste) ; insert-state paste, terminal-style
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;; in buffer completions
|
;;; in buffer completions
|
||||||
(setq tab-always-indent 'complete)
|
(setq tab-always-indent 'complete)
|
||||||
(after! corfu
|
(after! corfu
|
||||||
@@ -181,13 +128,327 @@
|
|||||||
(map! :leader "m r" #'eval-print-last-sexp)
|
(map! :leader "m r" #'eval-print-last-sexp)
|
||||||
|
|
||||||
|
|
||||||
;;; scratch
|
|
||||||
(defun my/scratch ()
|
;;;; font/zoom
|
||||||
(lookup-key corfu-map (kbd "C-u"))
|
(setq doom-font (font-spec
|
||||||
(lookup-key corfu-map (kbd "C-i"))
|
;:family "Hack Mono"
|
||||||
(define-key corfu-map (kbd "C-i") 'my/corfu-insert-first)
|
:size 23 :weight 'regular))
|
||||||
(substitute-command-keys "\\{corfu-map}")
|
|
||||||
|
|
||||||
|
;;; have authinfo file in my $SECRETS_DIR
|
||||||
|
(setq auth-sources '("~/secrets/authinfo"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;; empv
|
||||||
|
(after! empv
|
||||||
|
(customize-set-variable 'empv-subsonic-username "c2vi")
|
||||||
|
(customize-set-variable 'empv-subsonic-url "https://tunes.c2vi.dev")
|
||||||
|
(customize-set-variable 'empv-subsonic-password (f-read-text "~/secrets/tunes-password"))
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;; supersonic
|
||||||
|
(after! supersonic
|
||||||
|
(customize-set-variable 'supersonic-host "https://tunes.c2vi.dev")
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
;;; emms
|
||||||
|
(use-package! emms
|
||||||
|
:config
|
||||||
|
(emms-all) ;; Loads stable EMMS features
|
||||||
|
(setq emms-source-file-default-directory "~/work/music/"
|
||||||
|
emms-player-list '(emms-player-mpv))
|
||||||
|
)
|
||||||
|
(when (featurep 'dbusbind)
|
||||||
|
(after! emms
|
||||||
|
(require 'emms-mpris)
|
||||||
|
(emms-mpris-enable)))
|
||||||
|
|
||||||
|
;;; infrasonic
|
||||||
|
(use-package! infrasonic)
|
||||||
|
(defvar my-subsonic-client
|
||||||
|
(infrasonic-make-client :url "tunes.c2vi.dev")
|
||||||
|
)
|
||||||
|
(defun my-pick-song ()
|
||||||
|
(interactive)
|
||||||
|
(let* (
|
||||||
|
(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-get-song-url ()
|
||||||
|
(interactive)
|
||||||
|
(let* (
|
||||||
|
(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)))
|
||||||
|
)
|
||||||
|
(message url)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defun my-load-playlist ()
|
||||||
|
(interactive)
|
||||||
|
(emms-playlist-mode-go)
|
||||||
|
(emms-playlist-clear)
|
||||||
|
|
||||||
|
(let* (
|
||||||
|
(playlist-id "6ad5avelak6Lnu2yEbWwjj")
|
||||||
|
(playlist (infrasonic-get-playlist
|
||||||
|
my-subsonic-client
|
||||||
|
playlist-id
|
||||||
|
))
|
||||||
|
(entries (cdr (assoc 'entry playlist)))
|
||||||
|
(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)
|
||||||
|
)
|
||||||
|
))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;; the file buffer opening I used to have in zed
|
||||||
|
(defun my-toggle-dired-current-dir ()
|
||||||
|
"Toggle between Dired for the current file's directory and the original file."
|
||||||
|
(interactive)
|
||||||
|
(if (eq major-mode 'dired-mode)
|
||||||
|
;; If in Dired, cleanly kill the buffer and jump back
|
||||||
|
(quit-window t)
|
||||||
|
;; Otherwise, check if visiting a file, then open its directory
|
||||||
|
(if (buffer-file-name)
|
||||||
|
(dired (file-name-directory (buffer-file-name)))
|
||||||
|
(message "Current buffer is not visiting a file."))))
|
||||||
|
|
||||||
|
;; Doom Emacs keybinding macro for Ctrl+Shift+P
|
||||||
|
(map! "C-S-p" #'my-toggle-dired-current-dir)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;; open the config.el file directly instead of the whole config folder
|
||||||
|
(map! :leader
|
||||||
|
:desc "Open Doom config.el"
|
||||||
|
"f p" (lambda ()
|
||||||
|
(interactive)
|
||||||
|
(find-file (expand-file-name "config.el" doom-private-dir))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;; xwidget don't ask when killing a buffer
|
||||||
|
(after! xwidget
|
||||||
|
(remove-hook 'kill-buffer-query-functions #'xwidget-kill-buffer-query-function)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;; markdown stuff
|
||||||
|
(use-package! md-mode
|
||||||
|
:mode ("\\.md\\'" . md-mode))
|
||||||
|
(after! md-mode
|
||||||
|
(define-key md-mode-map (kbd "C-h") 'md-mode-goto-heading)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
;;; evil - use visial line for down/up
|
||||||
|
(after! evil
|
||||||
|
(define-key evil-motion-state-map (kbd "j") 'evil-next-visual-line)
|
||||||
|
(define-key evil-motion-state-map (kbd "k") 'evil-previous-visual-line)
|
||||||
|
)
|
||||||
|
|
||||||
|
;;; workspace setup
|
||||||
|
(after! persp-mode
|
||||||
|
;; Automatically create a "main" workspace for miscellaneous tasks
|
||||||
|
(setq +workspaces-main "things")
|
||||||
|
;; Prevent emacsclient from forcing everything into a generic or new blank workspace
|
||||||
|
(setq persp-emacsclient-init-frame-behaviour-override nil)
|
||||||
|
|
||||||
|
(defun my/switch-to-project-workspace-on-client (frame)
|
||||||
|
"When an emacsclient frame is created, check if a file/folder was passed,
|
||||||
|
and automatically switch to its matching Doom project workspace."
|
||||||
|
(with-selected-frame frame
|
||||||
|
;; Only execute if a target file or directory is actually loaded
|
||||||
|
(when-let* ((target-path (or (buffer-file-name) default-directory))
|
||||||
|
;; Ask Projectile to find if this path belongs to a known project root
|
||||||
|
(project-root (projectile-project-root target-path)))
|
||||||
|
;; Instruct Doom to switch to the project's named workspace
|
||||||
|
(+workspace-switch project-root t)
|
||||||
|
;; Update Projectile's current project state for that workspace context
|
||||||
|
(setq projectile-project-root project-root))))
|
||||||
|
|
||||||
|
;; Hook this function to run every time an emacsclient connection spawns a frame
|
||||||
|
(add-hook 'after-make-frame-functions #'my/switch-to-project-workspace-on-client)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;; dired
|
||||||
|
(after! dired
|
||||||
|
(define-key evil-motion-state-map (kbd "C-n") nil)
|
||||||
|
(define-key evil-normal-state-map (kbd "C-n") nil)
|
||||||
|
(define-key dired-mode-map (kbd "C-n") #'dired-create-empty-file)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;; contacts
|
||||||
|
(use-package! ecard
|
||||||
|
:defer t
|
||||||
|
:config
|
||||||
|
;; Ensure CardDAV capabilities are loaded
|
||||||
|
(require 'ecard-carddav)
|
||||||
|
(require 'ecard-sync)
|
||||||
|
|
||||||
|
;; Configure your remote CardDAV repository mapping
|
||||||
|
(setq ecard-carddav-accounts
|
||||||
|
'(("oxi"
|
||||||
|
:url "https://oxi.ppc.social"
|
||||||
|
:user "c2vi"
|
||||||
|
;; ecard-carddav uses auth-source to securely look up your password/app-password
|
||||||
|
:auth auth-source)))
|
||||||
|
|
||||||
|
;; Set a path where your contacts will be saved locally as vCard files
|
||||||
|
(setq ecard-sync-local-directory (expand-file-name "~/work/app-data/ecard/")))
|
||||||
|
(after! ecard
|
||||||
|
(defun my/ecard-import-vcard-and-sync (file)
|
||||||
|
"Import a .vcf FILE, save it to the local ecard directory, and sync to CardDAV."
|
||||||
|
(interactive "fSelect vCard file to import: ")
|
||||||
|
(unless (file-exists-p file)
|
||||||
|
(user-error "File does not exist: %s" file))
|
||||||
|
|
||||||
|
;; Ensure the target directory exists
|
||||||
|
(unless (file-directory-p ecard-sync-local-directory)
|
||||||
|
(make-directory ecard-sync-local-directory t))
|
||||||
|
|
||||||
|
(message "Importing %s..." (file-name-nondirectory file))
|
||||||
|
|
||||||
|
;; 1. Read and parse the external vCard
|
||||||
|
(with-temp-buffer
|
||||||
|
(insert-file-contents file)
|
||||||
|
(let ((cards (ecard-parse-buffer)))
|
||||||
|
(if (null cards)
|
||||||
|
(message "No valid vCards found in file.")
|
||||||
|
|
||||||
|
;; 2. Write each parsed card to your local sync directory
|
||||||
|
(dolist (card cards)
|
||||||
|
;; ecard-write-card automatically names the file appropriately (often via UUID or Name)
|
||||||
|
(ecard-write-card card ecard-sync-local-directory))
|
||||||
|
|
||||||
|
(message "Successfully imported %d contact(s) locally." (length cards))
|
||||||
|
|
||||||
|
;; 3. Push the new local additions to the CardDAV server
|
||||||
|
(if (y-or-n-p "Sync newly imported contacts to CardDAV now? ")
|
||||||
|
(progn
|
||||||
|
(message "Synchronizing with CardDAV...")
|
||||||
|
(ecard-carddav-sync)
|
||||||
|
(message "Sync complete!"))
|
||||||
|
(message "Contacts imported locally. Run M-x ecard-carddav-sync later to upload.")))))))
|
||||||
|
(use-package! org-contacts
|
||||||
|
:after org
|
||||||
|
:config
|
||||||
|
;; Tell Emacs where your contacts file lives
|
||||||
|
(setq org-contacts-files '("~/work/app-data/org/contacts.org"))
|
||||||
|
|
||||||
|
;; (Optional) Add a custom Org-Capture template for quick entry
|
||||||
|
(add-to-list 'org-capture-templates
|
||||||
|
'("c" "Contact" entry (file "~/org/contacts.org")
|
||||||
|
"* %(org-contacts-template-name)\n :PROPERTIES:\n :EMAIL: %(org-contacts-template-email)\n :PHONE:\n :BIRTHDAY:\n :NOTE:\n :END:")))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;; matrix client
|
||||||
|
(setq my/secrets-dir (getenv "SECRETS_DIR"))
|
||||||
|
(use-package! ement
|
||||||
|
:config
|
||||||
|
;; Enable session saving so you don't have to re-authenticate on every launch
|
||||||
|
(setq ement-save-sessions t)
|
||||||
|
|
||||||
|
|
||||||
|
(when (fboundp 'set-fontset-font)
|
||||||
|
(set-fontset-font t 'emoji '("Noto Color Emoji" . "iso10646-1") nil 'prepend))
|
||||||
|
|
||||||
|
(run-with-idle-timer 2 nil (lambda ()
|
||||||
|
(ement-connect :user-id "@me:matrix.c2vi.dev"
|
||||||
|
:uri-prefix "http://100.88.79.207:8000"
|
||||||
|
:password (f-read (expand-file-name "priv.matrix.pwd" my/secrets-dir)))
|
||||||
|
|
||||||
|
;; my account on ppc's matrix
|
||||||
|
(ement-connect :user-id "@c2vi:ppc.social"
|
||||||
|
:uri-prefix "https://matrix.ppc.social")
|
||||||
|
))
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
;(setq completion-styles '(base initials orderless flex partial-completion substring))
|
|
||||||
|
|
||||||
|
|
||||||
|
;;; scratch
|
||||||
|
(defun my/scratch ()
|
||||||
|
(lookup-key dired-mode-map (kbd "C-n"))
|
||||||
|
(lookup-key corfu-map (kbd "C-i"))
|
||||||
|
(define-key corfu-map (kbd "C-i") 'my/corfu-insert-first)
|
||||||
|
|
||||||
|
|
||||||
|
(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")
|
||||||
|
(infrasonic-get-stream-url my-subsonic-client)
|
||||||
|
(message emms-playlist-buffer)
|
||||||
|
|
||||||
|
(+workspace-current-name)
|
||||||
|
(selected-frame)
|
||||||
|
|
||||||
|
)
|
||||||
|
|||||||
16
doomdir/custom.el
Normal file
16
doomdir/custom.el
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
;;; -*- lexical-binding: t -*-
|
||||||
|
(custom-set-variables
|
||||||
|
;; custom-set-variables was added by Custom.
|
||||||
|
;; If you edit it by hand, you could mess it up, so be careful.
|
||||||
|
;; Your init file should contain only one such instance.
|
||||||
|
;; If there is more than one, they won't work right.
|
||||||
|
'(custom-safe-themes
|
||||||
|
'("0325a6b5eea7e5febae709dab35ec8648908af12cf2d2b569bedc8da0a3a81c1"
|
||||||
|
"aec7b55f2a13307a55517fdf08438863d694550565dee23181d2ebd973ebd6b8" default))
|
||||||
|
'(ement-e2ee-mode t))
|
||||||
|
(custom-set-faces
|
||||||
|
;; custom-set-faces was added by Custom.
|
||||||
|
;; If you edit it by hand, you could mess it up, so be careful.
|
||||||
|
;; Your init file should contain only one such instance.
|
||||||
|
;; If there is more than one, they won't work right.
|
||||||
|
)
|
||||||
@@ -150,21 +150,21 @@
|
|||||||
;;javascript ; all(hope(abandon(ye(who(enter(here))))))
|
;;javascript ; all(hope(abandon(ye(who(enter(here))))))
|
||||||
;;julia ; a better, faster MATLAB
|
;;julia ; a better, faster MATLAB
|
||||||
;;kotlin ; a better, slicker Java(Script)
|
;;kotlin ; a better, slicker Java(Script)
|
||||||
;;latex ; writing papers in Emacs has never been so fun
|
latex ; writing papers in Emacs has never been so fun
|
||||||
;;lean ; for folks with too much to prove
|
;;lean ; for folks with too much to prove
|
||||||
;;ledger ; be audit you can be
|
;;ledger ; be audit you can be
|
||||||
;;lua ; one-based indices? one-based indices
|
lua ; one-based indices? one-based indices
|
||||||
markdown ; writing docs for people to ignore
|
(markdown +grip) ; writing docs for people to ignore
|
||||||
;;nim ; python + lisp at the speed of c
|
;;nim ; python + lisp at the speed of c
|
||||||
;;nix ; I hereby declare "nix geht mehr!"
|
;;nix ; I hereby declare "nix geht mehr!"
|
||||||
;;ocaml ; an objective camel
|
;;ocaml ; an objective camel
|
||||||
;;odin ; C, minus its footguns
|
;;odin ; C, minus its footguns
|
||||||
org ; organize your plain life in plain text
|
(org +contacts) ; organize your plain life in plain text
|
||||||
;;php ; perl's insecure younger brother
|
;;php ; perl's insecure younger brother
|
||||||
;;plantuml ; diagrams for confusing people more
|
;;plantuml ; diagrams for confusing people more
|
||||||
;;graphviz ; diagrams for confusing yourself even more
|
;;graphviz ; diagrams for confusing yourself even more
|
||||||
;;purescript ; javascript, but functional
|
;;purescript ; javascript, but functional
|
||||||
;;python ; beautiful is better than ugly
|
python ; beautiful is better than ugly
|
||||||
;;qt ; the 'cutest' gui framework ever
|
;;qt ; the 'cutest' gui framework ever
|
||||||
;;racket ; a DSL for DSLs
|
;;racket ; a DSL for DSLs
|
||||||
;;raku ; the artist formerly known as perl6
|
;;raku ; the artist formerly known as perl6
|
||||||
@@ -180,8 +180,8 @@
|
|||||||
;;solidity ; do you need a blockchain? No.
|
;;solidity ; do you need a blockchain? No.
|
||||||
;;swift ; who asked for emoji variables?
|
;;swift ; who asked for emoji variables?
|
||||||
;;terra ; Earth and Moon in alignment for performance.
|
;;terra ; Earth and Moon in alignment for performance.
|
||||||
;;web ; the tubes
|
web ; the tubes
|
||||||
;;yaml ; JSON, but readable
|
yaml ; JSON, but readable
|
||||||
;;zig ; C, but simpler
|
;;zig ; C, but simpler
|
||||||
|
|
||||||
:email
|
:email
|
||||||
|
|||||||
@@ -54,3 +54,39 @@
|
|||||||
|
|
||||||
(package! tldr)
|
(package! tldr)
|
||||||
(package! obsidian)
|
(package! obsidian)
|
||||||
|
(package! empv)
|
||||||
|
(package! f)
|
||||||
|
(package! emms)
|
||||||
|
(package! infrasonic
|
||||||
|
:recipe (:host github :repo "kaibagley/infrasonic")
|
||||||
|
:pin "134dff93c19d6862768c68d5981c59e084d48760"
|
||||||
|
)
|
||||||
|
|
||||||
|
(package! supersonic
|
||||||
|
:recipe (:host github :repo "systemfreund/supersonic.el" )
|
||||||
|
:pin "8d422489ffc84cc3907232afb51349c576c26cba"
|
||||||
|
)
|
||||||
|
(package! textui
|
||||||
|
:recipe (:host github :repo "yibie/textui")
|
||||||
|
:pin "8b3010d0f251b52dd1867c741d18bf66e405922d"
|
||||||
|
)
|
||||||
|
|
||||||
|
(package! md-mode
|
||||||
|
:recipe (:host github :repo "yibie/md-mode")
|
||||||
|
:pin "d9e7e1d83a8601a9bda2fd604f6a0881a4f9a838"
|
||||||
|
)
|
||||||
|
|
||||||
|
(package! ecard
|
||||||
|
:recipe (:host github :repo "jwiegley/ecard" :files ("*.el"))
|
||||||
|
:pin "e79cd68c49466f132142b5ce1a4eaa4fbb47fb8c"
|
||||||
|
)
|
||||||
|
|
||||||
|
(package! ement)
|
||||||
|
|
||||||
|
(package! org-contrib)
|
||||||
|
(package! org-contacts)
|
||||||
|
|
||||||
|
(package! ement-e2ee
|
||||||
|
:recipe (:host github :repo "bhwdev/ement-e2ee" :files ("*.el"))
|
||||||
|
:pin "3a2ec437814716aba8b4803ce91d4489402c41d9"
|
||||||
|
)
|
||||||
|
|||||||
14
flake.lock
generated
14
flake.lock
generated
@@ -2519,11 +2519,11 @@
|
|||||||
"rust-overlay": "rust-overlay_2"
|
"rust-overlay": "rust-overlay_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1780921813,
|
"lastModified": 1792001584,
|
||||||
"narHash": "sha256-yqQ4OmdWs691nfjxKcrDrbnjeQQwlXnmLj8IG0AbWyU=",
|
"narHash": "sha256-gRpyAAsKEsREyOa7J6WngNpmbbR4VjUB8MeFZHmXWDo=",
|
||||||
"ref": "refs/heads/master",
|
"ref": "refs/heads/master",
|
||||||
"rev": "c57849f748ba20134f79b76e42e0c85786dd637f",
|
"rev": "105eca862da9d8e54ad68c30d308f7c937861552",
|
||||||
"revCount": 203,
|
"revCount": 212,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.ppc.social/ppc/ppc"
|
"url": "https://git.ppc.social/ppc/ppc"
|
||||||
},
|
},
|
||||||
@@ -4463,11 +4463,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_5": {
|
"nixpkgs_5": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1774709303,
|
"lastModified": 1782467914,
|
||||||
"narHash": "sha256-D3Q07BbIA2KnTcSXIqqu9P586uWxN74zNoCH3h2ESHg=",
|
"narHash": "sha256-pGvFkM8N0xEkIIXDe5YYfbEAvHrk4IxBrjB/x8OomhE=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "8110df5ad7abf5d4c0f6fb0f8f978390e77f9685",
|
"rev": "e73de5be04e0eff4190a1432b946d469c794e7b4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
140
hosts/fusu.nix
140
hosts/fusu.nix
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
{ inputs, pkgs, secretsDir, config, dataDir, ... }: let
|
{ inputs, pkgs, secretsDir, config, dataDir, lib, ... }: let
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
@@ -407,142 +407,4 @@ in {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
############################## backups to fusu ##################################
|
|
||||||
|
|
||||||
users.users.borgs = {
|
|
||||||
uid = 2000;
|
|
||||||
isNormalUser = true;
|
|
||||||
group = "borgs";
|
|
||||||
};
|
|
||||||
users.groups.borgs = {
|
|
||||||
gid = 2000;
|
|
||||||
};
|
|
||||||
home-manager.users.borgs = { secretsDir, ... }: {
|
|
||||||
|
|
||||||
imports = [
|
|
||||||
../users/common/home.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
home.file.".ssh/known_hosts".text = ''
|
|
||||||
195.201.148.94 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBuxoYAjNYi3q2SFlzoVQTePcsnmT+qFHuaiiclC+S5I
|
|
||||||
195.201.148.94 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtDgdBTd8apRMBTweK9ZMRTdFqkU1mbKQDmyXSXbhSQAYwlgkmh1ee4TBE4nt/2b28QT5AqWOazVraqlAoSp+n7GwdsPH26lhbuF+ZVHq05X3RuJLmbhOsa6QlPzjSHiyj+Onkmj9DyXwKhhMErGcT1n2nhC4Oi007qsqcYQIB/YJ7hmMDABMzm9Bwd5Rk6xsDfz+9umvSMpwtfctpKixoVq90Fe3X6wloo5sgXpqfdP1IDFxfiaDp6nOQuOhvcA1Z67oGpW3T8CbZ5aDqA8e1vtpkl7oT3YolR+5153B/e0zOSAk8AabfkLdvrReECg2AHloH7hf9TOBVH0RVZluK+GRVJoaO2b3EspwIlThdQthiZH5/6vwDLsY6zNw6bUlKNntcNbJ5ZHc7zVv03Zlbpp6aWye0O3HR1PkaOo7pragEX9VAGj8Af2fNinSZVtd30gZlRFhLXQRAad+gC9R/5Q9X7V9BZBbWZ3J9DCP5zFoM9Y2R2YySjHX8Dmy7Jps=
|
|
||||||
195.201.148.94 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBAFh44c1Efqv/g8lvjDSY6uBYevByf1fg4BhLVcfYudqrSSSwbeaPrv6B+M5psrHo6/zthciDzp4oYUG8ANVRWs=
|
|
||||||
[localhost]:49388 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFr1jHueUdsh4Bc9meR1Var4hbZKLCnZGfCSpsP0oOeS
|
|
||||||
[localhost]:49388 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDHr9ZzEzC+2s1YNfPsFqDMbZv+o4XG2tEWlAF3DzzgdDawwxSj963qR46OqefPO+yiPBR/x3tFjXtSQ96qDcum9fzuiSzB+z5+/Zhs7VWEPi9ugGTDLFpX823EQrgcVKFE4jWnGsx6Ek8C9YojKgKf5afHG+ww2jNhTPHgVTrQkqo0JzUEnfjhJ/1/WluzpiGHfIy9re5MU10f2z9Vja7M0oDZ/Je+zavA4tlQpZ3URQnCEKC2vf7DhtwYBAOuyXKMdUSaTNdeTytmDjxdhJ38q8bwTHtfLUBzyYjW012Q5d1+/g1dqInu99uN/+UjTJc/GFiqLCE0tmco1GafptnKHJLgDC93vE832G5qvxhykfUAJdNW58kbWugeQm6Rb0i1UL5ckVHurMZT9BL6E9LKV0SewozyBtnA21RKu1vsheN86N0uBLwn3v1r0H3xPL4+S1WbmpXpIoCAoyTLc2janw2Gt22W1p08tv+a+lntFVqBn5ZSpcaUxQ6wRQQAfokqDh5YUzb+Tu9Fxi483qb6bd18io3kMLDre3G4xXqlvAB386Uj8iAYivmZIPBEFDCWBVki9LzWPfQGumgYN0CqSM6Gpqk0RnyU1CNPACEGaRpE1ph4Dgl9NQzRCiw/fEUiMZy1CTkly1YCiqSpp2iMmsJw+QJjfAbehEP+Tl8NIQ==
|
|
||||||
'';
|
|
||||||
|
|
||||||
programs.ssh = {
|
|
||||||
enable = true;
|
|
||||||
matchBlocks = {
|
|
||||||
"*" = {
|
|
||||||
identityFile = "/home/borgs/backups/borgs-private";
|
|
||||||
};
|
|
||||||
ouranos = {
|
|
||||||
hostname = "195.201.148.94";
|
|
||||||
user = "root";
|
|
||||||
};
|
|
||||||
fusus = {
|
|
||||||
hostname = "localhost";
|
|
||||||
user = "server";
|
|
||||||
port = 49388;
|
|
||||||
};
|
|
||||||
ocih = {
|
|
||||||
hostname = "152.67.70.13";
|
|
||||||
user = "ubuntu";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# automatically creates the mountpoint as well!!
|
|
||||||
fileSystems."/home/borgs/backups" = {
|
|
||||||
device = "/home/files/storage/backups/servers";
|
|
||||||
options = [ "bind" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
# ouranus
|
|
||||||
systemd.services.backup-ouranos-minecraft = {
|
|
||||||
enable = true;
|
|
||||||
description = "backup the /var/minecraft folder on ouranus to fusu";
|
|
||||||
unitConfig = {
|
|
||||||
Type = "simple";
|
|
||||||
};
|
|
||||||
path = with pkgs; [ curl bash socat borgbackup openssh ];
|
|
||||||
serviceConfig = {
|
|
||||||
ExecStart = "/home/borgs/backups/ouranos-minecraft.sh";
|
|
||||||
User = "borgs";
|
|
||||||
Group = "borgs";
|
|
||||||
WorkingDirectory = "/home/borgs/backups";
|
|
||||||
ExecStopPost = "/home/borgs/backups/exit-ouranos-minecraft.sh";
|
|
||||||
};
|
|
||||||
wants = [ "home-files-storage.mount" ];
|
|
||||||
};
|
|
||||||
systemd.timers.backup-ouranos-minecraft = {
|
|
||||||
wantedBy = [ "timers.target" ];
|
|
||||||
timerConfig = {
|
|
||||||
#OnBootSec = "5m";
|
|
||||||
#nUnitActiveSec = "1d";
|
|
||||||
OnCalendar = "*-*-* 04:00:00";
|
|
||||||
Persistent = "True";
|
|
||||||
Unit = "backup-ouranos-minecraft.service";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# ouranus
|
|
||||||
systemd.services.backup-fusu-server = {
|
|
||||||
enable = true;
|
|
||||||
description = "backup the ~/server folder on fusus";
|
|
||||||
unitConfig = {
|
|
||||||
Type = "simple";
|
|
||||||
};
|
|
||||||
path = with pkgs; [ curl bash socat borgbackup openssh ];
|
|
||||||
serviceConfig = {
|
|
||||||
ExecStart = "/home/borgs/backups/fusu-server.sh";
|
|
||||||
User = "borgs";
|
|
||||||
Group = "borgs";
|
|
||||||
WorkingDirectory = "/home/borgs/backups";
|
|
||||||
ExecStopPost = "/home/borgs/backups/exit-fusu-server.sh";
|
|
||||||
};
|
|
||||||
wants = [ "home-files-storage.mount" ];
|
|
||||||
};
|
|
||||||
systemd.timers.backup-fusu-server = {
|
|
||||||
wantedBy = [ "timers.target" ];
|
|
||||||
timerConfig = {
|
|
||||||
#OnBootSec = "5m";
|
|
||||||
#OnUnitActiveSec = "1d";
|
|
||||||
OnCalendar = "*-*-* 03:00:00";
|
|
||||||
Persistent = "True";
|
|
||||||
Unit = "backup-fusu-server.service";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# ocih
|
|
||||||
systemd.services.backup-ocih = {
|
|
||||||
enable = true;
|
|
||||||
description = "backup the ~/host folder on ocih";
|
|
||||||
unitConfig = {
|
|
||||||
Type = "simple";
|
|
||||||
};
|
|
||||||
path = with pkgs; [ curl bash socat borgbackup openssh ];
|
|
||||||
serviceConfig = {
|
|
||||||
ExecStart = "/home/borgs/backups/ocih.sh";
|
|
||||||
User = "borgs";
|
|
||||||
Group = "borgs";
|
|
||||||
WorkingDirectory = "/home/borgs/backups";
|
|
||||||
ExecStopPost = "/home/borgs/backups/exit-ocih.sh";
|
|
||||||
};
|
|
||||||
wants = [ "home-files-storage.mount" ];
|
|
||||||
};
|
|
||||||
systemd.timers.backup-ocih = {
|
|
||||||
wantedBy = [ "timers.target" ];
|
|
||||||
timerConfig = {
|
|
||||||
#OnBootSec = "5m";
|
|
||||||
#OnUnitActiveSec = "1d";
|
|
||||||
OnCalendar = "*-*-* 02:00:00";
|
|
||||||
Persistent = "True";
|
|
||||||
Unit = "backup-ocih.service";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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";
|
||||||
|
|||||||
@@ -24,10 +24,12 @@ in {
|
|||||||
inputs.mize.nixosModules.default
|
inputs.mize.nixosModules.default
|
||||||
];
|
];
|
||||||
mize.enable = true;
|
mize.enable = true;
|
||||||
mize.debugBinary = "/data/external/config/target/debug/mac-os";
|
mize.debugBinary = "/home/me/here/mize";
|
||||||
mize.debugConfigFile = "/home/me/host/mize-config.toml";
|
mize.debugConfigFile = "/home/me/host/mize/config.toml";
|
||||||
systemd.user.services.mize.environment.LOG= "trace";
|
systemd.user.services.mize.environment.LOG= "trace";
|
||||||
systemd.user.services.mize.serviceConfig.EnvironmentFile = "/home/me/host/mize/daemon.env";
|
systemd.user.services.mize.environment.MIZE_CONFIG_FILES = lib.mkForce "/home/me/host/mize/config.toml:/home/me/host/mize/daemon-config.toml";
|
||||||
|
|
||||||
|
|
||||||
programs.nix-ld.enable = true;
|
programs.nix-ld.enable = true;
|
||||||
|
|
||||||
# https://nixos.wiki/wiki/OBS_Studio
|
# https://nixos.wiki/wiki/OBS_Studio
|
||||||
@@ -192,7 +194,7 @@ in {
|
|||||||
enable = true;
|
enable = true;
|
||||||
systemd = true;
|
systemd = true;
|
||||||
settings = {
|
settings = {
|
||||||
authorized_fingerprints."f1:f2:c8:38:fd:e9:34:2f:a0:79:49:b4:ca:d6:4e:c6:31:10:42:1b:9f:ba:61:6f:41:9a:b7:ce:1a:32:47:a1" = "main";
|
authorized_fingerprints."35:02:e0:1c:64:de:a8:08:6a:65:d3:5a:20:ed:68:0f:c9:0a:50:bd:b7:03:4d:da:e9:c7:22:f5:79:48:0d:69" = "main";
|
||||||
port = 4410;
|
port = 4410;
|
||||||
clients = [
|
clients = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,10 +6,12 @@ export SVDIR=$CONFIG_DIR/hosts/main/services
|
|||||||
export BASH_ENV=$CONFIG_DIR/hosts/main/bashrc
|
export BASH_ENV=$CONFIG_DIR/hosts/main/bashrc
|
||||||
export HOSTNAME=main
|
export HOSTNAME=main
|
||||||
export DOOMDIR="$CONFIG_DIR/doomdir"
|
export DOOMDIR="$CONFIG_DIR/doomdir"
|
||||||
|
export MIZE_SRC=$CONFIG_DIR/mize
|
||||||
|
export MIZE_STORE=~/work/app-data/mize
|
||||||
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
|
||||||
@@ -76,6 +78,9 @@ function get_config() {
|
|||||||
myconfig["ssh.bin"]="/bin/ssh"
|
myconfig["ssh.bin"]="/bin/ssh"
|
||||||
myconfig["mize.configFile"]="$CONFIG_DIR/hosts/main/"
|
myconfig["mize.configFile"]="$CONFIG_DIR/hosts/main/"
|
||||||
myconfig["mize.secretsFile"]="~/secrets/mize-config.toml"
|
myconfig["mize.secretsFile"]="~/secrets/mize-config.toml"
|
||||||
|
myconfig["mize.startDev"]="true"
|
||||||
|
myconfig["mize.runBuild"]="false"
|
||||||
|
myconfig["mize.backtrace"]="false"
|
||||||
|
|
||||||
# nixos case
|
# nixos case
|
||||||
if [[ "$DISTRO" == "nixos" ]]; then
|
if [[ "$DISTRO" == "nixos" ]]; then
|
||||||
|
|||||||
44
hosts/main/bin/direnv-diff
Executable file
44
hosts/main/bin/direnv-diff
Executable file
@@ -0,0 +1,44 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import shlex
|
||||||
|
|
||||||
|
|
||||||
|
def read_env(data):
|
||||||
|
return dict(
|
||||||
|
item.split(b"=", 1)
|
||||||
|
for item in data.split(b"\0")
|
||||||
|
if item
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if len(sys.argv) != 2:
|
||||||
|
print(f"Usage: {sys.argv[0]} DIR", file=sys.stderr)
|
||||||
|
return 2
|
||||||
|
|
||||||
|
before = {
|
||||||
|
os.fsencode(k): os.fsencode(v)
|
||||||
|
for k, v in os.environ.items()
|
||||||
|
}
|
||||||
|
|
||||||
|
result = subprocess.run(
|
||||||
|
["direnv", "exec", sys.argv[1], "env", "-0"],
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
check=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
after = read_env(result.stdout)
|
||||||
|
|
||||||
|
|
||||||
|
for key, value in after.items():
|
||||||
|
if before.get(key) != value:
|
||||||
|
name = os.fsdecode(key)
|
||||||
|
val = os.fsdecode(value)
|
||||||
|
print(f"export {name}={shlex.quote(val)}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
exec emacsclient "$@"
|
exec emacsclient -c -n "$PWD/$1"
|
||||||
|
|||||||
@@ -10,4 +10,4 @@ export DOOMDIR="$CONFIG_DIR/doomdir"
|
|||||||
echo $DOOMDIR
|
echo $DOOMDIR
|
||||||
echo -------------
|
echo -------------
|
||||||
|
|
||||||
exec emacs --init-directory $CONFIG_DIR/src/doom --fg-daemon "$@"
|
exec nixGL emacs --init-directory $CONFIG_DIR/src/doom --fg-daemon "$@"
|
||||||
|
|||||||
9
hosts/main/bin/xdg-open
Executable file
9
hosts/main/bin/xdg-open
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo XDG-OPEN args: > ~/last-xdg-open-call
|
||||||
|
echo $@ >> ~/last-xdg-open-call
|
||||||
|
|
||||||
|
exec /usr/bin/xdg-open "$@"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
192.168.3.1 gw
|
192.168.3.1 gw
|
||||||
192.168.3.1 gw.c2vi.dev
|
192.168.3.1 gw.c2vi.dev
|
||||||
192.168.3.105 mac
|
192.168.3.105 mac
|
||||||
|
100.88.79.207 matrix.c2vi.dev
|
||||||
|
|
||||||
# netbird
|
# netbird
|
||||||
100.88.137.49 te
|
100.88.137.49 te
|
||||||
@@ -16,3 +17,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
|
||||||
|
|||||||
@@ -212,11 +212,26 @@ hl.monitor({
|
|||||||
scale = 1,
|
scale = 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- toggle display
|
||||||
|
hl.bind(mod .. " + D", function()
|
||||||
|
hl.monitor({
|
||||||
|
output = "eDP-1",
|
||||||
|
disabled = false
|
||||||
|
})
|
||||||
|
end)
|
||||||
|
hl.bind(mod .. " + SHIFT + D", function()
|
||||||
|
hl.monitor({
|
||||||
|
output = "eDP-1",
|
||||||
|
disabled = true
|
||||||
|
})
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
-- 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)
|
||||||
|
|||||||
@@ -3,8 +3,15 @@ data_dir = "/home/me/work/app-data/mize/misc"
|
|||||||
store = "/home/me/work/app-data/mize"
|
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"
|
||||||
|
log.level = "debug"
|
||||||
|
|
||||||
enable = [ "cli", "auth", "" ]
|
part_path = "/home/me/work/config/mize/target/debug/"
|
||||||
|
mize.src = "/home/me/work/config/mize"
|
||||||
|
parts = [ "cli", "auth.client", "dev", "mme" ]
|
||||||
|
#parts = [ "cli", "dev", "mme" ]
|
||||||
|
#parts = [ "cli", "auth", "spacetime", "sci", "c2vi", "dev" ]
|
||||||
|
enable = [ "cli", "auth", "spacetime", "sci", "c2vi", "dev", "sci.timetrack" ]
|
||||||
|
timetrack.dailyNotesPath = "/home/me/work/things/nico/daily"
|
||||||
|
|
||||||
|
|
||||||
[web]
|
[web]
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1052
|
1095
|
||||||
|
|||||||
Binary file not shown.
@@ -1 +1 @@
|
|||||||
1053
|
1093
|
||||||
|
|||||||
Binary file not shown.
@@ -1 +1 @@
|
|||||||
1051
|
1094
|
||||||
|
|||||||
Binary file not shown.
@@ -27,7 +27,7 @@ pacstrap -K /cachy base base-devel vim nix less direnv nvim
|
|||||||
pacstrap -K /cachy wayland firefox alacritty dms-shell git cmake paru
|
pacstrap -K /cachy wayland firefox alacritty dms-shell git cmake paru
|
||||||
|
|
||||||
pacstrap -K /cachy freerdp remmina
|
pacstrap -K /cachy freerdp remmina
|
||||||
pacstrap -K /cachy brightnessctl playerctl nm-connection-editor ttf-hack zenity prismlauncher docker inetutils freerdp
|
pacstrap -K /cachy brightnessctl playerctl nm-connection-editor ttf-hack zenity prismlauncher docker inetutils freerdp noto-fonts-emoji
|
||||||
```
|
```
|
||||||
|
|
||||||
## chroot
|
## chroot
|
||||||
@@ -69,6 +69,9 @@ ln -s ~/work/app-data/thunderbird ~/.mozilla/thunderbird
|
|||||||
|
|
||||||
sudo ln -sf $CONFIG_DIR/hosts/main/hosts /etc/hosts
|
sudo ln -sf $CONFIG_DIR/hosts/main/hosts /etc/hosts
|
||||||
|
|
||||||
|
# factorio
|
||||||
|
ln -s ~/secrets/factorio.cfg .factorio/config.cfg
|
||||||
|
|
||||||
# docker
|
# docker
|
||||||
sudo pacman -S docker
|
sudo pacman -S docker
|
||||||
sudo systemctl enable --now docker
|
sudo systemctl enable --now docker
|
||||||
|
|||||||
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...6eedb1826a
@@ -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
|
||||||
@@ -160,7 +190,7 @@ cb() {
|
|||||||
|
|
||||||
# rech
|
# rech
|
||||||
function rech(){
|
function rech(){
|
||||||
python3 -c "print($@)"
|
python3 -c "from math import *; print($@)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
- 8008 vikunja todo (task.ppc.social)
|
- 8008 vikunja todo (task.ppc.social)
|
||||||
- 8009 oxi-cloud
|
- 8009 oxi-cloud
|
||||||
- 8010 ppc-site
|
- 8010 ppc-site
|
||||||
|
- 8011 ppc-site
|
||||||
|
|
||||||
## hosting container ips (on the interface br-proxy)
|
## hosting container ips (on the interface br-proxy)
|
||||||
- fusu 192.168.1.2
|
- fusu 192.168.1.2
|
||||||
@@ -284,6 +285,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 +298,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 +481,8 @@ 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 = "llm"; domain = "llm.ppc.social"; host = "ppc-hosting"; port = 8011; }
|
||||||
|
|
||||||
#{ 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`)";
|
||||||
@@ -509,6 +510,7 @@ in {
|
|||||||
providerURL = "https://auth.ppc.social";
|
providerURL = "https://auth.ppc.social";
|
||||||
callbackURL = "/oauth2/callback";
|
callbackURL = "/oauth2/callback";
|
||||||
clientSecret = builtins.readFile "${secretsDir}/navidrome-oidc-secret";
|
clientSecret = builtins.readFile "${secretsDir}/navidrome-oidc-secret";
|
||||||
|
excludedURLs = [ "/rest" ];
|
||||||
clientID = "393371735229005827";
|
clientID = "393371735229005827";
|
||||||
scopes = [ "openid" "profile" "email" ];
|
scopes = [ "openid" "profile" "email" ];
|
||||||
sessionEncryptionKey = builtins.readFile "${secretsDir}/navidrome-session-encryption-key";
|
sessionEncryptionKey = builtins.readFile "${secretsDir}/navidrome-session-encryption-key";
|
||||||
|
|||||||
@@ -41,48 +41,21 @@
|
|||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
imports = [
|
|
||||||
inputs.arion.nixosModules.arion
|
|
||||||
];
|
|
||||||
|
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
(createArionServiceManager "backup" "")
|
#(createArionServiceManager "backup" "")
|
||||||
pkgs.arion
|
pkgs.arion
|
||||||
|
|
||||||
# Do install the docker CLI to talk to podman.
|
# Do install the docker CLI to talk to podman.
|
||||||
# Not needed when virtualisation.docker.enable = true;
|
# Not needed when virtualisation.docker.enable = true;
|
||||||
pkgs.docker-client
|
#pkgs.docker-client
|
||||||
|
|
||||||
# add all the service managers
|
# add all the service managers
|
||||||
];
|
];
|
||||||
|
|
||||||
# Arion works with Docker, but for NixOS-based containers, you need Podman
|
# Arion works with Docker, but for NixOS-based containers, you need Podman
|
||||||
# since NixOS 21.05.
|
# since NixOS 21.05.
|
||||||
virtualisation.docker.enable = false;
|
virtualisation.docker.enable = true;
|
||||||
virtualisation.podman.enable = true;
|
|
||||||
virtualisation.podman.dockerSocket.enable = true;
|
|
||||||
# https://github.com/containers/netavark/issues/274#issuecomment-4215665765
|
|
||||||
virtualisation.containers.containersConf.settings = {
|
|
||||||
network = {
|
|
||||||
network_backend = "netavark";
|
|
||||||
firewall_driver = "none";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
users.extraUsers.me.extraGroups = ["podman"];
|
users.extraUsers.me.extraGroups = ["docker"];
|
||||||
users.extraUsers.server.extraGroups = ["podman"];
|
|
||||||
|
|
||||||
|
|
||||||
virtualisation.arion = {
|
|
||||||
backend = "podman-socket";
|
|
||||||
};
|
|
||||||
|
|
||||||
virtualisation.arion.projects.backup.serviceName = "backup";
|
|
||||||
virtualisation.arion.projects.backup.settings.services = backupContainers [
|
|
||||||
{ name = "c2vi"; port = 8001; }
|
|
||||||
{ name = "mom"; port = 8002; }
|
|
||||||
{ name = "dad"; port = 8003; }
|
|
||||||
{ name = "brother"; port = 8004; }
|
|
||||||
];
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
18
parts/c2vi/Cargo.toml
Normal file
18
parts/c2vi/Cargo.toml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
[package]
|
||||||
|
name = "mize-part-c2vi"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "mize_part_c2vi"
|
||||||
|
path = "./src/mpart.rs"
|
||||||
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["desktop"]
|
||||||
|
desktop = ["dep:dioxus"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
mize = { workspace = true }
|
||||||
|
cmd_lib = "2.0.1"
|
||||||
|
dioxus = { version = "0.7", optional = true, features = ["desktop"] }
|
||||||
11
parts/c2vi/generated/Cargo.toml
Normal file
11
parts/c2vi/generated/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[package]
|
||||||
|
name = "mize-generated-c2vi"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "mize_generated_c2vi"
|
||||||
|
path = "src/lib.rs"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
mize = { workspace = true }
|
||||||
92
parts/c2vi/generated/src/lib.rs
Normal file
92
parts/c2vi/generated/src/lib.rs
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
// AUTO-GENERATED by mize dev gen -- do not edit manually
|
||||||
|
use mize::prelude::*;
|
||||||
|
use mize::config::MizeFun;
|
||||||
|
|
||||||
|
|
||||||
|
pub struct CliPart {
|
||||||
|
id: MizeId
|
||||||
|
}
|
||||||
|
|
||||||
|
impl MizePart for CliPart {
|
||||||
|
fn id(&self) -> MizeResult<MizeId> {
|
||||||
|
Ok(self.id.clone())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CliPart {
|
||||||
|
pub fn get(name: &str) -> MizeResult<CliPart> {
|
||||||
|
let mut mize = get_global_mize()?;
|
||||||
|
let part = mize.get_part(name)?;
|
||||||
|
Ok(CliPart { id: part.id()? })
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_command(&self, arg0: &str) -> MizeResult<()> {
|
||||||
|
let mut args = ItemData::new();
|
||||||
|
args.set_path("0", arg0.into_item_data())?;
|
||||||
|
dyn_call(self.id.clone(), "set_command", args)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn subcommand(&self, arg0: Command, arg1: MizeFun) -> MizeResult<()> {
|
||||||
|
let mut args = ItemData::new();
|
||||||
|
let mut __arg0 = ItemData::new();
|
||||||
|
__arg0.set_path("_native", arg0.native_num)?;
|
||||||
|
args.set_path("0", __arg0)?;
|
||||||
|
args.set_path("1", ItemData::fun(arg1)?)?;
|
||||||
|
dyn_call(self.id.clone(), "subcommand", args)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn run(&self, arg0: Vec<String>) -> MizeResult<()> {
|
||||||
|
let mut args = ItemData::new();
|
||||||
|
args.set_path("0", arg0.into_item_data())?;
|
||||||
|
dyn_call(self.id.clone(), "run", args)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn opt_state(&self) -> MizeResult<ItemData> {
|
||||||
|
get_config(&format!("{}/state", self.id.dot()))
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// native type: Command (clap::Command)
|
||||||
|
pub struct Command {
|
||||||
|
pub native_num: u32
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromItemData for Command {
|
||||||
|
fn from_itemdata(data: ItemData) -> MizeResult<Self> {
|
||||||
|
Ok(Command { native_num: data.get_path("_native")?.value_u32()? })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Command {
|
||||||
|
pub fn new(arg0: &str) -> MizeResult<Command> {
|
||||||
|
let mut args = ItemData::new();
|
||||||
|
args.set_path("0", arg0.into_item_data())?;
|
||||||
|
let mut mize = get_global_mize()?;
|
||||||
|
let id = mize.id_new_dots("cli.Command")?;
|
||||||
|
let data = dyn_call(id, "new", args)?;
|
||||||
|
let native_num: u32 = data.get_path("_native")?.value_u32()?;
|
||||||
|
Ok(Command { native_num })
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// native type: ArgMatches (clap::ArgMatches)
|
||||||
|
pub struct ArgMatches {
|
||||||
|
pub native_num: u32
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromItemData for ArgMatches {
|
||||||
|
fn from_itemdata(data: ItemData) -> MizeResult<Self> {
|
||||||
|
Ok(ArgMatches { native_num: data.get_path("_native")?.value_u32()? })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ArgMatches {
|
||||||
|
}
|
||||||
|
|
||||||
|
// part id string: cli
|
||||||
|
|
||||||
2
parts/c2vi/part
Normal file
2
parts/c2vi/part
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
id = "c2vi"
|
||||||
|
gen = [ "cli" ]
|
||||||
37
parts/c2vi/src/dash.rs
Normal file
37
parts/c2vi/src/dash.rs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#[cfg(feature = "desktop")]
|
||||||
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
|
#[cfg(feature = "desktop")]
|
||||||
|
pub fn launch_c2vi_dashboard() {
|
||||||
|
unsafe {
|
||||||
|
std::env::remove_var("WAYLAND_DISPLAY");
|
||||||
|
std::env::set_var("DISPLAY", ":0");
|
||||||
|
}
|
||||||
|
use dioxus::desktop::{Config, WindowBuilder};
|
||||||
|
dioxus::LaunchBuilder::new()
|
||||||
|
.with_cfg(
|
||||||
|
Config::new().with_window(
|
||||||
|
WindowBuilder::new()
|
||||||
|
.with_decorations(false)
|
||||||
|
.with_title("SCI display"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.launch(c2vi_dash_main);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "desktop")]
|
||||||
|
fn c2vi_dash_main() -> Element {
|
||||||
|
// spacetime SDK not wired yet — show a clear failure state until then
|
||||||
|
let current = use_signal(|| "spacetime SDK not wired yet".to_string());
|
||||||
|
let next = use_signal(|| "".to_string());
|
||||||
|
rsx! {
|
||||||
|
div {
|
||||||
|
style: "text-align: center; padding: 2rem; font-size: 120px;",
|
||||||
|
p { "{current}" }
|
||||||
|
p {
|
||||||
|
style: "font-size: 50px; color: grey; opacity: 0.7;",
|
||||||
|
"{next}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
159
parts/c2vi/src/deploy.rs
Normal file
159
parts/c2vi/src/deploy.rs
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
use crate::generated::ArgMatches;
|
||||||
|
use cmd_lib::run_cmd as sh;
|
||||||
|
use mize::prelude::*;
|
||||||
|
|
||||||
|
fn cfg_str(key: &str) -> MizeResult<String> {
|
||||||
|
get_global_mize()?.get_config(key)?.value_string()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn cfg_str_or(key: &str, default: &str) -> String {
|
||||||
|
get_global_mize()
|
||||||
|
.ok()
|
||||||
|
.and_then(|mut m| m.get_config(key).ok())
|
||||||
|
.and_then(|v| v.value_string().ok())
|
||||||
|
.unwrap_or_else(|| default.to_owned())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn remote_deploy(_matches: ArgMatches, hostname: &str) -> MizeResult<()> {
|
||||||
|
let config_src = cfg_str("c2vi.config_src")?;
|
||||||
|
let rsync_excludes = cfg_str("c2vi.rsync_excludes")?;
|
||||||
|
let remote_src_dir = cfg_str(&format!("c2vi.deploy.{hostname}.remote_dir"))?;
|
||||||
|
let mize_store_dir = cfg_str(&format!("c2vi.deploy.{hostname}.mize_store_dir"))?;
|
||||||
|
let rclone_flag = cfg_str_or(&format!("c2vi.deploy.{hostname}.rsync_chown"), "");
|
||||||
|
let bin = cfg_str_or("c2vi.deploy.bin", "mize");
|
||||||
|
let do_mize_restart = false;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
std::env::set_var("SRC", &config_src);
|
||||||
|
std::env::set_var("HOSTNAME", hostname);
|
||||||
|
}
|
||||||
|
|
||||||
|
sh!(echo cmd: rsync -r -u -v -a --delete --perms $rclone_flag --include=".git/" --include=".git/**" --exclude="target" --mkpath $rsync_excludes $config_src/ $hostname:$remote_src_dir)?;
|
||||||
|
sh!(rsync -r -u -v -a --delete --perms $rclone_flag --include=".git/" --include=".git/**" --exclude="target" --mkpath $rsync_excludes $config_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}/mize/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(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn new_deploy(_matches: ArgMatches, hostname: &str) -> MizeResult<()> {
|
||||||
|
let config_src = cfg_str("c2vi.config_src")?;
|
||||||
|
let path = cfg_str(&format!("c2vi.deploy.{hostname}.mize_bin_dir"))?;
|
||||||
|
let is_release = hostname == "mac";
|
||||||
|
let ld_lib_path = std::env::var("LD_LIBRARY_PATH").unwrap_or_default();
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
std::env::set_var("SRC", &config_src);
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_release {
|
||||||
|
sh!(echo cmd: cargo build --manifest-path $config_src/mize/Cargo.toml --bin mize --release)?;
|
||||||
|
sh!(cargo build --manifest-path $config_src/mize/Cargo.toml --bin mize --release)?;
|
||||||
|
sh!(echo cmd: patchelf --set-rpath $ld_lib_path $config_src/mize/target/release/mize)?;
|
||||||
|
let _ = sh!(patchelf --set-rpath $ld_lib_path $config_src/mize/target/release/mize);
|
||||||
|
sh!(echo cmd: scp $config_src/mize/target/release/mize $hostname:$path)?;
|
||||||
|
sh!(scp $config_src/mize/target/release/mize $hostname:$path)?;
|
||||||
|
} else {
|
||||||
|
sh!(echo cmd: cargo build --manifest-path $config_src/mize/Cargo.toml --bin mize)?;
|
||||||
|
sh!(cargo build --manifest-path $config_src/mize/Cargo.toml --bin mize)?;
|
||||||
|
sh!(echo cmd: patchelf --set-rpath $ld_lib_path $config_src/mize/target/debug/mize)?;
|
||||||
|
let _ = sh!(patchelf --set-rpath $ld_lib_path $config_src/mize/target/debug/mize);
|
||||||
|
sh!(echo cmd: scp $config_src/mize/target/debug/mize $hostname:$path)?;
|
||||||
|
sh!(scp $config_src/mize/target/debug/mize $hostname:$path)?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn deploy_spacetime(_: ArgMatches) -> MizeResult<()> {
|
||||||
|
let mize_src = cfg_str("c2vi.mize_src")?;
|
||||||
|
let module_path = cfg_str_or(
|
||||||
|
"c2vi.deploy.spacetime.module_path",
|
||||||
|
&format!("{mize_src}/marts/spacetime"),
|
||||||
|
);
|
||||||
|
let config_src = cfg_str("c2vi.config_src")?;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
std::env::set_var("SRC", &config_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 "spacetime publish -p {module_path} --yes mize" Enter
|
||||||
|
"#
|
||||||
|
);
|
||||||
|
sh!(/bin/sh -c "$cmd")?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn obsidian_deploy(_: ArgMatches) -> MizeResult<()> {
|
||||||
|
let config_src = cfg_str("c2vi.config_src")?;
|
||||||
|
let plugin_dir = cfg_str("c2vi.deploy.obsidian.plugin_dir")?;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
std::env::set_var("SRC", &config_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 {config_src}/mize/apps/obsidian-plugin/deno.json build" Enter
|
||||||
|
tmux send-keys -t mize-deploy "cp -r {config_src}/mize/apps/obsidian-plugin/dist/* {plugin_dir}/" Enter
|
||||||
|
"#
|
||||||
|
);
|
||||||
|
sh!(/bin/sh -c "$cmd")?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn main_deploy(_: ArgMatches) -> MizeResult<()> {
|
||||||
|
let config_src = cfg_str("c2vi.config_src")?;
|
||||||
|
let daemon_env = cfg_str("c2vi.deploy.main.daemon_env")?;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
std::env::set_var("SRC", &config_src);
|
||||||
|
}
|
||||||
|
|
||||||
|
let cmd = format!(
|
||||||
|
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"
|
||||||
|
else
|
||||||
|
echo "using existing session..."
|
||||||
|
fi
|
||||||
|
tmux send-keys -t mize-deploy "cargo build --manifest-path $SRC/mize/Cargo.toml --bin mize" Enter
|
||||||
|
tmux send-keys -t mize-deploy 'echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" > {daemon_env}' Enter
|
||||||
|
tmux send-keys -t mize-deploy "systemctl --user restart mize" Enter
|
||||||
|
"#
|
||||||
|
);
|
||||||
|
sh!(/bin/sh -c "$cmd")?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
74
parts/c2vi/src/generated.rs
Normal file
74
parts/c2vi/src/generated.rs
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
use mize::prelude::*;
|
||||||
|
|
||||||
|
pub struct CliPart {
|
||||||
|
id: MizeId,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl MizePart for CliPart {
|
||||||
|
fn id(&self) -> MizeResult<MizeId> {
|
||||||
|
Ok(self.id.clone())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CliPart {
|
||||||
|
pub fn get(name: &str) -> MizeResult<CliPart> {
|
||||||
|
let mut mize = get_global_mize()?;
|
||||||
|
let part = mize.get_part(name)?;
|
||||||
|
Ok(CliPart { id: part.id()? })
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_command(&self, name: &str) -> MizeResult<()> {
|
||||||
|
let mut args = ItemData::new();
|
||||||
|
args.set_path("0", name.into_item_data())?;
|
||||||
|
dyn_call(self.id.clone(), "set_command", args)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn subcommand<T: Fn(ArgMatches) -> MizeResult<()> + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
subcmd: Command,
|
||||||
|
action: T,
|
||||||
|
) -> MizeResult<()> {
|
||||||
|
let mut subcmd_arg = ItemData::new();
|
||||||
|
subcmd_arg.set_path("_native", subcmd.native_id)?;
|
||||||
|
let action_arg = ItemData::fun(Box::new(move |args: ItemData| {
|
||||||
|
let matches = args.clone().get_path("0")?.native_take_from::<ArgMatches>()?;
|
||||||
|
action(matches)?;
|
||||||
|
Ok(ItemData::new())
|
||||||
|
}))?;
|
||||||
|
let mut args = ItemData::new();
|
||||||
|
args.set_path("0", subcmd_arg)?;
|
||||||
|
args.set_path("1", action_arg)?;
|
||||||
|
dyn_call(self.id.clone(), "subcommand", args)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Command {
|
||||||
|
native_id: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct ArgMatches {
|
||||||
|
#[allow(dead_code)]
|
||||||
|
native_id: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromItemData for ArgMatches {
|
||||||
|
fn from_itemdata(data: ItemData) -> MizeResult<Self> {
|
||||||
|
Ok(ArgMatches {
|
||||||
|
native_id: data.get_path("_native")?.value_u32()?,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Command {
|
||||||
|
pub fn new(name: &str) -> MizeResult<Command> {
|
||||||
|
let mut args = ItemData::new();
|
||||||
|
args.set_path("0", name.into_item_data())?;
|
||||||
|
let mut mize = get_global_mize()?;
|
||||||
|
let id = mize.id_new_dots("cli.Command")?;
|
||||||
|
let data = dyn_call(id, "new", args)?;
|
||||||
|
let native_id: u32 = data.get_path("_native")?.native_take()?;
|
||||||
|
Ok(Command { native_id })
|
||||||
|
}
|
||||||
|
}
|
||||||
152
parts/c2vi/src/mpart.rs
Normal file
152
parts/c2vi/src/mpart.rs
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
mod dash;
|
||||||
|
mod deploy;
|
||||||
|
mod generated;
|
||||||
|
|
||||||
|
use generated::{CliPart, Command};
|
||||||
|
use mize::prelude::*;
|
||||||
|
|
||||||
|
fn ensure_default(rel: &str, default: ItemData) -> MizeResult<()> {
|
||||||
|
let mut mize = get_global_mize()?;
|
||||||
|
let cur = mize
|
||||||
|
.cur_eval_part()?
|
||||||
|
.ok_or_else(|| mize_err!("no cur_eval_part"))?;
|
||||||
|
let full = format!("{}.{}", cur.dot(), rel);
|
||||||
|
if mize.get_config(&full).is_ok() {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
let segs: Vec<&str> = rel.split('.').filter(|s| !s.is_empty()).collect();
|
||||||
|
let last = *segs.last().ok_or_else(|| mize_err!("empty opt path"))?;
|
||||||
|
let mut parent = cur.clone();
|
||||||
|
for seg in &segs[..segs.len() - 1] {
|
||||||
|
parent = parent.join(seg)?;
|
||||||
|
}
|
||||||
|
let original = Some(cur);
|
||||||
|
mize.set_cur_eval_part(Some(parent))?;
|
||||||
|
opt(last).default_val(default);
|
||||||
|
mize.set_cur_eval_part(original)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn declare_deploy_defaults() -> MizeResult<()> {
|
||||||
|
ensure_default("mize_src", "/home/me/work/config/mize".into_item_data())?;
|
||||||
|
ensure_default("config_src", "/home/me/work/config".into_item_data())?;
|
||||||
|
ensure_default(
|
||||||
|
"rsync_excludes",
|
||||||
|
"--exclude=node_modules --exclude=target --exclude=mize_config.toml --exclude=rust_dist --exclude=deno_dist --exclude=dist --exclude=result --exclude=pkg --exclude /src --exclude obsidian-brat --exclude forked-zed".into_item_data(),
|
||||||
|
)?;
|
||||||
|
ensure_default("dash.enable", false.into_item_data())?;
|
||||||
|
ensure_default("deploy.bin", "mize".into_item_data())?;
|
||||||
|
|
||||||
|
ensure_default("deploy.te.remote_dir", "/home/me/here/config".into_item_data())?;
|
||||||
|
ensure_default("deploy.te.mize_store_dir", "/home/me/host/mize".into_item_data())?;
|
||||||
|
ensure_default("deploy.te.rsync_chown", "".into_item_data())?;
|
||||||
|
|
||||||
|
ensure_default("deploy.mac.remote_dir", "/data/external/config".into_item_data())?;
|
||||||
|
ensure_default("deploy.mac.mize_store_dir", "/home/me/host/mize".into_item_data())?;
|
||||||
|
ensure_default("deploy.mac.rsync_chown", "".into_item_data())?;
|
||||||
|
ensure_default("deploy.mac.mize_bin_dir", "/home/me/here/mize".into_item_data())?;
|
||||||
|
|
||||||
|
ensure_default(
|
||||||
|
"deploy.files.remote_dir",
|
||||||
|
"/home/files/here/config".into_item_data(),
|
||||||
|
)?;
|
||||||
|
ensure_default(
|
||||||
|
"deploy.files.mize_store_dir",
|
||||||
|
"/home/files/storage/files/mize".into_item_data(),
|
||||||
|
)?;
|
||||||
|
ensure_default("deploy.files.rsync_chown", "".into_item_data())?;
|
||||||
|
|
||||||
|
ensure_default(
|
||||||
|
"deploy.ppc-hosting.remote_dir",
|
||||||
|
"/root/host/c2vi-config".into_item_data(),
|
||||||
|
)?;
|
||||||
|
ensure_default(
|
||||||
|
"deploy.ppc-hosting.mize_store_dir",
|
||||||
|
"/root/host/mize".into_item_data(),
|
||||||
|
)?;
|
||||||
|
ensure_default(
|
||||||
|
"deploy.ppc-hosting.rsync_chown",
|
||||||
|
"--chown=root:root".into_item_data(),
|
||||||
|
)?;
|
||||||
|
|
||||||
|
ensure_default(
|
||||||
|
"deploy.nico.remote_dir",
|
||||||
|
"/root/work/config-c2vi".into_item_data(),
|
||||||
|
)?;
|
||||||
|
ensure_default(
|
||||||
|
"deploy.nico.mize_store_dir",
|
||||||
|
"/root/work/app-data/mize".into_item_data(),
|
||||||
|
)?;
|
||||||
|
ensure_default(
|
||||||
|
"deploy.nico.rsync_chown",
|
||||||
|
"--chown=root:root".into_item_data(),
|
||||||
|
)?;
|
||||||
|
|
||||||
|
ensure_default(
|
||||||
|
"deploy.main.daemon_env",
|
||||||
|
"/home/me/work/app-data/mize/daemon.env".into_item_data(),
|
||||||
|
)?;
|
||||||
|
ensure_default(
|
||||||
|
"deploy.obsidian.plugin_dir",
|
||||||
|
"/home/me/work/things/.obsidian/plugins/mize".into_item_data(),
|
||||||
|
)?;
|
||||||
|
ensure_default(
|
||||||
|
"deploy.spacetime.module_path",
|
||||||
|
"/home/me/work/config/mize/marts/spacetime".into_item_data(),
|
||||||
|
)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[unsafe(no_mangle)]
|
||||||
|
pub extern "C" fn part_c2vi() -> MizeResult<()> {
|
||||||
|
declare_deploy_defaults()?;
|
||||||
|
|
||||||
|
let cli = CliPart::get("cli")?;
|
||||||
|
cli.set_command("dev")?;
|
||||||
|
|
||||||
|
cli.subcommand(Command::new("deploy-lush")?, |m| deploy::remote_deploy(m, "te"))?;
|
||||||
|
cli.subcommand(Command::new("dlu")?, |m| deploy::remote_deploy(m, "te"))?;
|
||||||
|
|
||||||
|
cli.subcommand(Command::new("deploy-mac")?, |m| deploy::new_deploy(m, "mac"))?;
|
||||||
|
cli.subcommand(Command::new("dmc")?, |m| deploy::new_deploy(m, "mac"))?;
|
||||||
|
|
||||||
|
cli.subcommand(Command::new("deploy-files")?, |m| {
|
||||||
|
deploy::remote_deploy(m, "files")
|
||||||
|
})?;
|
||||||
|
cli.subcommand(Command::new("dfi")?, |m| deploy::remote_deploy(m, "files"))?;
|
||||||
|
|
||||||
|
cli.subcommand(Command::new("deploy-ppc")?, |m| {
|
||||||
|
deploy::remote_deploy(m, "ppc-hosting")
|
||||||
|
})?;
|
||||||
|
cli.subcommand(Command::new("dpp")?, |m| {
|
||||||
|
deploy::remote_deploy(m, "ppc-hosting")
|
||||||
|
})?;
|
||||||
|
|
||||||
|
cli.subcommand(Command::new("deploy-nico")?, |m| {
|
||||||
|
deploy::remote_deploy(m, "nico")
|
||||||
|
})?;
|
||||||
|
cli.subcommand(Command::new("dni")?, |m| deploy::remote_deploy(m, "nico"))?;
|
||||||
|
|
||||||
|
cli.subcommand(Command::new("deploy-main")?, deploy::main_deploy)?;
|
||||||
|
cli.subcommand(Command::new("dma")?, deploy::main_deploy)?;
|
||||||
|
|
||||||
|
cli.subcommand(Command::new("deploy-obsidian")?, deploy::obsidian_deploy)?;
|
||||||
|
cli.subcommand(Command::new("do")?, deploy::obsidian_deploy)?;
|
||||||
|
|
||||||
|
cli.subcommand(Command::new("deploy-spacetime")?, deploy::deploy_spacetime)?;
|
||||||
|
cli.subcommand(Command::new("dsp")?, deploy::deploy_spacetime)?;
|
||||||
|
|
||||||
|
#[cfg(feature = "desktop")]
|
||||||
|
{
|
||||||
|
let enable = get_global_mize()?
|
||||||
|
.get_config("c2vi.dash.enable")
|
||||||
|
.ok()
|
||||||
|
.and_then(|v| v.value_bool().ok())
|
||||||
|
.unwrap_or(false);
|
||||||
|
if enable {
|
||||||
|
dash::launch_c2vi_dashboard();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
1
parts/vicinae
Submodule
1
parts/vicinae
Submodule
Submodule parts/vicinae added at 8c63ae2ef1
@@ -18,6 +18,11 @@ in rec {
|
|||||||
src = /home/me/work/config/gitignore/runc;
|
src = /home/me/work/config/gitignore/runc;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
myEmacs = pkgsUnstable.emacs-pgtk.override {
|
||||||
|
withXwidgets = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
qtrs = pkgs.stdenv.mkDerivation {
|
qtrs = pkgs.stdenv.mkDerivation {
|
||||||
name = "qt rust bindings";
|
name = "qt rust bindings";
|
||||||
|
|
||||||
|
|||||||
@@ -108,13 +108,13 @@
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"context": "((os != macos && Editor) && edit_prediction_conflict)",
|
"context": "((os != macos && Editor) && (edit_prediction && (showing_completions || in_leading_whitespace)))",
|
||||||
"bindings": {
|
"bindings": {
|
||||||
//"ctrl-l": "editor::AcceptEditPrediction"
|
//"ctrl-l": "editor::AcceptEditPrediction"
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"context": "((os != macos && Editor) && edit_prediction_conflict)",
|
"context": "((os != macos && Editor) && (edit_prediction && (showing_completions || in_leading_whitespace)))",
|
||||||
"bindings": {
|
"bindings": {
|
||||||
"ctrl-i": "editor::AcceptEditPrediction",
|
"ctrl-i": "editor::AcceptEditPrediction",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -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",
|
||||||
@@ -271,13 +285,14 @@
|
|||||||
"rust-analyzer": {
|
"rust-analyzer": {
|
||||||
"initialization_options": {
|
"initialization_options": {
|
||||||
"cargo": {
|
"cargo": {
|
||||||
"features": "all"
|
"features": "all",
|
||||||
|
"targetDir": "zed-target"
|
||||||
},
|
},
|
||||||
"check": {
|
"check": {
|
||||||
"features": "all"
|
"features": "all"
|
||||||
},
|
},
|
||||||
"rust": {
|
"rust": {
|
||||||
"analyzerTargetDir": true
|
"analyzerTargetDir": "target/analyzer"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user