diff --git a/files/fish/functions/fish_custom_functions.fish b/files/fish/functions/fish_custom_functions.fish index 678465e..98a3551 100644 --- a/files/fish/functions/fish_custom_functions.fish +++ b/files/fish/functions/fish_custom_functions.fish @@ -1,35 +1,6 @@ -function code-projects - string replace '@' '~/projects/code/' $argv[1] -end - -function git-root - set -l result (git root 2>/dev/null) && \ - echo $result || echo "" -end - -function bookmarks - $EDITOR (string replace ':' '~/resources/bookmarks/' $argv[1]) -end - function xdg-user-directory - switch (string replace '@' '' $argv[1]) - case "desktop" - echo $XDG_DESKTOP_DIR - case "documents" - echo $XDG_DOCUMENTS_DIR - case "downloads" - echo $XDG_DOWNLOAD_DIR - case "music" - echo $XDG_MUSIC_DIR - case "pictures" - echo $XDG_PICTURES_DIR - case "public" - echo $XDG_PUBLICSHARE_DIR - case "templates" - echo $XDG_TEMPLATES_DIR - case "videos" - echo $XDG_VIDEOS_DIR - end + string replace '@' '' \ + (string join '' '$XDG_' (string upper $argv[1]) '_DIR') end function bang-bang @@ -51,11 +22,3 @@ function bang-star set -l arr (string replace -ra '([^\\\ ])( |\n)+' '$1\n' $history[1]) echo $arr[..-2] end - -function edit-home - echo "~/projects/code/scm/radix/ && $EDITOR home-environments/$(whoami).scm" -end - -function edit-system - echo "~/projects/code/scm/radix/ && $EDITOR operating-systems/$(hostname).scm" -end diff --git a/home-environments/radio.scm b/home-environments/radio.scm index 84df9a4..4285dab 100644 --- a/home-environments/radio.scm +++ b/home-environments/radio.scm @@ -1,4 +1,4 @@ -(define-module (radix home-environments radio) +(define-module (home-environments radio) #|GNU|# #:use-module (gnu) #:use-module ((gnu home) #:select (this-home-environment)) @@ -37,7 +37,7 @@ #:use-module (gnu packages suckless) #|T|# #:use-module (gnu packages telegram) #:use-module (gnu packages text-editors) - #:use-module (gnu packages tor) + #:use-module (gnu packages tor-browsers) #:use-module (gnu packages toys) #|V|# #:use-module (gnu packages version-control) #:use-module (gnu packages video) @@ -72,16 +72,20 @@ #|X|# #:use-module (radix home services xdg) #|Z|# #:use-module (radix home services zathura) - #|Radix files|# - #|A|# #:use-module ((radix files awesome) #:prefix file:awesome-) - #|E|# #:use-module ((radix files emacs) #:prefix file:emacs-) - #|F|# #:use-module ((radix files fish) #:prefix file:fish-) - #|G|# #:use-module ((radix files git) #:prefix file:git-) - #|I|# #:use-module ((radix files info) #:prefix file:info-) - #|K|# #:use-module ((radix files kakoune) #:prefix file:kak-) - #|L|# #:use-module ((radix files lf) #:prefix file:lf-) - #|M|# #:use-module ((radix files mpv) #:prefix file:mpv-) - #|N|# #:use-module ((radix files newsraft) #:prefix file:newsraft-) + #|Radio|# + #|S|# #:use-module ((radio fish-abbreviations) #:prefix fish-abbreviations:) + + #|Radio files|# + #|A|# #:use-module ((radio files awesome) #:prefix file:awesome-) + #|E|# #:use-module ((radio files emacs) #:prefix file:emacs-) + #|F|# #:use-module ((radio files fish) #:prefix file:fish-) + #|G|# #:use-module ((radio files git) #:prefix file:git-) + #|I|# #:use-module ((radio files info) #:prefix file:info-) + #|K|# #:use-module ((radio files kakoune) #:prefix file:kak-) + #|L|# #:use-module ((radio files lf) #:prefix file:lf-) + #|M|# #:use-module ((radio files mpv) #:prefix file:mpv-) + #|N|# #:use-module ((radio files newsraft) #:prefix file:newsraft-) + #:export (home-environment)) @@ -278,172 +282,15 @@ ("':e'" . "kak") ("':q'" . "exit"))) (abbreviations - (let ((code-projects "~/projects/code") - (code-project-extensions - '(c clj cpp el html kak md org pl py scm sh tex zig)) - (xdg-user-directories - '(desktop documents downloads music - pictures public templates videos)) - (bookmarks - '(emacs guile guix haunt misc))) - (list #|Quick access|# - (abbreviation - (name "@user-dirs") - (position 'anywhere) - (pattern - (apply format #f "@(~a~@{|~a~})" - xdg-user-directories)) - (expansion (fish-function "xdg-user-directory"))) - (abbreviation - (name "@extension") - (position 'anywhere) - (pattern - (apply format #f "@(~a~@{|~a~})" - code-project-extensions)) - (expansion - (fish-function "code-projects"))) - (abbreviation - (name "@punk") - (position 'anywhere) - (expansion - (format #f "~a/cpp/punk" - code-projects))) - (abbreviation - (name "@guix") - (position 'anywhere) - (expansion - (format #f "~a/scm/guix" - code-projects))) - (abbreviation - (name "@radix") - (position 'anywhere) - (expansion - (format #f "~a/scm/radix" - code-projects))) - (abbreviation - (name "@files") - (position 'anywhere) - (expansion - (format #f "~a/scm/radix/files" - code-projects))) - (abbreviation - (name "@modules") - (position 'anywhere) - (expansion - (format #f "~a/scm/radix/modules/radix" - code-projects))) - (abbreviation - (name "@research") - (position 'anywhere) - (expansion "~/areas/research")) - (abbreviation - (name "@bookmarks") - (position 'anywhere) - (expansion "~/resources/bookmarks")) - (abbreviation - (name "@git-root") - (pattern "@git-root") - (position 'anywhere) - (expansion - (fish-function "git-root"))) - - #|Quick edit|# - (abbreviation - (name ":e") - (expansion "$EDITOR")) - (abbreviation - (name ":system") - (expansion - (fish-function "edit-system"))) - (abbreviation - (name ":home") - (expansion - (fish-function "edit-home"))) - (abbreviation - (name ":todo") - (expansion "~/areas/organization/todo")) - (abbreviation - (name ":bookmark") - (position 'anywhere) - (pattern - (apply format #f ":(~a~@{|~a~})" bookmarks)) - (expansion - (fish-function "bookmarks"))) - - #|Media downloading|# - (abbreviation - (name "i") - (expansion "ipfs get %")) - (abbreviation - (name "d") - (expansion "aria2c -j 10 '%'")) - (abbreviation - (name "m") - (expansion - (format #f "yt-dlp --prefer-free-formats ~ - --extract-audio '%'"))) - (abbreviation - (name "v") - (expansion - "yt-dlp --prefer-free-formats '%'")) - - #|Command history reuse|# - (abbreviation - (name "!!") - (position 'anywhere) - (expansion - (fish-function "bang-bang"))) - (abbreviation - (name "!!:k") - (position 'anywhere) - (pattern "!!:[0-9]+") - (expansion - (fish-function "bang-bang-k"))) - (abbreviation - (name "!$") - (position 'anywhere) - (expansion - (fish-function "bang-dollar"))) - (abbreviation - (name "!*") - (position 'anywhere) - (expansion - (fish-function "bang-star"))) - - #|Guix reconfiguration|# - (abbreviation - (name "!dgen") - (position 'anywhere) - (expansion "guix % delete-generations 2w")) - (abbreviation - (name "!repair") - (expansion "doas guix build --repair")) - (abbreviation - (name "!pull") - (position 'anywhere) - (expansion "guix pull")) - (abbreviation - (name "!home") - (expansion - "guix home reconfigure ~/.config/guix/home.scm")) - (abbreviation - (name "!system") - (expansion - "doas guix system reconfigure /etc/config.scm")) - - #|Utils|# - (abbreviation - (name "zedit") - (expansion "zcat % | $EDITOR")) - (abbreviation - (name "tf") - (position 'anywhere) - (expansion - "setsid -f %>/dev/null 2>&1 & disown")) - (abbreviation - (name "zxz") - (expansion - "curl -F file=@% https://0x0.st | xsel -b"))))))) + `(,@fish-abbreviations:user-dirs + ,@fish-abbreviations:extensions + ,@fish-abbreviations:channels + ,@fish-abbreviations:quick-edit + ,@fish-abbreviations:bookmarks + ,@fish-abbreviations:history + ,@fish-abbreviations:guix + ,@fish-abbreviations:terminal-emulators + ,@fish-abbreviations:download/upload)))) (simple-service 'environment-variables-service home-environment-variables-service-type @@ -457,8 +304,9 @@ ("GUILE_WARN_DEPRECATED" . "detailed") ("GUILE_HISTORY" . "$XDG_CACHE_HOME/guile/history") ("GUILE_LOAD_PATH" - . ,(format #f "~a:~a~@{:~a/share/guile/site/3.0~}" + . ,(format #f "~a:~a:~a~@{:~a/share/guile/site/3.0~}" "$HOME/areas/code/scm" + "$HOME/areas/code/scm/ajatt" "$HOME/areas/code/scm/radix/modules" "$HOME/.guix-home/profile" "$XDG_CONFIG_HOME/guix/current" diff --git a/modules/radix/files/awesome.scm b/home-environments/radio/files/awesome.scm similarity index 84% rename from modules/radix/files/awesome.scm rename to home-environments/radio/files/awesome.scm index 47eb69a..23ad811 100644 --- a/modules/radix/files/awesome.scm +++ b/home-environments/radio/files/awesome.scm @@ -1,4 +1,4 @@ -(define-module (radix files awesome) +(define-module (radio files awesome) #:use-module (gnu) #:export (config theme)) diff --git a/modules/radix/files/doas.scm b/home-environments/radio/files/doas.scm similarity index 77% rename from modules/radix/files/doas.scm rename to home-environments/radio/files/doas.scm index f93246e..d6f3899 100644 --- a/modules/radix/files/doas.scm +++ b/home-environments/radio/files/doas.scm @@ -1,4 +1,4 @@ -(define-module (radix files doas) +(define-module (radio files doas) #:use-module (gnu) #:export (completion)) diff --git a/modules/radix/files/emacs.scm b/home-environments/radio/files/emacs.scm similarity index 83% rename from modules/radix/files/emacs.scm rename to home-environments/radio/files/emacs.scm index b635125..63fccd7 100644 --- a/modules/radix/files/emacs.scm +++ b/home-environments/radio/files/emacs.scm @@ -1,4 +1,4 @@ -(define-module (radix files emacs) +(define-module (radio files emacs) #:use-module (gnu) #:export (init theme)) diff --git a/modules/radix/files/fish.scm b/home-environments/radio/files/fish.scm similarity index 73% rename from modules/radix/files/fish.scm rename to home-environments/radio/files/fish.scm index f2086b1..dec8246 100644 --- a/modules/radix/files/fish.scm +++ b/home-environments/radio/files/fish.scm @@ -1,4 +1,4 @@ -(define-module (radix files fish) +(define-module (radio files fish) #:use-module (gnu) #:export (functions custom-functions @@ -9,7 +9,8 @@ #:recursive? #t)) (define custom-functions - (local-file "../../../files/fish/functions/fish_custom_functions.fish")) + (local-file + "../../../files/fish/functions/fish_custom_functions.fish")) (define config (local-file "../../../files/fish/conf.d" diff --git a/modules/radix/files/git.scm b/home-environments/radio/files/git.scm similarity index 79% rename from modules/radix/files/git.scm rename to home-environments/radio/files/git.scm index 7dcd8b2..efda2ad 100644 --- a/modules/radix/files/git.scm +++ b/home-environments/radio/files/git.scm @@ -1,4 +1,4 @@ -(define-module (radix files git) +(define-module (radio files git) #:use-module (gnu) #:export (config)) diff --git a/modules/radix/files/info.scm b/home-environments/radio/files/info.scm similarity index 73% rename from modules/radix/files/info.scm rename to home-environments/radio/files/info.scm index 97e4c81..e05176e 100644 --- a/modules/radix/files/info.scm +++ b/home-environments/radio/files/info.scm @@ -1,4 +1,4 @@ -(define-module (radix files info) +(define-module (radio files info) #:use-module (gnu) #:export (config)) diff --git a/modules/radix/files/kakoune.scm b/home-environments/radio/files/kakoune.scm similarity index 84% rename from modules/radix/files/kakoune.scm rename to home-environments/radio/files/kakoune.scm index f02382a..0bfce18 100644 --- a/modules/radix/files/kakoune.scm +++ b/home-environments/radio/files/kakoune.scm @@ -1,4 +1,4 @@ -(define-module (radix files kakoune) +(define-module (radio files kakoune) #:use-module (gnu) #:export (config colorscheme)) diff --git a/modules/radix/files/lf.scm b/home-environments/radio/files/lf.scm similarity index 79% rename from modules/radix/files/lf.scm rename to home-environments/radio/files/lf.scm index 92bf6b5..923be43 100644 --- a/modules/radix/files/lf.scm +++ b/home-environments/radio/files/lf.scm @@ -1,4 +1,4 @@ -(define-module (radix files lf) +(define-module (radio files lf) #:use-module (gnu) #:export (config)) diff --git a/modules/radix/files/mpv.scm b/home-environments/radio/files/mpv.scm similarity index 79% rename from modules/radix/files/mpv.scm rename to home-environments/radio/files/mpv.scm index 32e9cf8..6000f28 100644 --- a/modules/radix/files/mpv.scm +++ b/home-environments/radio/files/mpv.scm @@ -1,4 +1,4 @@ -(define-module (radix files mpv) +(define-module (radio files mpv) #:use-module (gnu) #:export (config)) diff --git a/modules/radix/files/newsraft.scm b/home-environments/radio/files/newsraft.scm similarity index 77% rename from modules/radix/files/newsraft.scm rename to home-environments/radio/files/newsraft.scm index fc11894..440feab 100644 --- a/modules/radix/files/newsraft.scm +++ b/home-environments/radio/files/newsraft.scm @@ -1,4 +1,4 @@ -(define-module (radix files newsraft) +(define-module (radio files newsraft) #:use-module (gnu) #:export (config)) diff --git a/modules/radix/files/zathura.scm b/home-environments/radio/files/zathura.scm similarity index 77% rename from modules/radix/files/zathura.scm rename to home-environments/radio/files/zathura.scm index d7f745a..b015fc5 100644 --- a/modules/radix/files/zathura.scm +++ b/home-environments/radio/files/zathura.scm @@ -1,4 +1,4 @@ -(define-module (radix files zathura) +(define-module (radio files zathura) #:use-module (gnu) #:export (config)) diff --git a/home-environments/radio/fish-abbreviations.scm b/home-environments/radio/fish-abbreviations.scm new file mode 100644 index 0000000..7a2745b --- /dev/null +++ b/home-environments/radio/fish-abbreviations.scm @@ -0,0 +1,143 @@ +(define-module (radio fish-abbreviations) + #:use-module (ice-9 curried-definitions) + #:use-module (radix home services shells) + #:export (user-dirs + extensions + channels + quick-edit + bookmarks + guix + history + terminal-emulators + download/upload)) + +(define at + (symbol-prefix-proc '@)) + +(define user-dirs + (map (lambda (dir) + (abbreviation + (name (at dir)) + (position 'anywhere) + (expansion + (fish-function "xdg-user-directories")))) + '(desktop documents download music + pictures publicshare templates videos))) + +(define extensions + (map (lambda (extension) + (abbreviation + (name (at extension)) + (position 'anywhere) + (expansion + ((symbol-prefix-proc '~/projects/code/) extension)))) + '(c clj cpp el html kak md nasm org pl py scm sh tex zig))) + +(define channels + (map (lambda (channel) + (abbreviation + (name (at channel)) + (position 'anywhere) + (expansion + ((symbol-prefix-proc '~/projects/code/scm/) channel)))) + '(ajatt guix radix))) + +(define (edit . files) + (string-join (cons "$EDITOR" + (map symbol->string files)))) + +(define quick-edit + (list (abbreviation + (name ':e) + (expansion (edit))) + (abbreviation + (name ':system) + (expansion (edit '/etc/config.scm))) + (abbreviation + (name ':home) + (expansion + (edit '~/.config/guix/home.scm))) + (abbreviation + (name ':todo) + (expansion + (edit '~/areas/organization/todo))))) + +(define bookmarks + (map (lambda (bookmark) + (abbreviation + (name ((symbol-prefix-proc ':) bookmark)) + (position 'anywhere) + (expansion + (edit ((symbol-prefix-proc '~/resources/bookmarks/) bookmark))))) + '(emacs guile guix haunt misc))) + +(define history + (list (abbreviation + (name '!!) + (position 'anywhere) + (expansion + (fish-function "bang-bang"))) + (abbreviation + (name '!!:k) + (position 'anywhere) + (pattern "!!:[0-9]+") + (expansion + (fish-function "bang-bang-k"))) + (abbreviation + (name '!$) + (position 'anywhere) + (expansion + (fish-function "bang-dollar"))) + (abbreviation + (name '!*) + (position 'anywhere) + (expansion + (fish-function "bang-star"))))) + +(define guix + (list (abbreviation + (name '!dgen) + (position 'anywhere) + (expansion "guix % delete-generations 2w")) + (abbreviation + (name '!repair) + (expansion "doas guix build --repair")) + (abbreviation + (name '!pull) + (position 'anywhere) + (expansion "guix pull")) + (abbreviation + (name '!home) + (expansion + "guix home reconfigure ~/.config/guix/home.scm")) + (abbreviation + (name '!system) + (expansion + "doas guix system reconfigure /etc/config.scm")))) + +(define terminal-emulators + (list (abbreviation + (name 'tf) + (position 'anywhere) + (expansion + "setsid -f %>/dev/null 2>&1 & disown")))) + +(define download/upload + (list (abbreviation + (name 'a) + (expansion "aria2c -j 10 '%'")) + (abbreviation + (name 'i) + (expansion "ipfs get %")) + (abbreviation + (name 'm) + (expansion + "yt-dlp --prefer-free-formats --extract-audio '%'")) + (abbreviation + (name 'v) + (expansion + "yt-dlp --prefer-free-formats '%'")) + (abbreviation + (name 'z) + (expansion + "curl -F file=@% https://0x0.st | xsel -b")))) diff --git a/operating-systems/buer.scm b/operating-systems/buer.scm index 3c0de59..0f3b37a 100644 --- a/operating-systems/buer.scm +++ b/operating-systems/buer.scm @@ -1,4 +1,4 @@ -(define-module (radix operating-systems buer) +(define-module (operating-systems buer) #|GNU|# #:use-module (gnu) #:use-module ((gnu system) #:select (operating-system) @@ -52,9 +52,9 @@ #|Radix system|# #|S|# #:use-module (radix system setuid) - #|Radix files|# - #|S|# #:use-module ((radix files substitute-keys) #:prefix public-key:) - #|T|# #:use-module ((radix files thinkfan) #:prefix file:thinkfan-) + #|Buer files|# + #|S|# #:use-module ((buer files substitute-keys) #:prefix public-key:) + #|T|# #:use-module ((buer files thinkfan) #:prefix file:thinkfan-) #:export (operating-system)) diff --git a/modules/radix/files/substitute-keys.scm b/operating-systems/buer/files/substitute-keys.scm similarity index 83% rename from modules/radix/files/substitute-keys.scm rename to operating-systems/buer/files/substitute-keys.scm index f27dc5d..75a7e30 100644 --- a/modules/radix/files/substitute-keys.scm +++ b/operating-systems/buer/files/substitute-keys.scm @@ -1,4 +1,4 @@ -(define-module (radix files substitute-keys) +(define-module (buer files substitute-keys) #:use-module (gnu) #:export (yuria)) diff --git a/modules/radix/files/thinkfan.scm b/operating-systems/buer/files/thinkfan.scm similarity index 75% rename from modules/radix/files/thinkfan.scm rename to operating-systems/buer/files/thinkfan.scm index d0f77a6..b00b4ad 100644 --- a/modules/radix/files/thinkfan.scm +++ b/operating-systems/buer/files/thinkfan.scm @@ -1,4 +1,4 @@ -(define-module (radix files thinkfan) +(define-module (buer files thinkfan) #:use-module (gnu) #:export (config))