Compare commits

..

8 Commits

Author SHA1 Message Date
Sebastian Moser
72a707299f ... 2026-11-02 21:53:31 +01:00
Sebastian Moser
a347145348 stuff 2026-10-22 22:18:58 +02:00
Sebastian Moser
3307802360 update AGENTS.md 2026-10-22 11:05:54 +02:00
Sebastian Moser
f4662022a8 added AGENTS.md 2026-10-22 11:04:52 +02:00
Sebastian Moser
318ed7da50 emacs stuff 2026-10-06 00:47:48 +02:00
Sebastian Moser
a78d55965c . 2026-10-05 02:01:03 +02:00
Sebastian Moser
2139920fbc changes 2026-10-02 22:09:50 +02:00
Sebastian Moser
28986507c9 all recent config changes 2026-09-16 21:34:44 +00:00
156 changed files with 13113 additions and 12551 deletions

View File

@@ -1 +1 @@
flake-profile-16-link
flake-profile-28-link

View File

@@ -1 +0,0 @@
/nix/store/3yjs9x851rdcql4lrlhb77075l1a8zn4-nix-shell-env

View File

@@ -0,0 +1 @@
/nix/store/hi26lq3gdw91m2zjx6yx0czi0k5d9w2f-nix-shell-env

12
.gitmodules vendored
View File

@@ -13,3 +13,15 @@
[submodule "forked-zed"]
path = forked-zed
url = git@github.com:c2vi/zed.git
[submodule "src/zmk"]
path = src/zmk
url = https://github.com/zmkfirmware/zmk.git
[submodule "doom"]
path = doom
url = https://github.com/doomemacs/core
[submodule "src/doom"]
path = src/doom
url = https://github.com/doomemacs/core
[submodule "src/vicinae"]
path = parts/vicinae
url = git@github.com:ppc-social/vicinae.git

24
.zed/settings.json Normal file
View File

@@ -0,0 +1,24 @@
// Folder-specific settings
//
// For a full list of overridable settings, and general information on folder-specific settings,
// see the documentation: https://zed.dev/docs/configuring-zed#settings-files
{
"lsp": {
"rust-analyzer": {
"initialization_options": {
"linkedProjects": [
"mize/Cargo.toml",
"Cargo.toml",
],
"cargo": {
//"features": [ "target-js", "target-obsidian" ]
//"features": "all"
},
"check": {
//"features": [ "target-js", "target-obsidian" ]
//"features": "all"
},
}
}
}
}

25
AGENTS.md Normal file
View 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.

3764
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,11 @@
[workspace]
members = [
"mize/mize",
"mize/marts",
"mize/macros",
"generated",
"dev-part",
"mize/marts/spacetime",
"parts/*",
]
resolver = "2"
exclude = [
"parts/vicinae",
]
[workspace.dependencies]
mize = { path = "./mize/core" }

3
apps/wireshark Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
exec sudo -E /usr/sbin/wireshark -P "persconf:$CONFIG_DIR/apps/wireshark-config" -P "persdata:$DATA_DIR/wireshark" "$@"

View File

@@ -0,0 +1,10 @@
local config_dir = os.getenv("CONFIG_DIR")
critical("This is a critical issue message!")
print("hello world!")
global run_user_scripts_when_superuser=true
-- qmi plugin
dofile(config_dir .. "/apps/wireshark-config/qmi.lua")

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,155 @@
# Recent settings file for Wireshark 4.7.3.
#
# This file is regenerated each time Wireshark is quit
# and when changing configuration profile.
# So be careful, if you want to make manual changes here.
# Main Toolbar show (hide).
# true or false (case-insensitive).
gui.toolbar_main_show: true
# Filter Toolbar show (hide).
# true or false (case-insensitive).
gui.filter_toolbar_show: true
# Wireless Settings Toolbar show (hide).
# true or false (case-insensitive).
gui.wireless_toolbar_show: false
# Packet list show (hide).
# true or false (case-insensitive).
gui.packet_list_show: true
# Tree view show (hide).
# true or false (case-insensitive).
gui.tree_view_show: true
# Byte view show (hide).
# true or false (case-insensitive).
gui.byte_view_show: true
# Packet diagram show (hide).
# true or false (case-insensitive).
gui.packet_diagram_show: true
# Statusbar show (hide).
# true or false (case-insensitive).
gui.statusbar_show: true
# Packet list colorize (hide).
# true or false (case-insensitive).
gui.packet_list_colorize: true
# Auto scroll packet list when capturing.
# true or false (case-insensitive).
capture.auto_scroll: true
# use as aggregation view.
# true or false (case-insensitive).
capture.aggregation_view: false
# Timestamp display format.
# One of: RELATIVE, RELATIVE_CAP, ABSOLUTE, ABSOLUTE_WITH_YMD, ABSOLUTE_WITH_YDOY, ABSOLUTE_WITH_DATE, DELTA, DELTA_DIS, EPOCH, UTC, UTC_WITH_YMD, UTC_WITH_YDOY, UTC_WITH_DATE
gui.time_format: RELATIVE
# Timestamp display precision.
# One of: AUTO, SEC, DSEC, CSEC, MSEC, USEC, NSEC, or a number between 0 and 9
gui.time_precision: AUTO
# Seconds display format.
# One of: SECONDS, HOUR_MIN_SEC
gui.seconds_format: SECONDS
# Zoom level.
# A decimal number.
gui.zoom_level: 0
# Bytes view display type.
# One of: HEX, BITS, DEC, OCT
gui.bytes_view: HEX
# Bytes view text encoding.
# One of: FROM_PACKET, ASCII, EBCDIC
gui.bytes_encoding: FROM_PACKET
# Packet diagram field values show (hide).
# true or false (case-insensitive).
gui.packet_diagram_field_values: false
# Allow hover selection in byte view.
# true or false (case-insensitive).
gui.allow_hover_selection: true
# Follow stream show as.
# One of: ASCII, ASCII_CONTROL, C_ARRAYS, EBCDIC, HEX_DUMP, HTML, IMAGE, JSON, RAW, RUST_ARRAY, UTF-8, YAML
gui.follow_show: ASCII
# Follow stream delta times.
# One of: NONE, TURN, ALL
gui.follow_delta: NONE
# Show packet bytes decode as.
# One of: NONE, BASE64, COMPRESSED, HEX_DIGITS, PERCENT_ENCODING, QUOTED_PRINTABLE, ROT13
gui.show_bytes_decode: NONE
# Show packet bytes show as.
# One of: ASCII, ASCII_CONTROL, C_ARRAYS, EBCDIC, HEX_DUMP, HTML, IMAGE, JSON, RAW, RUST_ARRAY, UTF-8, YAML
gui.show_bytes_show: ASCII
# Main window upper (or leftmost) pane size.
# Decimal number.
# Main window middle pane size.
# Decimal number.
# Packet list column pixel widths.
# Each pair of strings consists of a column format and its pixel width.
column.width:
%m, -1,
%t, -1,
%Gt, -1,
%s, -1,
%d, -1,
%p, -1,
%L, -1,
%i, -1
# Open conversation dialog tabs.
# List of conversation names, e.g. "TCP", "IPv6".
gui.conversation_tabs:
# Conversation dialog tabs columns.
# List of conversation columns numbers.
gui.conversation_tabs_columns:
# Open endpoint dialog tabs.
# List of endpoint names, e.g. "TCP", "IPv6".
gui.endpoint_tabs:
# Endpoint dialog tabs columns.
# List of endpoint columns numbers.
gui.endpoint_tabs_columns:
# For RLC stats, whether to use RLC PDUs found inside MAC frames.
# true or false (case-insensitive).
gui.rlc_pdus_from_mac_frames: false
# Additional Toolbars shown
# List of additional toolbars to show.
gui.additional_toolbar_show:
# Interface Toolbars show.
# List of interface toolbars to show.
gui.interface_toolbar_show:
# TCP Stream Graphs Moving Average Window Size.
gui.tsd_ma_window_size: 1
# TCP Stream Graphs Dialog Throughput show (hide).
# true or false (case-insensitive).
gui.tsd_throughput_show: true
# TCP Stream Graphs Dialog Goodput show (hide).
# true or false (case-insensitive).
gui.tsd_goodput_show: false

View File

@@ -0,0 +1,141 @@
# Common recent settings file for Wireshark 4.7.3.
#
# This file is regenerated each time Wireshark is quit
# and when changing configuration profile.
# So be careful, if you want to make manual changes here.
######## Recent capture files (latest last), cannot be altered through command line ########
recent.capture_file: /home/me/hi.pcapng
recent.capture_file: /home/me/nm-connection-up.pcapng
recent.capture_file: /home/me/nm-connection-down.pcapng
recent.capture_file: /home/me/modemmanager-stop.pcapng
######## Recent capture filters (latest first), cannot be altered through command line ########
######## Recent display filters (latest last), cannot be altered through command line ########
recent.display_filter: qmi
recent.display_filter: qmi.message_id == 0x0020 && qmi.service_id == 0x01
recent.display_filter: qmi.service_id
recent.display_filter: qmi.message_id == 0x0020
recent.display_filter: qmi.message_id
recent.display_filter: qmi &&
recent.display_filter: usb.device_address == 18
recent.display_filter: usb.device_address
# Main window geometry.
# Decimal numbers.
gui.geometry_main_x: 1920
gui.geometry_main_y: 0
gui.geometry_main_width: 619
gui.geometry_main_height: 436
# Main window maximized.
# true or false (case-insensitive).
gui.geometry_main_maximized: true
# Leftalign Action Buttons.
# true or false (case-insensitive).
gui.geometry_leftalign_actions: false
# Last used Configuration Profile.
gui.last_used_profile: Default
# Number of packets or events to check for automatic profile switching.
# Decimal number. Zero disables switching.
#gui.profile_switch_check_count: 1000
# Warn if running with elevated permissions (e.g. as root).
# true or false (case-insensitive).
privs.warn_if_elevated: true
# Warn if Wireshark is unable to capture.
# true or false (case-insensitive).
sys.warn_if_no_capture: true
# Find packet search in.
# One of: PACKET_LIST, PACKET_DETAILS, PACKET_BYTES
gui.search_in: PACKET_LIST
# Find packet character set.
# One of: NARROW_AND_WIDE, NARROW, WIDE
gui.search_char_set: NARROW_AND_WIDE
# Find packet case sensitive search.
# true or false (case-insensitive).
gui.search_case_sensitive: false
# Find packet search reverse direction.
# true or false (case-insensitive).
gui.search_reverse_dir: false
# Find packet search multiple occurrences.
# true or false (case-insensitive).
gui.search_multiple_occurs: false
# Find packet search type.
# One of: DISPLAY_FILTER, HEX_VALUE, STRING, REGEX
gui.search_type: DISPLAY_FILTER
# Welcome page sidebar Learn section visible.
# true or false (case-insensitive).
gui.welcome_page.sidebar.learn_visible: true
# Welcome page sidebar Tips section visible.
# true or false (case-insensitive).
gui.welcome_page.sidebar.tips_visible: true
# Welcome page sidebar Tips event slides.
# true or false (case-insensitive).
gui.welcome_page.sidebar.tips_events: true
# Welcome page sidebar Tips sponsorship slides.
# true or false (case-insensitive).
gui.welcome_page.sidebar.tips_sponsorship: true
# Welcome page sidebar Tips tip-of-the-day slides.
# true or false (case-insensitive).
gui.welcome_page.sidebar.tips_tips: true
# Welcome page sidebar Tips auto advance slides.
# true or false (case-insensitive).
gui.welcome_page.sidebar.tips_auto_advance: true
# Welcome page sidebar Tips slide auto-advance interval in seconds.
gui.welcome_page.sidebar.tips_interval: 8
# Active theme (directory name under resources/themes).
gui.theme_name: wireshark
# Appearance mode.
# One of: system, light, dark
gui.color_scheme: system
# Welcome page sidebar Tips slides test.
# true or false (case-insensitive).
gui.welcome_page.sidebar.tips_slides_test: false
# Geometry and maximized state of Lua Console window.
# Decimal integers.
gui.geom.Lua Console.x: 1920
gui.geom.Lua Console.y: 0
gui.geom.Lua Console.width: 523
gui.geom.Lua Console.height: 865
# true or false (case-insensitive).
gui.geom.Lua Console.maximized: false
# Qt Geometry State (hex byte string).
gui.geom.Lua Console.qt_geometry: 01d9d0cb0003000000000780000000000000098a0000036000000780000000000000098a000003600000000102000000078000000780000000000000098a00000360
# Custom colors.
# List of custom colors selected in Qt color picker.
gui.custom_colors:
"ffffffff", "ffffffff",
"ffffffff", "ffffffff",
"ffffffff", "ffffffff",
"ffffffff", "ffffffff",
"ffffffff", "ffffffff",
"ffffffff", "ffffffff",
"ffffffff", "ffffffff",
"ffffffff", "ffffffff"

32
bin/mize Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
# do special stuff if it is run as a daemon by runit.
if [[ -v IS_RUNIT ]]; then
exec 2>$LOG_DIR/mize
exec 1>$LOG_DIR/mize
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
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=$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/
# 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 "$@"

View File

@@ -11,7 +11,7 @@
{ lib, pkgs, nur, unstable, inputs, config, ... }:
let
newerUnstableSrc = builtins.getFlake "nixpkgs/d0fc30899600b9b3466ddb260fd83deb486c32f1";
newerUnstableSrc = builtins.getFlake "nixpkgs/d23e2536a100b5108d22367a9c28785f48e3e4c8";
newerUnstable = import newerUnstableSrc.outPath {};
mySway = newerUnstable.sway;
@@ -313,11 +313,11 @@ output "HDMI-A-1" {
}
#################### end from nwg-display
set $disp2 "DP-1"
set $disp1 "eDP-1"
set $disp2 "eDP-1"
set $disp1 "DP-1"
workspace 7 output eDP-1
workspace 0 output HEADLESS-1
workspace 0 output eDP-1
### Input configuration
input type:keyboard {
@@ -384,11 +384,11 @@ output "HDMI-A-1" {
### Key bindings
# ppc ne
bindsym F12 exec ppc ne
bindsym F11 exec ppc ne -b
bindsym XF86AudioRaiseVolume exec ppc ne
bindsym XF86AudioLowerVolume exec ppc ne -b
# sci ne
bindsym F12 exec mize run sci ne
bindsym F11 exec mize run sci ne -b
bindsym XF86AudioRaiseVolume exec mize run sci ne
bindsym XF86AudioLowerVolume exec mize run sci ne -b
# QuickLaunch
bindsym $mod+i mode "QuickLaunch"
@@ -397,7 +397,7 @@ output "HDMI-A-1" {
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 $mod+Shift+Return exec $term
@@ -502,11 +502,15 @@ output "HDMI-A-1" {
bindsym $mod+Shift+0 move container to workspace number 10
# default display outputs for workspaces with fallback to disp1
workspace 1 output $disp2 $disp1
workspace 6 output $disp2 $disp1
workspace 4 output $disp2 $disp1
workspace 8 output $disp2 $disp1
workspace 9 output $disp2 $disp1
workspace 1 output eDP-1
workspace 6 output eDP-1
workspace 4 output eDP-1
workspace 8 output eDP-1
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 0 output eDP-1

8167
dev-part/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,24 +0,0 @@
[package]
name = "c2vi-dev-part"
version = "0.1.0"
edition = "2024"
[lib]
name = "c2vi_part"
path = "dpart.rs"
[dependencies]
mize = { path = "../mize/mize" }
marts = { path = "../mize/marts" }
cmd_lib = "2.0.0"
indoc = "2.0.7"
clap = "4.6.1"
ciborium = "0.2.2"
dioxus = { version = "0.7.9", features = ["desktop"] }
tracing = "0.1.44"
chrono = "0.4.45"
[features]
target-os = []
target-js = []
target-obsidian = []

View File

@@ -1,2 +0,0 @@
name = "c2vi"

View File

@@ -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::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/packages/ppc/platform/obsidian/deno.json build" Enter
tmux send-keys -t mize-deploy "cp -r {SRC}/mize/packages/ppc/platform/obsidian/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::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::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::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(&notes_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(&notes_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(&notes_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));
}
}

View File

@@ -1,3 +0,0 @@
fn main() {
println!("Hello, world!");
}

View File

@@ -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 {
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 KiB

454
doomdir/config.el Normal file
View File

@@ -0,0 +1,454 @@
;;; relative line numbers
(setq display-line-numbers 'relative)
;;; set my org directory
(setq org-directory "~/work/things/org")
;;; set my name and email
(setq user-full-name "Sebastian Moser"
user-mail-address "c2vi.dev@gmail.com")
;;; theme
(setq doom-theme 'doom-one)
;;; C-p to be M-x
(map! "C-p" #'execute-extended-command)
;;(map! :leader "a" #'execute-extended-command)
;;(map! :nv ":" #'execute-extended-command)
(after! evil
;;(map! :nv ":" #'execute-extended-command)
(map! :gnv "C-p" #'execute-extended-command)
)
;;; projectile find file - quick switcher
(after! 'better-jumper
(map! :gnv "C-i" #'projectile-find-file)
)
(with-eval-after-load 'projectile
(add-to-list 'projectile-globally-ignored-directories "node_modules")
(add-to-list 'projectile-globally-ignored-directories ".obsidian")
(setq projectile-indexing-method 'native)
)
;;; obsidian
(after! obsidian
(setq obsidian-directory "~/work/things"
obsidian-inbox-directory "semi-public"
markdown-enable-wiki-links t
)
(global-obsidian-mode t)
)
;;; clipboard
(after! evil
(setq interprogram-cut-function nil
interprogram-paste-function nil)
)
(defun my/clipboard-copy (beg end)
"Copy region to the OS clipboard (bypassing the kill-ring)."
(interactive "r")
(let ((text (buffer-substring-no-properties beg end))
(inhibit-message t))
(gui-select-text text)
(deactivate-mark)
(when (called-interactively-p 'any)
(message "Copied to clipboard: %d chars" (length text)))))
(defun my/clipboard-paste ()
"Paste from the OS clipboard, replacing the region if active."
(interactive)
(let ((text (gui-get-selection 'CLIPBOARD)))
(unless text
(user-error "OS clipboard is empty"))
(when (use-region-p)
(delete-region (region-beginning) (region-end)))
(insert-for-yank text)))
(map! :v "C-c" #'my/clipboard-copy
:v "C-v" #'my/clipboard-paste
:i "C-v" #'my/clipboard-paste) ; insert-state paste, terminal-style
;;; in buffer completions
(setq tab-always-indent 'complete)
(after! corfu
; possible: basic, initials, orderless, partial-completion substring, flex
(setq completion-styles '(orderless flex partial-completion substring))
(setq corfu-cycle t
corfu-preview-current nil
corfu-min-width 20
corfu-on-exact-match 'insert
corfu-quit-no-match t
corfu-quit-at-boundary t
corfu-popupinfo-delay '(1.25 . 0.5))
(corfu-popupinfo-mode 1)
;; history-based sorting, persisted across restarts
(corfu-history-mode 1)
(after! savehist
(add-to-list 'savehist-additional-variables 'corfu-history)))
;;; C-i to pick first completion thing
(after! corfu
(defun my/corfu-insert-first ()
"Insert the first candidate immediately."
(interactive)
(corfu-next)
(corfu-insert)
)
(map! :map corfu-map
"<insert-state> C-i" #'my/corfu-insert-first
)
)
;;; better eval mappings
(map! :leader "m e" #'eval-last-sexp)
(map! :leader "m r" #'eval-print-last-sexp)
;;;; font/zoom
(setq doom-font (font-spec
;:family "Hack Mono"
:size 23 :weight 'regular))
;;; 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")
))
)
;;; 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
View 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.
)

205
doomdir/init.el Normal file
View File

@@ -0,0 +1,205 @@
;;; $DOOMDIR/init.el -*- lexical-binding: t; -*-
;; This file controls what Doom modules are enabled and what order they load
;; in. Remember to run 'doom sync' after modifying it!
;; NOTE: Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's
;; documentation. There you'll find a link to Doom's Module Index where all of
;; our modules are listed, including what flags they support.
;; NOTE: Move your cursor over a module's name (or its flags) and press 'K' (or
;; 'C-c c k' for non-vim users) to view its documentation. This works on flags
;; as well (those symbols that start with a plus).
;;
;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its
;; directory (for easy access to its source code).
(doom! :input
;;bidi ; (tfel ot) thgir etirw uoy gnipleh
;;chinese
;;japanese
;;layout ; auie,ctsrnm is the superior home row
:completion
;;company ; the ultimate code completion backend
(corfu +orderless) ; complete with cap(f), cape and a flying feather!
;;helm ; the *other* search engine for love and life
;;ido ; the other *other* search engine...
;;ivy ; a search engine for love and life
vertico ; the search engine of the future
:ui
;;deft ; notational velocity for Emacs
doom ; what makes DOOM look the way it does
dashboard ; a nifty splash screen for Emacs
;;doom-quit ; DOOM quit-message prompts when you quit Emacs
;;(emoji +unicode) ; 🙂
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
;;indent-guides ; highlighted indent columns
;;ligatures ; ligatures and symbols to make your code pretty again
;;minimap ; show a map of the code on the side
modeline ; snazzy, Atom-inspired modeline, plus API
;;nav-flash ; blink cursor line after big motions
;;neotree ; a project drawer, like NERDTree for vim
ophints ; highlight the region an operation acts on
(popup +defaults) ; tame sudden yet inevitable temporary windows
;;smooth-scroll ; So smooth you won't believe it's not butter
;;tabs ; a tab bar for Emacs
;;treemacs ; a project drawer, like neotree but cooler
;;unicode ; extended unicode support for various languages
(vc-gutter +pretty) ; vcs diff in the fringe
vi-tilde-fringe ; fringe tildes to mark beyond EOB
;;window-select ; visually switch windows
workspaces ; tab emulation, persistence & separate workspaces
zen ; distraction-free coding or writing
:editor
(evil +everywhere); come to the dark side, we have cookies
file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding
;;(format +onsave) ; automated prettiness
;;god ; run Emacs commands without modifier keys
;;lispy ; vim for lisp, for people who don't like vim
;;multiple-cursors ; editing in many places at once
;;objed ; text object editing for the innocent
;;parinfer ; turn lisp into python, sort of
;;rotate-text ; cycle region at point between text candidates
snippets ; my elves. They type so I don't have to
(whitespace +guess +trim) ; a butler for your whitespace
;;word-wrap ; soft wrapping with language-aware indent
:emacs
dired ; making dired pretty [functional]
electric ; smarter, keyword-based electric-indent
;;eww ; the internet is gross
;;ibuffer ; interactive buffer management
tramp ; remote files at your arthritic fingertips
undo ; persistent, smarter undo for your inevitable mistakes
vc ; version-control and Emacs, sitting in a tree
:term
;;eshell ; the elisp shell that works everywhere
;;shell ; simple shell REPL for Emacs
;;term ; basic terminal emulator for Emacs
;;vterm ; almost the best terminal emulation in Emacs
;;ghostel ; the best terminal emulation in Emacs
:checkers
syntax ; tasing you for every semicolon you forget
;;(spell +flyspell) ; tasing you for misspelling mispelling
;;grammar ; tasing grammar mistake every you make
:tools
;;ansible
;;biblio ; Writes a PhD for you (citation needed)
;;collab ; buffers with friends
;;debugger ; stepping through code, to help you add bugs
;;direnv
;;docker
;;editorconfig ; let someone else argue about tabs vs spaces
;;ein ; tame Jupyter notebooks with emacs
(eval +overlay) ; run code, run (also, repls)
lookup ; navigate your code and its documentation
;;llm ; when I said you needed friends, I didn't mean...
;;(lsp +eglot) ; M-x vscode
magit ; a git porcelain for Emacs
;;make ; run make tasks from Emacs
;;pass ; password manager for nerds
;;pdf ; pdf enhancements
;;terraform ; infrastructure as code
;;tmux ; an API for interacting with tmux
;;tree-sitter ; syntax and parsing, sitting in a tree...
;;upload ; map local to remote projects via ssh/ftp
:os
(:if (featurep :system 'macos) macos) ; improve compatibility with macOS
;;tty ; improve the terminal Emacs experience
:lang
;;ada ; In strong typing we (blindly) trust
;;(agda +local) ; types of types of types of types...
;;beancount ; mind the GAAP
;;(cc +lsp) ; C > C++ == 1
;;clojure ; java with a lisp
;;common-lisp ; if you've seen one lisp, you've seen them all
;;coq ; proofs-as-programs
;;crystal ; ruby at the speed of c
;;csharp ; unity, .NET, and mono shenanigans
;;data ; config/data formats
;;(dart +flutter) ; paint ui and not much else
;;dhall
;;elixir ; erlang done right
;;elm ; care for a cup of TEA?
emacs-lisp ; drown in parentheses
;;erlang ; an elegant language for a more civilized age
;;ess ; emacs speaks statistics
;;factor
;;faust ; dsp, but you get to keep your soul
;;fortran ; in FORTRAN, GOD is REAL (unless declared INTEGER)
;;fsharp ; ML stands for Microsoft's Language
;;fstar ; (dependent) types and (monadic) effects and Z3
;;gdscript ; the language you waited for
;;(go +lsp) ; the hipster dialect
;;(graphql +lsp) ; Give queries a REST
;;(haskell +lsp) ; a language that's lazier than I am
;;hy ; readability of scheme w/ speed of python
;;idris ; a language you can depend on
;;json ; At least it ain't XML
;;janet ; Fun fact: Janet is me!
;;(java +lsp) ; the poster child for carpal tunnel syndrome
;;javascript ; all(hope(abandon(ye(who(enter(here))))))
;;julia ; a better, faster MATLAB
;;kotlin ; a better, slicker Java(Script)
latex ; writing papers in Emacs has never been so fun
;;lean ; for folks with too much to prove
;;ledger ; be audit you can be
lua ; one-based indices? one-based indices
(markdown +grip) ; writing docs for people to ignore
;;nim ; python + lisp at the speed of c
;;nix ; I hereby declare "nix geht mehr!"
;;ocaml ; an objective camel
;;odin ; C, minus its footguns
(org +contacts) ; organize your plain life in plain text
;;php ; perl's insecure younger brother
;;plantuml ; diagrams for confusing people more
;;graphviz ; diagrams for confusing yourself even more
;;purescript ; javascript, but functional
python ; beautiful is better than ugly
;;qt ; the 'cutest' gui framework ever
;;racket ; a DSL for DSLs
;;raku ; the artist formerly known as perl6
;;rest ; Emacs as a REST client
;;rst ; ReST in peace
;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
;;(rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
;;scad ; trust the preview, regret the render
;;scala ; java, but good
;;(scheme +guile) ; a fully conniving family of lisps
sh ; she sells {ba,z,fi}sh shells on the C xor
;;sml
;;solidity ; do you need a blockchain? No.
;;swift ; who asked for emoji variables?
;;terra ; Earth and Moon in alignment for performance.
web ; the tubes
yaml ; JSON, but readable
;;zig ; C, but simpler
:email
(mu4e +org +gmail)
;;notmuch
;;(wanderlust +gmail)
:app
;;calendar
;;emms
;;everywhere ; *leave* Emacs!? You must be joking
;;irc ; how neckbeards socialize
;;(rss +org) ; emacs as an RSS reader
:config
;;literate
(default +bindings +smartparens))
;; If you're a dark-mode user who suffers from the "flash of white Emacs" when
;; you first open Emacs, uncomment this (and adjust the color as you like).
;; (add-to-list 'initial-frame-alist '(background-color . "#000000"))

92
doomdir/packages.el Normal file
View File

@@ -0,0 +1,92 @@
;;; $DOOMDIR/packages.el -*- lexical-binding: t; no-byte-compile: t -*-
;; To install a package:
;;
;; 1. Declare them here in a `package!' statement,
;; 2. Run 'doom sync' in the shell,
;; 3. Restart Emacs.
;;
;; Use 'C-h f package\!' to look up documentation for the `package!' macro.
;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror:
;; (package! some-package)
;; To install a package directly from a remote git repo, you must specify a
;; `:recipe'. You'll find documentation on what `:recipe' accepts here:
;; https://github.com/radian-software/straight.el#the-recipe-format
;; (package! another-package
;; :recipe (:host github :repo "username/repo"))
;; If the package you are trying to install does not contain a PACKAGENAME.el
;; file, or is located in a subdirectory of the repo, you'll need to specify
;; `:files' in the `:recipe':
;; (package! this-package
;; :recipe (:host github :repo "username/repo"
;; :files ("some-file.el" "src/lisp/*.el")))
;; If you'd like to disable a package included with Doom, you can do so here
;; with the `:disable' property:
;; (package! builtin-package :disable t)
;; You can override the recipe of a built in package without having to specify
;; all the properties for `:recipe'. These will inherit the rest of its recipe
;; from Doom or MELPA/ELPA/Emacsmirror:
;; (package! builtin-package :recipe (:nonrecursive t))
;; (package! builtin-package-2 :recipe (:repo "myfork/package"))
;; Specify a `:branch' to install a package from a particular branch or tag.
;; This is required for some packages whose default branch isn't 'master' (which
;; our package manager can't deal with; see radian-software/straight.el#279)
;; (package! builtin-package :recipe (:branch "develop"))
;; Use `:pin' to specify a particular commit to install.
;; (package! builtin-package :pin "1a2b3c4d5e")
;; Doom's packages are pinned to a specific commit and updated from release to
;; release. The `unpin!' macro allows you to unpin single packages...
;; (unpin! pinned-package)
;; ...or multiple packages
;; (unpin! pinned-package another-pinned-package)
;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
;; (unpin! t)
(package! tldr)
(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"
)

20
flake.lock generated
View File

@@ -2519,11 +2519,11 @@
"rust-overlay": "rust-overlay_2"
},
"locked": {
"lastModified": 1780921813,
"narHash": "sha256-yqQ4OmdWs691nfjxKcrDrbnjeQQwlXnmLj8IG0AbWyU=",
"lastModified": 1792001584,
"narHash": "sha256-gRpyAAsKEsREyOa7J6WngNpmbbR4VjUB8MeFZHmXWDo=",
"ref": "refs/heads/master",
"rev": "c57849f748ba20134f79b76e42e0c85786dd637f",
"revCount": 203,
"rev": "105eca862da9d8e54ad68c30d308f7c937861552",
"revCount": 212,
"type": "git",
"url": "https://git.ppc.social/ppc/ppc"
},
@@ -3869,11 +3869,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1772624091,
"narHash": "sha256-QKyJ0QGWBn6r0invrMAK8dmJoBYWoOWy7lN+UHzW1jc=",
"lastModified": 1788531059,
"narHash": "sha256-hLD4l3QOGBQhkVp3mQ2lJ/YbEi99qUgKapb40KovZ88=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "80bdc1e5ce51f56b19791b52b2901187931f5353",
"rev": "801bef6abd86b91e51083066b83fb354a11fc640",
"type": "github"
},
"original": {
@@ -4463,11 +4463,11 @@
},
"nixpkgs_5": {
"locked": {
"lastModified": 1774709303,
"narHash": "sha256-D3Q07BbIA2KnTcSXIqqu9P586uWxN74zNoCH3h2ESHg=",
"lastModified": 1782467914,
"narHash": "sha256-pGvFkM8N0xEkIIXDe5YYfbEAvHrk4IxBrjB/x8OomhE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8110df5ad7abf5d4c0f6fb0f8f978390e77f9685",
"rev": "e73de5be04e0eff4190a1432b946d469c794e7b4",
"type": "github"
},
"original": {

View File

@@ -509,7 +509,7 @@
inherit specialArgs;
system = "x86_64-linux";
modules = [
./hosts/main.nix
./hosts/main/default.nix
./hardware/hpm-laptop.nix
];
};

View File

@@ -0,0 +1 @@
{"rustc_fingerprint":12679484821923032738,"outputs":{"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":""},"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":{}}

View File

@@ -0,0 +1 @@
{"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":{}}

View File

@@ -0,0 +1 @@
error: the package 'generated-c2vi-dev-part' does not contain these features: target-js, target-obsidian

View File

@@ -34,26 +34,6 @@
};
};
/*
fileSystems."/" = {
device = "/dev/disk/by-uuid/6518e61e-7120-48ef-81a3-5eae0f67297e";
fsType = "btrfs";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/0E6C-F209";
fsType = "vfat";
};
*/
fileSystems."/" = {
device = "/dev/disk/by-label/main-root";
fsType = "btrfs";
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/MAIN-BOOT";
fsType = "vfat";
};
#swapDevices = [
#{ device = "/dev/disk/by-uuid/418bf0d8-e548-45d5-802a-53de72707ebc"; }

View File

@@ -15,7 +15,7 @@
# allow acern to ssh into server
users.users.server.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHTV1VoNAjMha5IP+qb8XABDo02pW3iN0yPBIbSqZA27 me@acern"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHTV1VoNAjMha5IP+Do02pW3iN0yPBIbSqZA27 me@acern"
];
# allow server user to shutdown fusu
@@ -26,6 +26,9 @@
}
];
virtualisation.docker.enable = true;
users.users.me.extraGroups = [ "docker" ];
#fileSystems."/boot" = {
# device = "/dev/disk/by-label/fusu-boot";
# fsType = "fat32";
@@ -54,6 +57,8 @@
8888 # for general usage
9999 # for general usage
8080 # for mitm proxy
8001 # c2vi-navidrome
8002 # c2vi-lidarr
25565 # mc proxy
25580 # wmc lobby server

View File

@@ -1,5 +1,5 @@
{ inputs, pkgs, secretsDir, config, dataDir, ... }: let
{ inputs, pkgs, secretsDir, config, dataDir, lib, ... }: let
in {
@@ -37,6 +37,10 @@ in {
device = "/home/me/host/libvirt";
options = [ "bind" ];
};
swapDevices = [{
device = "/swapfile";
size = 20 * 1024;
}];
@@ -403,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";
};
};
}

View File

@@ -145,7 +145,7 @@
####################### MIZE ###########################
mize.enable = true;
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.MIZE_STORE= "/home/me/host/mize";
systemd.user.services.mize.serviceConfig.EnvironmentFile = "/home/me/host/mize/daemon.env";

View File

@@ -24,10 +24,12 @@ in {
inputs.mize.nixosModules.default
];
mize.enable = true;
mize.debugBinary = "/data/external/config/target/debug/mac-os";
mize.debugConfigFile = "/home/me/host/mize-config.toml";
mize.debugBinary = "/home/me/here/mize";
mize.debugConfigFile = "/home/me/host/mize/config.toml";
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;
# https://nixos.wiki/wiki/OBS_Studio
@@ -38,6 +40,7 @@ in {
options v4l2loopback devices=1 video_nr=1 card_label="OBS Cam" exclusive_caps=1 kvm_intel nested=1
'';
security.polkit.enable = true;
programs.obs-studio.enableVirtualCamera = true;
#services.pid-fan-controller.enable = true;
@@ -191,7 +194,7 @@ in {
enable = true;
systemd = true;
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;
clients = [
{
@@ -220,7 +223,8 @@ in {
newerUnstableSrc = builtins.getFlake "nixpkgs/d0fc30899600b9b3466ddb260fd83deb486c32f1";
newerUnstable = import newerUnstableSrc.outPath {};
mySway = newerUnstable.sway.override {
mySway = newerUnstable.sway;
myOtherSway = newerUnstable.sway.override {
sway-unwrapped = (newerUnstable.sway-unwrapped.overrideAttrs (prev: {
/*
src = pkgs.fetchFromGitHub {

108
hosts/main/alacritty.toml Normal file
View File

@@ -0,0 +1,108 @@
[colors.bright]
black = "#6272a4"
blue = "#d6acff"
cyan = "#a4ffff"
green = "#69ff94"
magenta = "#ff92df"
red = "#ff6e6e"
white = "#ffffff"
yellow = "#ffffa5"
[colors.cursor]
cursor = "CellForeground"
text = "CellBackground"
[colors.footer_bar]
background = "#282a36"
foreground = "#f8f8f2"
[colors.hints.end]
background = "#282a36"
foreground = "#f1fa8c"
[colors.hints.start]
background = "#f1fa8c"
foreground = "#282a36"
[colors.line_indicator]
background = "None"
foreground = "None"
[colors.normal]
black = "#21222c"
blue = "#bd93f9"
cyan = "#8be9fd"
green = "#50fa7b"
magenta = "#ff79c6"
red = "#ff5555"
white = "#f8f8f2"
yellow = "#f1fa8c"
[colors.primary]
background = "#282a36"
bright_foreground = "#ffffff"
foreground = "#f8f8f2"
[colors.search.focused_match]
background = "#ffb86c"
foreground = "#44475a"
[colors.search.matches]
background = "#50fa7b"
foreground = "#44475a"
[colors.selection]
background = "#44475a"
text = "CellForeground"
[colors.vi_mode_cursor]
cursor = "CellForeground"
text = "CellBackground"
[font]
size = 22
#[font.bold]
#family = "Hack"
#style = "Bold"
#[font.bold_italic]
#family = "Hack"
#style = "Bold Italic"
#[font.italic]
#family = "Hack"
#style = "Italic"
#[font.normal]
#family = "Hack"
#style = "Regular"
[[keyboard.bindings]]
action = "Paste"
key = "V"
mods = "Control|Shift"
[[keyboard.bindings]]
action = "Copy"
key = "C"
mods = "Control|Shift"
[[keyboard.bindings]]
chars = "\u001b\u005b\u0042"
key = "J"
mods = "Control"
[[keyboard.bindings]]
chars = "\u001b\u005b\u0041"
key = "K"
mods = "Control"
[[keyboard.bindings]]
chars = "\u001b\u005b\u0044"
key = "H"
mods = "Control"
[[keyboard.bindings]]
chars = "\u001b\u005b\u0043"
key = "L"
mods = "Control"

106
hosts/main/bashrc Normal file
View File

@@ -0,0 +1,106 @@
export CONFIG_DIR=/home/me/work/config
export DATA_DIR=/home/me/work/app-data
export HERE_DIR=/home/me/here
export LOG_DIR=/tmp/mlog
export SVDIR=$CONFIG_DIR/hosts/main/services
export BASH_ENV=$CONFIG_DIR/hosts/main/bashrc
export HOSTNAME=main
export DOOMDIR="$CONFIG_DIR/doomdir"
export MIZE_SRC=$CONFIG_DIR/mize
export MIZE_STORE=~/work/app-data/mize
mkdir -p $LOG_DIR
# arch path
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
# main stuff
export PATH=$CONFIG_DIR/hosts/main/bin:$PATH
export SECRETS_DIR=/home/me/secrets
# nix lock
export NIXPKGS_REV=04e1ec9c5dbf94ab78b6b755b5ec28c1d6dd5392 # nix eval ${CONFIG_DIR}#inputs.nixpkgs.rev
export NIXPKGS_UNSTABLE_REV=ac6b2166e7a9375683b8e98f860f273222337b16 # nix eval ${CONFIG_DIR}#inputs.nixpkgs.rev
export NIX_PATH=nixpkgs=/nix/store/jpf38g508p4njqzbfkvdfjj7v3s795k9-source # nix flake prefetch nixpkgs/$(nix eval $CONFIG_DIR#inputs.nixpkgs.rev --raw) --json | jq '.storePath' -r
# bin paths
if [ -d /run/current-system ]; then # in case of nixos
export BIN_ZED=~/work/path-extra/zed
else
export BIN_ZED=/usr/sbin/zeditor
fi
## #### detect distro
detect_distro() {
local -n reply_distro=$1
local line key value
reply_distro="unknown"
# Read file line by line without spawning external commands
if [[ -f /etc/os-release ]]; then
while IFS='=' read -r key value; do
# Clean up the key name
key="${key##*([[:space:]])}"
key="${key%%*([[:space:]])}"
if [[ "$key" == "ID" ]]; then
# Strip potential surrounding quotes from the value
value="${value#\"}"
value="${value%\"}"
value="${value#\'}"
value="${value%\'}"
reply_distro="$value"
return 0
fi
done < /etc/os-release
fi
}
# get_config
function get_config() {
if [[ "$2" == "" ]]; then
local -n reply_config=OUT
else
local -n reply_config=$2
fi
declare -A myconfig
detect_distro DISTRO
myconfig["hyprland.bin"]="~/work/src/hyprland/build/Hyprland"
myconfig["prismlauncher.bin"]="/usr/sbin/prismlauncher"
myconfig["hyprland.configFile"]="$CONFIG_DIR/hosts/main/hyprland.lua"
myconfig["steam.homeDir"]="$HERE_DIR/steam-home"
myconfig["steam.bin"]="/home/me/.nix-profile/bin/steam"
myconfig["git.bin"]="/bin/git"
myconfig["ssh.bin"]="/bin/ssh"
myconfig["mize.configFile"]="$CONFIG_DIR/hosts/main/"
myconfig["mize.secretsFile"]="~/secrets/mize-config.toml"
myconfig["mize.startDev"]="true"
myconfig["mize.runBuild"]="false"
myconfig["mize.backtrace"]="false"
# nixos case
if [[ "$DISTRO" == "nixos" ]]; then
myconfig["zed.bin"]="~/work/path-extra/zed"
fi
# arch case
if [[ "$DISTRO" == "arch" ]]; then
myconfig["zed.bin"]="/usr/sbin/zeditor"
fi
reply_config=${myconfig["$1"]}
}
# auto start hyprland in tty
if [[ $TERM == "linux" ]]; then
sudo loadkeys de
fi
if [[ $- == *i* ]]; then
source $CONFIG_DIR/mods/bashrc-common
fi

3
hosts/main/bin/alacritty Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
exec /usr/sbin/alacritty --config-file $CONFIG_DIR/hosts/main/alacritty.toml

7
hosts/main/bin/config-zed Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
#export RA_LOG_FILE="/home/me/rust-analyzer.log"
export XDG_DATA_HOME=~/work/app-data/config-zed
export WAYLAND_DISPLAY=
sudo renice -n -5 -p $$
exec $BIN_ZED ~/work/config ~/work/things
#zed "$@"

44
hosts/main/bin/direnv-diff Executable file
View 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())

3
hosts/main/bin/dms Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
/usr/bin/dms -c /home/me/work/config/hosts/main/ "$@"

1
hosts/main/bin/doom Symbolic link
View File

@@ -0,0 +1 @@
../../../src/doom/bin/doom

8
hosts/main/bin/elephant Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/sh
if [[ -v IS_RUNIT ]]; then
exec 2>$LOG_DIR/elephant
exec 1>$LOG_DIR/elephant
fi
exec /usr/sbin/elephant -c $CONFIG_DIR/hosts/main/elephant "$@"

3
hosts/main/bin/em Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
exec emacsclient -c -n "$PWD/$1"

13
hosts/main/bin/emacs-server Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
if [[ -v IS_RUNIT ]]; then
exec 2>$LOG_DIR/emacs
exec 1>$LOG_DIR/emacs
unset IS_RUNIT
fi
export DOOMDIR="$CONFIG_DIR/doomdir"
echo $DOOMDIR
echo -------------
exec nixGL emacs --init-directory $CONFIG_DIR/src/doom --fg-daemon "$@"

5
hosts/main/bin/git Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
export GIT_CONFIG_GLOBAL=$CONFIG_DIR/hosts/main/git_config
get_config git.bin BIN
exec $BIN "$@"

20
hosts/main/bin/hyprland Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
if [[ -v IS_RUNIT ]]; then
exec 2>$LOG_DIR/hyprland
exec 1>$LOG_DIR/hyprland
sudo renice -n -10 -p $$
unset IS_RUNIT
fi
export XDG_CURRENT_DESKTOP=hyprland
export XDG_SESSION_TYPE=wayland
export XDG_SESSION_DESKTOP=hyprland
systemctl --user import-environment XDG_CURRENT_DESKTOP XDG_SESSION_TYPE XDG_SESSION_DESKTOP PATH
dbus-update-activation-environment --systemd XDG_CURRENT_DESKTOP XDG_SESSION_TYPE XDG_SESSION_DESKTOP PATH
get_config hyprland.bin BIN
get_config hyprland.configFile CONFIG
exec $BIN --config $CONFIG "$@"

3
hosts/main/bin/lan-mouse Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
exec $HOME/.nix-profile/bin/lan-mouse --config $CONFIG_DIR/hosts/main/lan-mouse.toml "$@"

1
hosts/main/bin/m Symbolic link
View File

@@ -0,0 +1 @@
mize

4
hosts/main/bin/msession Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
export IS_RUNIT=1
exec runsvdir $CONFIG_DIR/hosts/main/services

7
hosts/main/bin/msteam Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
get_config steam.homeDir HOME
export HOME
get_config steam.bin BIN
nixGL $BIN "$@"

3
hosts/main/bin/nix Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
exec /nix/var/nix/profiles/default/bin/nix --option experimental-features "nix-command flakes" "$@" --option flake-registry $CONFIG_DIR/hosts/main/flake-registry.json

3
hosts/main/bin/nwg-displays Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
exec /usr/sbin/nwg-displays -m $CONFIG_DIR/hosts/main/hypr-monitors.lua

3
hosts/main/bin/nyxt Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
exec nixGL /home/me/.nix-profile/bin/nyxt --config $CONFIG_DIR/nyxt "$@"

3
hosts/main/bin/pacman Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
exec sudo /usr/sbin/pacman "$@"

4
hosts/main/bin/prismlauncher Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
get_config prismlauncher.bin BIN
exec nixGL $BIN -d ~/work/app-data/prism-launcher "$@"

3
hosts/main/bin/scp Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
exec /bin/scp -F $CONFIG_DIR/hosts/main/ssh_config "$@"

13
hosts/main/bin/screenshot Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
geometry=$(slurp -c "#ff0000ff")
if [[ "$?" != "0" ]]
then
pkill wayfreeze || true
exit
fi
grim -g "$geometry" -t ppm - | nixGL satty --filename - --copy-command=wl-copy --early-exit &
pkill wayfreeze || true

4
hosts/main/bin/ssh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
get_config ssh.bin BIN
exec $BIN -F $CONFIG_DIR/hosts/main/ssh_config "$@"

1
hosts/main/bin/wireshark Symbolic link
View File

@@ -0,0 +1 @@
../../../apps/wireshark

9
hosts/main/bin/xdg-open Executable file
View 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 "$@"

24
hosts/main/bin/zmk Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
export ZMK_CLI_CONFIG=$CONFIG_DIR/hosts/main/zmk-config
if [[ "$1" == "docker" ]] || [[ "$1" == "d" ]];
then
if [ ! $(docker ps -a -q -f name=my-zmk-builder) ]; then
docker build -t my-zmk-builder $CONFIG_DIR/zmk-config
fi
docker run -v $CONFIG_DIR:/config -it --rm my-zmk-builder
# build cmd: west build -- -DBOARD=nice_nano_v2 -DSHIELD=charybdis_left -DZMK_CONFIG=/config/zmk-config/config/ -DZMK_EXTRA_MODULES=/config/zmk-config
exit 0
fi
if [[ "$1" == "flash" ]] || [[ "$1" == "f" ]];
then
if [ ! $(docker ps -a -q -f name=my-zmk-builder) ]; then
docker build -t my-zmk-builder $CONFIG_DIR/zmk-config
fi
docker run -v $CONFIG_DIR:/config --workdir /config/src/zmk/app -it --rm my-zmk-builder --entrypoint /bin/bash -c 'west build -- -DBOARD=nice_nano_v2 -DSHIELD=charybdis_left -DZMK_CONFIG=/config/zmk-config/config/ -DZMK_EXTRA_MODULES=/config/zmk-config'
exit 0
fi
exec /home/me/work/src/zmk-cli/.venv/bin/zmk "$@"

View File

@@ -0,0 +1 @@
[{"socket":"/path/to/bw.socket","contents":[],"aliases":["default"]}]

View File

@@ -48,10 +48,57 @@
documentation.enable = true;
documentation.man.enable = true;
fileSystems."/home/me/nico" = {
device = "100.88.28.123:/data/incus/default-pool/containers/nico/rootfs/root/work/";
fsType = "nfs";
options = [ "x-systemd.automount" "noauto" "x-systemd.idle-timeout=600" ];
#fileSystems."/home/me/nico" = {
#device = "100.88.28.123:/data/incus/default-pool/containers/nico/rootfs/root/work/";
#fsType = "nfs";
#options = [ "x-systemd.automount" "noauto" "x-systemd.idle-timeout=600" "nofail" ];
#};
fileSystems."/" = {
device = "/dev/disk/by-label/main-root";
fsType = "btrfs";
options = [ "subvol=nixos" ];
};
fileSystems."/nix" = {
device = "/dev/disk/by-label/main-root";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/home/me/work" = {
device = "/dev/disk/by-label/main-root";
fsType = "btrfs";
options = [ "subvol=work" ];
};
fileSystems."/home/me/secrets" = {
device = "/dev/disk/by-label/main-root";
fsType = "btrfs";
options = [ "subvol=secrets" ];
};
fileSystems."/cachy" = {
device = "/dev/disk/by-label/main-root";
fsType = "btrfs";
options = [ "subvol=cachy" ];
};
fileSystems."/swap" = {
device = "/dev/disk/by-label/main-root";
fsType = "btrfs";
options = [ "subvol=swap" ];
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/MAIN-BOOT";
fsType = "vfat";
};
boot.loader.grub = {
enable = true;
#default = "cachy";
extraEntries = ''
menuentry 'cachy' {
linux /vmlinuz-linux rootflags=subvol=cachy rw rd.luks.name=f93d0e0c-c620-4d39-bd6a-a7c0c90fb850=root root=/dev/mapper/root systemd.setenv=SYSTEMD_SULOGIN_FORCE=1
initrd /initramfs-linux.img
}
'';
};
@@ -177,6 +224,7 @@ fileSystems."/home/me/nico" = {
/*
home-manager.users.me.programs.lan-mouse = {
enable = true;
settings = {
@@ -194,6 +242,7 @@ fileSystems."/home/me/nico" = {
};
};
home-manager.users.me.systemd.user.services.lan-mouse.Service.Environment = "PATH=/bin";
*/
@@ -247,18 +296,18 @@ fileSystems."/home/me/nico" = {
imports = [
../common/all.nix
../common/nixos-headless.nix
../../common/all.nix
../../common/nixos-headless.nix
#../common/nixos-graphical.nix
../common/nixos-wayland.nix
../common/building.nix
../common/nixos.nix
../mods/battery_monitor.nix
../../common/nixos-wayland.nix
../../common/building.nix
../../common/nixos.nix
../../mods/battery_monitor.nix
inputs.networkmanager.nixosModules.networkmanager
inputs.home-manager.nixosModules.home-manager
../users/me/gui.nix
../users/root/default.nix
../../users/me/gui.nix
../../users/root/default.nix
# see: https://github.com/NixOS/nixpkgs/issues/300081
#"${inputs.nixpkgs-unstable}/nixos/modules/virtualisation/incus.nix"
@@ -298,7 +347,7 @@ fileSystems."/home/me/nico" = {
((builtins.getFlake "nixpkgs/96bc8fec15133d6056410ed3abae2fb9419fb545").legacyPackages.${system}.affine.overrideAttrs {
patches = [
../overlays/patches/affin-edgeless-right-click-drag.patch
../../overlays/patches/affin-edgeless-right-click-drag.patch
];
})

View File

@@ -0,0 +1,9 @@
auto_detect_launch_prefix = true
before_load = []
git_on_demand = true
ignored_providers = []
launch_prefix = ''
overload_local_env = false
terminal_cmd = ''
[provider_hosts]

View File

@@ -0,0 +1,10 @@
explicits = []
generic_text = 'run: '
history = true
history_when_empty = false
[Config]
hide_from_providerlist = false
icon = 'utilities-terminal'
min_score = 50
name_pretty = ''

View File

@@ -0,0 +1,519 @@
{
"flakes": [
{
"from": {
"id": "agda",
"type": "indirect"
},
"to": {
"owner": "agda",
"repo": "agda",
"type": "github"
}
},
{
"from": {
"id": "agenix",
"type": "indirect"
},
"to": {
"owner": "ryantm",
"repo": "agenix",
"type": "github"
}
},
{
"from": {
"id": "arion",
"type": "indirect"
},
"to": {
"owner": "hercules-ci",
"repo": "arion",
"type": "github"
}
},
{
"from": {
"id": "blender-bin",
"type": "indirect"
},
"to": {
"dir": "blender",
"owner": "edolstra",
"repo": "nix-warez",
"type": "github"
}
},
{
"from": {
"id": "bundlers",
"type": "indirect"
},
"to": {
"owner": "NixOS",
"repo": "bundlers",
"type": "github"
}
},
{
"from": {
"id": "cachix",
"type": "indirect"
},
"to": {
"owner": "cachix",
"repo": "cachix",
"type": "github"
}
},
{
"from": {
"id": "composable",
"type": "indirect"
},
"to": {
"owner": "ComposableFi",
"repo": "composable",
"type": "github"
}
},
{
"from": {
"id": "disko",
"type": "indirect"
},
"to": {
"owner": "nix-community",
"repo": "disko",
"type": "github"
}
},
{
"from": {
"id": "dreampkgs",
"type": "indirect"
},
"to": {
"owner": "nix-community",
"repo": "dreampkgs",
"type": "github"
}
},
{
"from": {
"id": "dwarffs",
"type": "indirect"
},
"to": {
"owner": "edolstra",
"repo": "dwarffs",
"type": "github"
}
},
{
"from": {
"id": "emacs-overlay",
"type": "indirect"
},
"to": {
"owner": "nix-community",
"repo": "emacs-overlay",
"type": "github"
}
},
{
"from": {
"id": "fenix",
"type": "indirect"
},
"to": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
{
"from": {
"id": "flake-parts",
"type": "indirect"
},
"to": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
{
"from": {
"id": "flake-utils",
"type": "indirect"
},
"to": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
{
"from": {
"id": "helix",
"type": "indirect"
},
"to": {
"owner": "helix-editor",
"repo": "helix",
"type": "github"
}
},
{
"from": {
"id": "hercules-ci-agent",
"type": "indirect"
},
"to": {
"owner": "hercules-ci",
"repo": "hercules-ci-agent",
"type": "github"
}
},
{
"from": {
"id": "hercules-ci-effects",
"type": "indirect"
},
"to": {
"owner": "hercules-ci",
"repo": "hercules-ci-effects",
"type": "github"
}
},
{
"from": {
"id": "home-manager",
"type": "indirect"
},
"to": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
{
"from": {
"id": "hydra",
"type": "indirect"
},
"to": {
"owner": "NixOS",
"repo": "hydra",
"type": "github"
}
},
{
"from": {
"id": "mach-nix",
"type": "indirect"
},
"to": {
"owner": "DavHau",
"repo": "mach-nix",
"type": "github"
}
},
{
"from": {
"id": "ngipkgs",
"type": "indirect"
},
"to": {
"owner": "ngi-nix",
"repo": "ngipkgs",
"type": "github"
}
},
{
"from": {
"id": "nickel",
"type": "indirect"
},
"to": {
"owner": "tweag",
"repo": "nickel",
"type": "github"
}
},
{
"from": {
"id": "nix",
"type": "indirect"
},
"to": {
"owner": "NixOS",
"repo": "nix",
"type": "github"
}
},
{
"from": {
"id": "nix-darwin",
"type": "indirect"
},
"to": {
"owner": "nix-darwin",
"repo": "nix-darwin",
"type": "github"
}
},
{
"from": {
"id": "nix-serve",
"type": "indirect"
},
"to": {
"owner": "edolstra",
"repo": "nix-serve",
"type": "github"
}
},
{
"from": {
"id": "nixops",
"type": "indirect"
},
"to": {
"owner": "NixOS",
"repo": "nixops",
"type": "github"
}
},
{
"from": {
"id": "nixos-anywhere",
"type": "indirect"
},
"to": {
"owner": "nix-community",
"repo": "nixos-anywhere",
"type": "github"
}
},
{
"from": {
"id": "nixos-hardware",
"type": "indirect"
},
"to": {
"owner": "NixOS",
"repo": "nixos-hardware",
"type": "github"
}
},
{
"from": {
"id": "nixos-homepage",
"type": "indirect"
},
"to": {
"owner": "NixOS",
"repo": "nixos-homepage",
"type": "github"
}
},
{
"from": {
"id": "nixos-search",
"type": "indirect"
},
"to": {
"owner": "NixOS",
"repo": "nixos-search",
"type": "github"
}
},
{
"from": {
"id": "nixpkgs",
"type": "indirect"
},
"exact": true,
"to": {
"type": "tarball",
"url": "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"
}
},
{
"from": {
"id": "nixpkgs",
"type": "indirect",
"ref": "nixpkgs-unstable"
},
"exact": true,
"to": {
"type": "tarball",
"url": "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"
}
},
{
"from": {
"id": "nixpkgs",
"type": "indirect",
"ref": "nixos-unstable"
},
"exact": true,
"to": {
"type": "tarball",
"url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"
}
},
{
"from": {
"id": "nixpkgs",
"type": "indirect",
"ref": "nixos-unstable-small"
},
"exact": true,
"to": {
"type": "tarball",
"url": "https://channels.nixos.org/nixos-unstable-small/nixexprs.tar.xz"
}
},
{
"from": {
"id": "nixpkgs",
"type": "indirect",
"ref": "nixos-26.05"
},
"exact": true,
"to": {
"type": "tarball",
"url": "https://channels.nixos.org/nixos-26.05/nixexprs.tar.xz"
}
},
{
"from": {
"id": "nixpkgs",
"type": "indirect",
"ref": "nixos-26.05-small"
},
"exact": true,
"to": {
"type": "tarball",
"url": "https://channels.nixos.org/nixos-26.05-small/nixexprs.tar.xz"
}
},
{
"from": {
"id": "nixpkgs",
"type": "indirect",
"ref": "nixpkgs-26.05-darwin"
},
"exact": true,
"to": {
"type": "tarball",
"url": "https://channels.nixos.org/nixpkgs-26.05-darwin/nixexprs.tar.xz"
}
},
{
"from": {
"id": "nixpkgs",
"type": "indirect"
},
"to": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
{
"from": {
"id": "nixvim",
"type": "indirect"
},
"to": {
"owner": "nix-community",
"repo": "nixvim",
"type": "github"
}
},
{
"from": {
"id": "nur",
"type": "indirect"
},
"to": {
"owner": "nix-community",
"repo": "NUR",
"type": "github"
}
},
{
"from": {
"id": "patchelf",
"type": "indirect"
},
"to": {
"owner": "NixOS",
"repo": "patchelf",
"type": "github"
}
},
{
"from": {
"id": "poetry2nix",
"type": "indirect"
},
"to": {
"owner": "nix-community",
"repo": "poetry2nix",
"type": "github"
}
},
{
"from": {
"id": "pridefetch",
"type": "indirect"
},
"to": {
"owner": "SpyHoodle",
"repo": "pridefetch",
"type": "github"
}
},
{
"from": {
"id": "sops-nix",
"type": "indirect"
},
"to": {
"owner": "Mic92",
"repo": "sops-nix",
"type": "github"
}
},
{
"from": {
"id": "systems",
"type": "indirect"
},
"to": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
{
"from": {
"id": "templates",
"type": "indirect"
},
"to": {
"owner": "NixOS",
"repo": "templates",
"type": "github"
}
}
],
"version": 2
}

20
hosts/main/git_config Normal file
View File

@@ -0,0 +1,20 @@
[core]
editor = "nvim"
pager = "delta"
[core "color"]
ui = true
[credential]
credentialStore = "cache"
helper = "manager"
[gpg]
format = "openpgp"
[gpg "openpgp"]
program = "gpg"
[user]
email = "me@c2vi.dev"
name = "Sebastian Moser"

21
hosts/main/hosts Normal file
View File

@@ -0,0 +1,21 @@
127.0.0.1 localhost
192.168.3.1 gw
192.168.3.1 gw.c2vi.dev
192.168.3.105 mac
100.88.79.207 matrix.c2vi.dev
# netbird
100.88.137.49 te
100.88.210.28 fasu
100.88.42.194 fwin
100.88.28.123 fe
100.88.79.207 fusu
100.88.79.207 files
100.88.164.39 lush
#100.88.112.181 mac
100.88.116.225 nico
100.88.245.227 phone
100.88.69.32 ti
# other

View File

@@ -0,0 +1,13 @@
hl.monitor({
output = "eDP-1",
mode = "1920x1080@60.0",
position = "0x1080",
scale = 1.0
})
hl.monitor({
output = "DP-1",
mode = "3840x2160@60.0",
position = "1920x0",
scale = 1
})

263
hosts/main/hyprland.lua Normal file
View File

@@ -0,0 +1,263 @@
--#### vars
local mod = "SUPER"
--### idk
--hl.bind(mod .. "+p", hl.dsp.exec_cmd("nc -U /run/user/1000/walker/walker.sock"))
hl.bind(mod .. "+p", hl.dsp.exec_cmd("rofi -show run"))
hl.bind(mod .. "+space", hl.dsp.window.fullscreen_state({ internal=2, client=0, action="toggle", layout_aware=false, }))
hl.bind(mod .. "+SHIFT+c", hl.dsp.window.close())
hl.bind(mod .. "+ SHIFT + Return", hl.dsp.exec_cmd("alacritty"))
hl.config({
dwindle = {
preserve_split = true,
},
misc = {
},
input = {
touchpad = {
tap_to_click = false,
disable_while_typing = true, -- Highly recommended to prevent palm jumps
}
}
})
hl.config({
general = {
layout = "dwindle",
border_size = 2,
gaps_in = 0,
gaps_out = 0,
col = {
active_border = { colors = {"rgba(33ccffee)", "rgba(00ff99ee)"}, angle = 45 },
inactive_border = "rgba(595959aa)",
},
},
decoration = {
-- Change transparency of focused and unfocused windows
active_opacity = 1.0,
inactive_opacity = 1.0,
},
})
--#### focus movement
-- refullscreens window when the old window was fullscreen
hl.on("window.active", function (new_window, reason)
if REDO_FULLSCREEN then
REDO_FULLSCREEN = false
hl.dispatch(hl.dsp.window.fullscreen_state({ action="set", internal=2, client=0 }))
end
end)
function my_move_focus(direction)
return function()
local window = hl.get_active_window()
if window == nil then return end
REDO_FULLSCREEN = window.fullscreen ~= 0
if REDO_FULLSCREEN then
hl.dispatch(hl.dsp.window.fullscreen_state({ action="unset", internal=2, client=0 }))
end
return hl.dispatch(hl.dsp.focus({ direction = direction }))
end
end
hl.bind(mod .. " + h", my_move_focus("left"))
hl.bind(mod .. " + l", my_move_focus("right"))
hl.bind(mod .. " + j", my_move_focus("down"))
hl.bind(mod .. " + k", my_move_focus("up"))
--#### brightnes controls
hl.bind("F1", hl.dsp.exec_cmd("brightnessctl set 5%-"), { repeating = true })
hl.bind("F2", hl.dsp.exec_cmd("brightnessctl set +5%"), { repeating = true })
--#### volume controls
hl.bind("F3", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-"), { repeating = true })
hl.bind("F4", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%+ -l 1.0"), { repeating = true })
--#### playback controls
hl.bind("F5", hl.dsp.exec_cmd("playerctl previous"), { locked = true })
hl.bind("F6", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
hl.bind("F7", hl.dsp.exec_cmd("playerctl next"), { locked = true })
--#### disable background
hl.config({
misc = {
force_default_wallpaper = 0,
disable_hyprland_logo = false,
disable_splash_rendering = true,
},
})
--#### workspaces
-- Workspaces (1,7,8,9,0)
--for _, i in ipairs({1, 7, 8, 9, 0}) do
for _, i in ipairs({1,2, 3, 4, 5, 6, 7, 8, 9, 0}) do
hl.bind(mod .. "+" .. tostring(i), hl.dsp.focus({ workspace = i, }))
hl.bind(mod .. "+SHIFT+" .. tostring(i), hl.dsp.window.move({ workspace = i, }))
end
hl.workspace_rule({ workspace = "0", monitor = "eDP-1"})
--hl.workspace_rule({ workspace = "1", monitor = "eDP-1"})
hl.workspace_rule({ workspace = "1", monitor = "HDMI-A-1"})
hl.workspace_rule({ workspace = "7", monitor = "eDP-1", default = true, layout = "scrolling"})
hl.workspace_rule({ workspace = "9", monitor = "DP-1"})
hl.workspace_rule({ workspace = "2", monitor = "DP-1", default = true})
hl.workspace_rule({ workspace = "3", monitor = "DP-1"})
hl.workspace_rule({ workspace = "4", monitor = "DP-1"})
hl.workspace_rule({ workspace = "5", monitor = "DP-1"})
hl.workspace_rule({ workspace = "6", monitor = "DP-1"})
hl.workspace_rule({ workspace = "8", monitor = "DP-1"})
hl.workspace_rule({ workspace = "2", monitor = "HDMI-A-1", default = true})
hl.workspace_rule({ workspace = "3", monitor = "HDMI-A-1"})
hl.workspace_rule({ workspace = "4", monitor = "HDMI-A-1"})
hl.workspace_rule({ workspace = "5", monitor = "HDMI-A-1"})
hl.workspace_rule({ workspace = "6", monitor = "HDMI-A-1"})
hl.workspace_rule({ workspace = "8", monitor = "HDMI-A-1"})
hl.workspace_rule({
workspace = "7",
layout = "scrolling",
layout_opts = {
direction = "down",
fullscreen_on_one_column = true,
column_width = 1,
},
})
hl.config({
scrolling = {
column_width = 1;
fullscreen_on_one_column = true,
},
binds = {
movefocus_cycles_fullscreen = false,
},
misc = {
on_focus_under_fullscreen = 1,
},
render = {
direct_scanout = false,
},
})
-- Workrooms (2–6 on d, m, a, b, c)
--[[
local workrooms = {"d", "m", "a", "b", "c"}
for _, prefix in ipairs(workrooms) do
for i = 2, 6 do
local ws = prefix .. tostring(i)
hl.bind(mod .. "+" .. tostring(i), function()
hl.dsp.workspace.change_id(ws)
end)
hl.bind(mod .. "+SHIFT+" .. tostring(i), function()
hl.dsp.window.move(ws)
end)
end
end
]]
--#### keyboard layout
hl.config({ input = {
kb_layout = "de",
}})
--#### keyboard repeat
hl.config({ input = {
repeat_delay = 130,
repeat_rate = 90,
}})
--#### disable all animations
hl.config({
animations = {
enabled = false,
},
})
--#### autostart stuff
hl.on("hyprland.start", function ()
hl.exec_cmd("dms run")
hl.exec_cmd("em ~/work/things", {workspace = "9 silent"})
end)
--#### move windows
hl.bind(mod .. " + SHIFT + H", hl.dsp.window.move({ direction = "left" }))
hl.bind(mod .. " + SHIFT + J", hl.dsp.window.move({ direction = "down" }))
hl.bind(mod .. " + SHIFT + K", hl.dsp.window.move({ direction = "up" }))
hl.bind(mod .. " + SHIFT + L", hl.dsp.window.move({ direction = "right" }))
-- resize
hl.bind(mod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true })
hl.bind(mod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true })
--#### animation settings
hl.curve("easeOutQuint", { type = "bezier", points = { {0.23, 1}, {0.32, 1} } })
hl.curve("easeInOutCubic", { type = "bezier", points = { {0.65, 0.05}, {0.36, 1} } })
hl.curve("linear", { type = "bezier", points = { {0, 0}, {1, 1} } })
hl.curve("almostLinear", { type = "bezier", points = { {0.5, 0.5}, {0.75, 1} } })
hl.curve("quick", { type = "bezier", points = { {0.15, 0}, {0.1, 1} } })
-- Default springs
hl.curve("easy", { type = "spring", mass = 1, stiffness = 238.1191, dampening = 24.21279333 })
--#### end stuff
require("hypr-monitors")
hl.monitor({
output = "eDP-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
hl.bind("F12", hl.dsp.exec_cmd("mize run sci ne"))
hl.bind("F11", hl.dsp.exec_cmd("mize run sci ne -b"))
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("mize run sci ne"))
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("mize run sci ne -b"))
-- Layout toggles
-- hl.bind(mod .. "+comma", hl.dsp.layout)
-- hl.bind(mod .. "+period", hl.dsp.layout.toggle_split)
-- scratchpad
--hl.bind(mod .. "+SHIFT+tab", hl.dsp.window.)
--hl.bind(mod .. "+tab", hl.dsp.scratchpad.show)
-- ### Scratchpad terminal (super+f)
--[[
hl.on("hyprland.start", function()
hl.exec_cmd("alacritty --class scratchterm")
end)
hl.window_rule({
match = { class = "scratchterm" },
float = true,
move = "center",
size = "2400 1400",
workspace = "special:scratch",
})
hl.bind(mod .. "+f", function()
hl.dsp.workspace.toggle_special("scratch")
end)
]]
--#### screenshot
hl.bind(mod .. "+ SHIFT + s", hl.dsp.exec_cmd("screenshot"))

48
hosts/main/installing.sh Normal file
View File

@@ -0,0 +1,48 @@
# empty nix based chroot... install variant
function inst_create_dir() {
mkdir -p /cachy
}
function inst_mount() {
if findmnt /cachy/nix; then
return
fi
mkdir -p /cachy/nix
mkdir -p /cachy/proc
mkdir -p /cachy/sys
mkdir -p /cachy/out
mkdir -p /cachy/dev
mount -o bind /nix /cachy/nix
mount -o bind /proc /cachy/proc
mount -o bind /sys /cachy/sys
mount -o bind /dev /cachy/dev
mount -o bind / /cachy/out
}
function inst_enter() {
NIX=$(realpath $(which nix))
SHELL=$(realpath $(which bash))
CHROOT=$(which chroot)
ENV=$(dirname $(realpath $(which env)))/env
PATH=$(nix eval --impure --raw --expr 'let pkgs = import <nixpkgs> {}; in with pkgs; lib.makeBinPath [ vim nix pacman busybox curl bash gawk ]')
echo -en 'source /to-source; echo hooooooo; rm /rcfile' > /cachy/rcfile
$CHROOT /cachy $ENV -i PATH="$PATH" $SHELL --rcfile /rcfile
# export SSL_CERT_FILE=/out/etc/static/ssl/certs/ca-certificates.crt
mkdir -p /etc
echo "nameserver 1.1.1.1" > /etc/resolv.conf
}
function inst_setup() {
curl https://mirror.cachyos.org/cachyos-repo.tar.xz -o cachyos-repo.tar.xz
tar -xf cachyos-repo.tar.xz
touch /etc/pacman.conf
pacman-key --init
mkdir -p /var/lib/pacman
bash ./cachyos-repo/cachyos-repo.sh
mkdir -p /lib
ln -fs $(nix eval --extra-experimental-features nix-command --extra-experimental-features flakes nixpkgs#glibc.out --raw)/lib64/ld-linux-x86-64.so.2 /lib/ld-linux-x86-64.so.2
}

View File

@@ -0,0 +1,15 @@
[Unit]
Description=Bitwarden keyring daemon
After=graphical-session.target
PartOf=graphical-session.target
[Service]
Type=simple
# initialize the default working directory
ExecStartPre=mkdir -p %h/snap/bw/common/bw-keyring-daemon/
ExecStartPre=chmod 700 %h/snap/bw/common/bw-keyring-daemon/
# start the keyring
ExecStart=%h/work/src/bw-keyring-daemon/target/release/bw-keyring-daemon -c %h/work/config/hosts/main/bw-keyring.json -d
[Install]
WantedBy=graphical-session.target

View File

@@ -0,0 +1,10 @@
[Unit]
Description=Systemd service for Lan Mouse
[Service]
Environment=PATH=/bin:/home/me/work/config/hosts/main/bin
ExecStart=lan-mouse daemon
Type=simple
[Install]
WantedBy=graphical-session.target

10
hosts/main/lan-mouse.toml Normal file
View File

@@ -0,0 +1,10 @@
port = 4410
[[clients]]
hostname = "mac"
ips = ["192.168.4.3"]
port = 4410
position = "right"
activate_on_startup = true
[authorized_fingerprints]

23
hosts/main/mize.toml Normal file
View File

@@ -0,0 +1,23 @@
part_dir.ppc = "/home/me/here/mize"
data_dir = "/home/me/work/app-data/mize/misc"
store = "/home/me/work/app-data/mize"
spacetime.url = "100.88.46.87:8005"
namespace = "priv.c2vi.dev"
log.level = "debug"
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]
url = "http://localhost:3000"
[auth.client]
issuer = "https://auth.ppc.social"
client_id = "363768685120258051"
update_spacetime_token = true

Some files were not shown because too many files have changed in this diff Show More