commit c322306404c4c70b54443609761599c29d66b686
parent a825a6d7f62531cff196f1f192ee26f72dbca421
Author: mtmn <miro@haravara.org>
Date: Thu, 2 Jul 2026 20:36:41 +0200
add backup, feeds, plakar alias
Diffstat:
7 files changed, 168 insertions(+), 57 deletions(-)
diff --git a/flake.lock b/flake.lock
@@ -162,11 +162,11 @@
]
},
"locked": {
- "lastModified": 1782964450,
- "narHash": "sha256-2rwNd77TzZ4sDDvMam0IXFXN5IfC35mifoeKS0uAc/4=",
+ "lastModified": 1783024095,
+ "narHash": "sha256-oE+TNK98Pl7nHW4VU1oBvUKD5JR45U+py/NJmLoTNHI=",
"owner": "nix-community",
"repo": "home-manager",
- "rev": "ebc87daabc8d3f595e9a8b67107eaaa8115ad582",
+ "rev": "a4d410db95a6416d1008049330bd86b85b5db45a",
"type": "github"
},
"original": {
@@ -204,11 +204,11 @@
]
},
"locked": {
- "lastModified": 1782636943,
- "narHash": "sha256-ripjZa7BBLwL1uS5VJF3s/VpZpWt5ZIQEvkJ/FJNpQw=",
+ "lastModified": 1783023993,
+ "narHash": "sha256-gaOvvY/lL1eWoSmSRO17pWry8R49AuPMrF4nzu47K5o=",
"owner": "nix-community",
"repo": "nix-index-database",
- "rev": "058b1f9381fa79fcda49982370a750ff92dbba43",
+ "rev": "f8ed6cdcb1fd28a6ab7b61f4467a4f67fe2d9074",
"type": "github"
},
"original": {
diff --git a/hosts/void/default.nix b/hosts/void/default.nix
@@ -45,6 +45,7 @@
ouch
xan
nb
+ yq
];
vcs = [
@@ -141,7 +142,6 @@
sysbench
fswatch
lf
- fontpreview
elvish
jdupes
tealdeer
diff --git a/hosts/void/overlays/config/ghostty/config.ghostty b/hosts/void/overlays/config/ghostty/config.ghostty
@@ -1,48 +0,0 @@
-window-decoration = none
-
-scrollback-limit = 10000
-mouse-hide-while-typing = true
-
-font-family = "Codelia"
-font-size = 12
-
-font-synthetic-style = no-bold,no-italic,no-bold-italic
-
-cursor-style = block
-cursor-style-blink = false
-shell-integration-features = no-cursor
-
-selection-background = #1d3b2e
-selection-foreground = #d6deeb
-
-background = #0d1612
-foreground = #d6deeb
-
-cursor-color = #9ec9d6
-cursor-text = #0d1612
-
-palette = 0=#0d1612
-palette = 1=#ef5350
-palette = 2=#22da6e
-palette = 3=#addb67
-palette = 4=#7fdbca
-palette = 5=#c792ea
-palette = 6=#21c7a8
-palette = 7=#d6deeb
-palette = 8=#637777
-palette = 9=#ef5350
-palette = 10=#22da6e
-palette = 11=#ffeb95
-palette = 12=#7fdbca
-palette = 13=#c792ea
-palette = 14=#7fdbca
-palette = 15=#ffffff
-
-keybind = ctrl+shift+c=copy_to_clipboard
-keybind = ctrl+shift+v=paste_from_clipboard
-keybind = shift+insert=paste_from_selection
-keybind = ctrl+plus=increase_font_size:1
-keybind = ctrl+equal=increase_font_size:1
-keybind = ctrl+minus=decrease_font_size:1
-keybind = ctrl+0=reset_font_size
-keybind = ctrl+shift+n=new_window
diff --git a/modules/mixins/dotfiles/bin/backup b/modules/mixins/dotfiles/bin/backup
@@ -0,0 +1,143 @@
+#!/usr/bin/env bb
+;; vim: ft=clojure
+
+(ns backup
+ (:require [clojure.string :as str]
+ [clojure.tools.cli :refer [parse-opts]]
+ [babashka.process :refer [shell]]))
+
+(defn- ts []
+ (.format (java.time.ZonedDateTime/now)
+ (java.time.format.DateTimeFormatter/ofPattern "yyyy-MM-dd'T'HH:mm:ssZ")))
+
+(defn- log-msg [msg]
+ (println (format "[%s]: %s" (ts) msg)))
+
+(defn- err-msg [msg]
+ (binding [*out* *err*]
+ (println (format "[%s]: %s" (ts) msg))))
+
+(defn- fatal [msg]
+ (err-msg msg)
+ (System/exit 1))
+
+(def ^:private failures (atom []))
+
+(defn- record-failure [msg]
+ (swap! failures conj msg)
+ (err-msg (str "ERROR: " msg)))
+
+(defn- check [msg result]
+ (or (zero? (:exit result))
+ (do (record-failure msg) false)))
+
+(def ^:private home (or (System/getenv "HOME") (fatal "HOME not set")))
+
+(defn- in-home [m] (update-vals m #(str home %)))
+
+(def git-dirs
+ (in-home {"mpd" "/.config/mpd"
+ "nix" "/src/sr.ht/nix"
+ "nota" "/.nb/notes"
+ "pass" "/.password-store"
+ "releases" "/src/haravara.org/releases"
+ "bandcamp" "/misc/music/backlog/_todo"}))
+
+(def tarsnap-dirs
+ (in-home {"password-store" "/.password-store"
+ "releases" "/src/haravara.org/releases"
+ "mpd" "/.config/mpd"
+ "nota" "/.nb/notes"}))
+
+(defn- run-cmd [verbose & args]
+ (apply shell
+ (if verbose
+ {:continue true :out :inherit :err :inherit}
+ {:continue true :out :string :err :string})
+ args))
+
+(defn- git [verbose dir & args]
+ (apply run-cmd verbose "git"
+ (str "--git-dir=" dir "/.git") (str "--work-tree=" dir) args))
+
+(defn- commit-changes [verbose dir]
+ (let [staged (git false dir "diff" "--cached" "--name-only")]
+ (when (check (str "Failed to list staged changes in " dir) staged)
+ (when (check (str "Failed to commit changes in " dir)
+ (git verbose dir "commit" "-m"
+ (str/join " " (map str/trim (str/split-lines (:out staged))))))
+ (log-msg (str "Committed changes in " dir))
+ true))))
+
+(defn- push-changes [dir]
+ (log-msg (str "Pushing changes from " dir))
+ (let [result (git false dir "push")]
+ (condp = (:exit result)
+ 0 (log-msg (str "Done pushing " dir))
+ 128 (log-msg (str "No push destination for " dir " (skipped)"))
+ (record-failure (str "Push failed for " dir " (exit " (:exit result) "): "
+ (str/trim (:err result)))))))
+
+(defn- sync-repo [{:keys [verbose push]} name dir]
+ (log-msg (str "git/" name))
+ (when (check (str "Failed to stage changes in " dir)
+ (git verbose dir "add" "-A"))
+ (let [ok (if (zero? (:exit (git false dir "diff" "--cached" "--quiet")))
+ (do (log-msg (str "Nothing to commit in " dir)) true)
+ (commit-changes verbose dir))]
+ (when (and push ok)
+ (push-changes dir)))))
+
+(defn- tarsnap-archive [{:keys [verbose]} name dir]
+ (let [stamp (.format (java.time.LocalDateTime/now)
+ (java.time.format.DateTimeFormatter/ofPattern "yyyy-MM-dd_HH:mm:ss"))]
+ (log-msg (format "Archiving tarsnap/%s from %s" name dir))
+ (when (check (format "tarsnap failed for %s" name)
+ (run-cmd verbose "tarsnap" "-c" "-f" (str name "-" stamp) "-C" dir "."))
+ (log-msg (format "Done tarsnap/%s" name)))))
+
+(def backends
+ {"git" {:dirs git-dirs :run sync-repo}
+ "tarsnap" {:dirs tarsnap-dirs :run tarsnap-archive}})
+
+(defn- list-targets []
+ (doseq [bname (sort (keys backends))]
+ (println bname)
+ (doseq [k (sort (keys (get-in backends [bname :dirs])))]
+ (println (str " " k)))))
+
+(defn- backup-target [opts target]
+ (let [[bname name] (str/split target #":" 2)
+ {:keys [dirs run]} (or (backends bname)
+ (fatal (str "Unknown target: " target)))]
+ (if name
+ (run opts name (or (dirs name)
+ (fatal (str "Unknown " bname " target: " name))))
+ (doseq [[name dir] dirs]
+ (run opts name dir)))))
+
+(def cli-options
+ [["-t" "--target TARGET" "git, tarsnap, <backend>:<name>"]
+ ["-p" "--push" "Push changes after commit"]
+ ["-q" "--quiet" "Suppress command output"]
+ ["-l" "--list" "List all configured backup targets"]
+ ["-h" "--help"]])
+
+(defn -main [& args]
+ (let [{:keys [options errors summary]} (parse-opts args cli-options)]
+ (when errors
+ (run! println errors)
+ (System/exit 1))
+ (when (or (:help options)
+ (not (or (:list options) (:target options))))
+ (println "Usage: backup [options]")
+ (println summary)
+ (System/exit 0))
+ (if (:list options)
+ (list-targets)
+ (backup-target {:verbose (not (:quiet options)) :push (:push options)}
+ (:target options)))
+ (when (seq @failures)
+ (fatal (format "%d backup target(s) failed" (count @failures))))))
+
+(apply -main *command-line-args*)
diff --git a/modules/mixins/dotfiles/config/newsraft/feeds b/modules/mixins/dotfiles/config/newsraft/feeds
@@ -251,3 +251,4 @@ https://www.youtube.com/feeds/videos.xml?channel_id=UC1ydE9gDHTdvbNVIgEKIKzw VWe
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
diff --git a/modules/mixins/dotfiles/config/shell/rc/functions b/modules/mixins/dotfiles/config/shell/rc/functions
@@ -7,6 +7,10 @@ nixpkgs_cache_index_update() {
ln -f "$filename" files
}
+plakar_backup_all() {
+ yq '.sources | keys | .[]' ~/.config/plakar/sources.yml | tr -d '"' | sed 's/^/@/' | xargs -r plakar at "@${1:-puck}" backup
+}
+
nvimrecomp() {
nix_fennel_path="$HOME/src/sr.ht/nix/modules/mixins/dotfiles/config/nvim/fnl"
config_path="$HOME/.config/nvim"
@@ -56,7 +60,6 @@ tracklist() {
done
}
-
tarstamp() {
: "${1?name required}" "${2?path required}"
tarsnap -c -f "$1-$(date +%Y-%m-%d_%H:%M:%S)" "$2"
diff --git a/modules/mixins/dotfiles/home/SciTEUser.properties b/modules/mixins/dotfiles/home/SciTEUser.properties
@@ -1,6 +1,18 @@
font.base=font:!Fira Mono,size:12
-style.*.32=$(font.base)
+font.override=$(font.base),notbold,notitalics
+style.*.32=$(font.base),back:#000000,fore:#D0D0D0
+style.*.34=notbold,fore:#FFFFFF
+style.*.35=notbold
+caret.fore=#FFFFFF
+selection.back=#404040
tabbar.visible=0
toolbar.visible=0
statusbar.visible=0
+margin.width=0
+blank.margin.left=0
+fold=0
+fold.margin.width=0
+fold.margin.colour=#000000
+fold.margin.highlight.colour=#000000
+horizontal.scrollbar=0