commit 2510e3c824c4ba2fc28a03c1998820642211a473 from: mtmn date: Sun Jul 26 13:56:10 2026 UTC add alpaca, rbx-copy-local, chores commit - 9602a701cc5674fd914cba572dbceb37544fbb27 commit + 2510e3c824c4ba2fc28a03c1998820642211a473 blob - 10ac46ac3ef5b792601c7a45da4f722335708fb0 blob + 82e5b11127c32452124cb5e2c80fa40fc2f9c304 --- flake.lock +++ flake.lock @@ -206,11 +206,11 @@ ] }, "locked": { - "lastModified": 1784440659, - "narHash": "sha256-Q5kNLlWngt7TaIIZoxDKWMHjiSaNRVqr70FqWCRRfr4=", + "lastModified": 1785046085, + "narHash": "sha256-UiK+mmZJuLWQVhJ5b2wDzogIYWAesyRm6LA3h3Ulh3Y=", "owner": "nix-community", "repo": "nix-index-database", - "rev": "4f8d52a3598b0dc7db7a5e7b419e3edd9d1ecfdb", + "rev": "11665045df8b9938ef811a3bfdc65cffb02b4b70", "type": "github" }, "original": { @@ -234,11 +234,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1784812282, - "narHash": "sha256-Na4aTmdz22ovtSvcvNKaRwEWkg801hDyX6t8JqvW+sE=", + "lastModified": 1784872115, + "narHash": "sha256-THPEF2po0fsoH8gNtp+Ae0XFDJH3N/ol7xO3v6VMTJU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6d12004108e0e4a5cfa4bd83b14477f040b15773", + "rev": "335f0738cb2fa9708f3f428e39d2eae975d1338d", "type": "github" }, "original": { blob - 464e0fbd4deffb00a139c5ebfeb8bfb89ba13140 blob + 18d152f68fb924a4694d4d0e8e8930ee9269573a Binary files hosts/furion/configuration.nix and hosts/furion/configuration.nix differ blob - d5e616902fb04e8c180a18ed03f4b6f771b1814e blob + 602d7e5fb56ce52d647ad82cd8d54b567086e524 Binary files hosts/nixaran/configuration.nix and hosts/nixaran/configuration.nix differ blob - fbda15b7d16d73daedfa6f8723ceb565ad61cffb blob + aa39ddb4f9deb8945f96157a7a8de93f38f6bf08 Binary files hosts/void/overlays/config/magdalena/config.json.nix and hosts/void/overlays/config/magdalena/config.json.nix differ blob - e6ed5c6fab8166a1d092dfe6efdb643695ff1f9a blob + 8902e1157561d9a63e3a029058b919dfdaf7613f Binary files hosts/void/overlays/config/shell/rc/void and hosts/void/overlays/config/shell/rc/void differ blob - /dev/null blob + 19b526d58a07f3bf3e83fa5e27abd80228d1087e (mode 644) --- /dev/null +++ modules/mixins/dotfiles/bin/alpaca_shell @@ -0,0 +1,100 @@ +#!/usr/bin/env bash +# alpaca_shell - lightweight interactive shell on top of alpaca +# + +set -euo pipefail +trap 'printf "\n"; exit 130' INT + +messages=( + "--system" "You help convert natural language into safe macOS shell commands. Reply with exactly one directive per turn. Emit shell commands without any prefix. Narrate or ask questions using '!print ' lines only; never send plain text without '!print'. Do not ask the user to provide commands—propose the next step yourself. Only ask clarifying questions when essential, prefacing them with '!print ?'. When the task is complete, reply with '!stop'. After every command I run, I send you another user message that begins with 'Command output:'. Use that context before choosing the next step." + "--user" "show the current working directory" + "--assistant" "pwd" + "--user" 'Command output:\n/Users/example' + "--assistant" "!stop" + "--user" "print hello world to the terminal" + "--assistant" 'echo "Hello, world!"' + "--user" 'Command output:\nHello, world!' + "--assistant" "!stop" +) + +while true; do + if ! read -erp 'alpaca> ' request; then + printf "\n" + break + fi + [[ "$request" =~ ^[[:space:]]*$ ]] && continue + [[ "$request" == ":quit" || "$request" == ":exit" ]] && break + + messages+=(--user "$request") + + while true; do + response=$(alpaca "${messages[@]}") + response=${response//$'\r'/} + directive=${response%%$'\n'*} + + if [[ -z "$directive" ]]; then + printf 'No response from model.\n' >&2 + break + fi + + messages+=(--assistant "$directive") + + if [[ "$directive" == "!stop" ]]; then + break + fi + + if [[ "$directive" == "!print"* ]]; then + text=${directive#!print} + text=${text# } + [[ -n "$text" ]] && printf '%s\n' "$text" + messages+=(--user "Narration displayed.") + continue + fi + + if [[ "$directive" == \!* ]]; then + printf '%s\n' "${directive:1}" + messages+=(--user "Message shown to user.") + continue + fi + + treat_as_command=0 + if [[ "$directive" =~ ^[^[:space:]]+= ]]; then + treat_as_command=1 + else + first_word=${directive%%[[:space:]]*} + if [[ -z "$first_word" ]]; then + treat_as_command=0 + elif command -v "$first_word" >/dev/null 2>&1; then + treat_as_command=1 + else + treat_as_command=0 + fi + fi + + if [[ $treat_as_command -eq 0 ]]; then + printf '%s\n' "$directive" + messages+=(--user "Narration displayed.") + continue + fi + + printf '+ %s\n' "$directive" + if output=$(bash -lc "$directive" 2>&1); then + [[ -n "$output" ]] && printf '%s\n' "$output" + if [[ -n "$output" ]]; then + messages+=("--user" $'Command output:\n'"$output") + else + messages+=("--user" "Command output: (no output)") + fi + else + exit_status=$? + [[ -n "$output" ]] && printf '%s\n' "$output" + printf 'Command failed (exit %d)\n' "$exit_status" >&2 + if [[ -n "$output" ]]; then + printf -v failure_output 'Command output (exit %d):\n%s' "$exit_status" "$output" + else + printf -v failure_output 'Command output (exit %d): (no output)' "$exit_status" + fi + messages+=("--user" "$failure_output") + fi + done +done blob - 71c85fa55a1dba76ab9ce11a5b1f1bb6d6bf4461 blob + 8c41d77748d43fd75667642ce470e0995ae33a3e --- modules/mixins/dotfiles/bin/nota +++ modules/mixins/dotfiles/bin/nota @@ -2,7 +2,7 @@ set -euo pipefail -dir=${NOTA_DIR:-"$HOME/notes/nota"} +dir=${NOTA_DIR:-"$HOME/notes"} : "${NOTA_READ_ONLY=0}" case ${1:-} in @@ -30,4 +30,4 @@ if ((NOTA_READ_ONLY)); then fi mkdir -p "$dir" -exec emacs -nw "$dir/$file" +exec emacs -nw --eval "(progn (require 'denote-journal) (let ((denote-directory \"$dir\")) (denote-journal-new-or-existing-entry \"$name\")))" blob - c6d35f9e06970734c2eac00035abd2fded2bc3e8 (mode 644) blob + /dev/null --- modules/mixins/dotfiles/bin/rbx_copy_local +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# Reads an M3U8 playlist and copies referenced files from a Windows-style -# path on a mounted disk to a local backlog directory. - -# Usage: rbx_copy_local PLAYLIST [DESTDIR] -# -# Defaults: -# DESTDIR = ~/misc/music/backlog/ -# MOUNT = ~/misc/mnt/disk/boo (what F:\ maps to) -# -# Override with environment variables: -# MOUNT_ROOT - Linux path equivalent of the Windows drive root -# DRIVE_LETTER - Windows drive letter to replace (default: F) - -require "pathname" -require "fileutils" - -abort "Usage: #{$PROGRAM_NAME} PLAYLIST [DESTDIR]" if ARGV.empty? - -playlist = Pathname.new(ARGV[0]).expand_path -playlist_name = playlist.sub_ext("").basename.to_s - -destdir = if ARGV[1] - Pathname.new(ARGV[1]).expand_path -else - Pathname.new("~").expand_path / "misc/music/backlog" / playlist_name -end - -mount_root = Pathname.new( - ENV.fetch("MOUNT_ROOT") { Pathname.new("~").expand_path / "misc/mnt/disk/boo" }.to_s -) - -drive_letter = ENV.fetch("DRIVE_LETTER", "F") - -def die(message) - warn "Error: #{message}" - exit 1 -end - -die "playlist not found: #{playlist}" unless playlist.file? -die "mount root does not exist: #{mount_root}" unless mount_root.directory? - -FileUtils.mkdir_p(destdir) - -copied = 0 -skipped = 0 -new_playlist_lines = [] - -playlist.readlines(chomp: true).each do |line| - if line.empty? || line.start_with?("#") - new_playlist_lines << line - next - end - - relative = line.sub(%r{^#{drive_letter}:}i, "").delete_prefix("\\").tr("\\", "/") - source = mount_root / relative - - unless source.file? - warn "Missing: #{source}" - skipped += 1 - new_playlist_lines << line - next - end - - target = destdir / relative - - if target.exist? - puts "Exists: #{target}" - skipped += 1 - else - FileUtils.mkdir_p(target.dirname) - FileUtils.cp(source, target, verbose: true) - copied += 1 - end - - new_playlist_lines << target.to_s -end - -new_playlist = destdir / playlist.basename -new_playlist.write(new_playlist_lines.join("\n") + "\n") - -puts "#{copied} copied, #{skipped} skipped" blob - /dev/null blob + 33ab2fcea37b09b5298229258af7c3c22a108220 (mode 644) --- /dev/null +++ modules/mixins/dotfiles/bin/rbx-copy-local @@ -0,0 +1,84 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# Reads an M3U8 playlist and copies referenced files from a Windows-style +# path on a mounted disk to a local backlog directory. + +# Usage: rbx-copy-local PLAYLIST [DESTDIR] +# +# Defaults: +# DESTDIR = ~/misc/music/backlog/ +# MOUNT = ~/misc/mnt/disk/boo (what F:\ maps to) +# +# Override with environment variables: +# MOUNT_ROOT - Linux path equivalent of the Windows drive root +# DRIVE_LETTER - Windows drive letter to replace (default: F) + +require "pathname" +require "fileutils" + +abort "Usage: #{$PROGRAM_NAME} PLAYLIST [DESTDIR]" if ARGV.empty? + +playlist = Pathname.new(ARGV[0]).expand_path +playlist_name = playlist.sub_ext("").basename.to_s + +destdir = if ARGV[1] + Pathname.new(ARGV[1]).expand_path +else + Pathname.new("~").expand_path / "misc/music/backlog" / playlist_name +end + +mount_root = Pathname.new( + ENV.fetch("MOUNT_ROOT") { Pathname.new("~").expand_path / "misc/mnt/disk/boo" }.to_s +) + +drive_letter = ENV.fetch("DRIVE_LETTER", "F") + +def die(message) + warn "Error: #{message}" + exit 1 +end + +die "playlist not found: #{playlist}" unless playlist.file? +die "mount root does not exist: #{mount_root}" unless mount_root.directory? + +FileUtils.mkdir_p(destdir) + +copied = 0 +skipped = 0 +new_playlist_lines = [] + +playlist.readlines(chomp: true).each do |line| + if line.empty? || line.start_with?("#") + new_playlist_lines << line + next + end + + relative = line.sub(%r{^#{drive_letter}:}i, "").delete_prefix("\\").tr("\\", "/") + source = mount_root / relative + + unless source.file? + warn "Missing: #{source}" + skipped += 1 + new_playlist_lines << line + next + end + + target = destdir / relative + + if target.exist? + puts "Exists: #{target}" + skipped += 1 + else + FileUtils.mkdir_p(target.dirname) + FileUtils.cp(source, target, verbose: true) + copied += 1 + end + + new_playlist_lines << target.to_s +end + +new_playlist = destdir / playlist.basename +new_playlist.write(new_playlist_lines.join("\n") + "\n") + +puts "#{copied} copied, #{skipped} skipped" blob - 600665d72c8bea29b9aca70437501f7f58ba21a5 (mode 644) blob + /dev/null --- modules/mixins/dotfiles/config/jj/config.toml +++ /dev/null @@ -1,48 +0,0 @@ -[user] -name = "mtmn" -email = "miro@haravara.org" - -[ui] -color = "auto" - -diff-editor = ["difft", "--color", "always", "$left", "$right"] - -merge-editor = "vimdiff" -log-format = 'separate(" ", format_short_change_id_with_hidden_and_divergent_info(self), bookmarks, description.first_line(), format_short_signature(author), "(" ++ format_timestamp(committer.timestamp()) ++ ")")' - -log-word-wrap = true -default-command = "log" - -[signing] -backend = "gpg" -sign-all = true -key = "miro@haravara.org" - -[git] -push-bookmark-prefix = "push-" # used when jj git push --change creates a bookmark -default-branch = "master" - -[merge-tools.vimdiff] -program = "nvim" -args = ["-f", "-d", "$left", "$merged", "$right", - "-c", "wincmd J", - "-c", "set modifiable", - "-c", "set write"] -merge-tool-edits-conflict-markers = false - -[merge-tools.difft] -program = "difft" -diff-args = ["--color", "always", "$left", "$right"] - -[revset-aliases] -"upstream()" = "latest(remote_bookmarks(remote=origin) & ancestors(@))" -"wip()" = "ancestors(@ | branches()) & mine()" -'closest_bookmark(to)' = 'heads(::to & bookmarks())' - -[aliases] -lg = ["log", "-r", "::@", "--template", 'separate(" ", format_short_change_id_with_hidden_and_divergent_info(self), format_short_signature(author), description.first_line(), "(" ++ format_timestamp(committer.timestamp()) ++ ")")'] -wip = ["bookmark", "list", "--all"] -tug = ["bookmark", "move", "--from", "closest_bookmark(@-)", "--to", "@-"] - -[remotes.origin] -auto-track-bookmarks = "*" blob - 3e9d44939fa4d241a596a98985215fb2256d563a blob + 2218d8b0380f0a8da21daf2fa0b2a4bbbc6c2f53 --- modules/mixins/dotfiles/config/newsraft/feeds +++ modules/mixins/dotfiles/config/newsraft/feeds @@ -255,7 +255,6 @@ https://www.youtube.com/feeds/videos.xml?channel_id=UC https://www.youtube.com/feeds/videos.xml?channel_id=UC1ydE9gDHTdvbNVIgEKIKzw VWestlife https://www.youtube.com/feeds/videos.xml?channel_id=UCpOJZSocCYp9ufh9qF5W5vQ Cursed Controls https://www.youtube.com/feeds/videos.xml?channel_id=UC7Jwj9fkrf1adN4fMmTkpug DankPods -https://www.youtube.com/feeds/videos.xml?channel_id=UC_n6DdR6FClpCbWnNM7Zp6A SpaceRex https://www.youtube.com/feeds/videos.xml?channel_id=UCFajCKBeNRW16Xb5mJvrCvw Kernotex https://www.youtube.com/feeds/videos.xml?channel_id=UCN1Dg0gd31dxNfQez6yPB7Q Stephanie Sammann https://www.youtube.com/feeds/videos.xml?channel_id=UCOT2iLov0V7Re7ku_3UBtcQ Hank Green @@ -265,3 +264,5 @@ https://www.youtube.com/feeds/videos.xml?channel_id=UC https://www.youtube.com/feeds/videos.xml?channel_id=UCpoq2g2xQlZThcj628CCTmQ Tastemaker Design https://www.youtube.com/feeds/videos.xml?channel_id=UCFCEuCsyWP0YkP3CZ3Mr01Q The Plain Bagel https://www.youtube.com/feeds/videos.xml?channel_id=UCPiMR-Ize9p3dgjzZ8bo9ZQ The Tech Report +https://www.youtube.com/feeds/videos.xml?channel_id=UCm_dHxrHKK_fmoUgj9YnYqw Truttle1 +https://www.youtube.com/feeds/videos.xml?channel_id=UCPIt7i7t3qCKVob-3dWrYjw NCOT Technology blob - 7d86625f86194cffeb4b2b5661c0458057259f47 blob + 36e0ffa4d28093a815f0a526a9ae609970d7a78f --- modules/mixins/dotfiles/config/shell/rc/aliased-short-names +++ modules/mixins/dotfiles/config/shell/rc/aliased-short-names @@ -130,3 +130,5 @@ alias plc='plass cat' alias pad='pass add' alias ped='pass edit' + +alias alpash='alpaca_shell' blob - 6cc849c3fc2b3d7106be1eaa090e1edaff331431 blob + 745177fc273eab2d539cb37e199265f2a335e875 --- modules/services/etherpad.nix +++ modules/services/etherpad.nix @@ -22,9 +22,15 @@ in { description = "Local TCP port for Etherpad to listen on"; }; + bindAddress = lib.mkOption { + type = lib.types.str; + default = "127.0.0.1"; + description = "Host IP address to bind the published container port to"; + }; + image = lib.mkOption { type = lib.types.str; - default = "etherpad/etherpad@sha256:044e5b58686f22e2c8b792ed0a7c35a83986458e1ee91f12119276c1e2572bce"; + default = "docker.io/etherpad/etherpad@sha256:044e5b58686f22e2c8b792ed0a7c35a83986458e1ee91f12119276c1e2572bce"; description = "OCI image reference (pinned by digest) for Etherpad"; }; @@ -98,7 +104,7 @@ in { containers.etherpad = { inherit (cfg) image; autoStart = true; - ports = ["127.0.0.1:${toString cfg.port}:9001"]; + ports = ["${cfg.bindAddress}:${toString cfg.port}:9001"]; volumes = [ "${stateDir}:/opt/etherpad-lite/var:Z" ]; @@ -165,7 +171,7 @@ in { services.caddy.virtualHosts."${cfg.domain}".extraConfig = '' ${haravara.mkAuthImport cfg.authLabel} - reverse_proxy 127.0.0.1:${toString cfg.port} + reverse_proxy ${cfg.bindAddress}:${toString cfg.port} ''; }; }