aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/dodo/config.py8
-rw-r--r--config/guix/channels.scm10
-rwxr-xr-xconfig/i3/scripts/keyboard_switch14
-rwxr-xr-xconfig/i3/scripts/pass6
-rw-r--r--config/nvim/init.vim11
-rw-r--r--config/nvim/lua/plugins.lua53
-rw-r--r--config/sway/bindsym-launch2
-rw-r--r--config/sway/bindsym-media4
-rw-r--r--config/sway/bindsym-system8
-rw-r--r--config/sway/daemons2
-rwxr-xr-xconfig/sway/scripts/pass6
-rwxr-xr-xconfig/sway/scripts/screenshot19
-rw-r--r--config/systemd/user/davmail.service5
-rw-r--r--config/systemd/user/waybar.service8
-rwxr-xr-xconfig/waybar/email.sh2
-rw-r--r--gitconfig1
-rw-r--r--guile4
-rw-r--r--infokey4
-rwxr-xr-xinstall26
-rwxr-xr-xlocal/bin/allsync63
-rwxr-xr-xlocal/bin/cloud39
-rwxr-xr-xlocal/bin/elektroline-windows4
-rwxr-xr-xlocal/bin/elektroline0016
-rwxr-xr-xlocal/bin/new-flake-dev47
-rwxr-xr-xlocal/bin/project-test30
-rwxr-xr-xlocal/bin/startsway7
-rwxr-xr-xlocal/sbin/wayvnc12
-rwxr-xr-xlocal/share/applications/elektroline-windows.desktop6
m---------private0
-rw-r--r--profile6
-rw-r--r--shvcli.ini7
-rw-r--r--shvcli.toml4
-rw-r--r--utils/ask24
-rw-r--r--utils/guix16
-rw-r--r--utils/inst53
35 files changed, 315 insertions, 202 deletions
diff --git a/config/dodo/config.py b/config/dodo/config.py
index 1e52b85..1347424 100644
--- a/config/dodo/config.py
+++ b/config/dodo/config.py
@@ -1,21 +1,24 @@
import dodo
-dodo.settings.smtp_accounts = ["email", "gmail", "fel"]
+dodo.settings.smtp_accounts = ["email", "gmail", "ell", "fel"]
dodo.settings.email_address = {
"email": "Karel Kočí <cynerd@email.cz>",
"gmail": "Karel Kočí <citrisin@gmail.com>",
+ "ell": "Karel Kočí <kkoci@elektroline.cz>",
"fel": "Karel Kočí <kocikare@fel.cvut.cz>",
}
dodo.settings.sent_dir = {
"email": "~/.mail/email/sent/",
"gmail": "~/.mail/gmail/Drafts/",
+ "ell": "~/.mail/ell/Sent/",
"fel": "~/.mail/fel/Sent/",
}
dodo.settings.gnupg_keyid = "2B1F70F95F1B48DA2265A7FAA6BC8B8CEB31659B"
dodo.settings.theme = dodo.themes.nord
+dodo.settings.wrap_message = False
dodo.settings.editor_command = "alacritty -e nvim '{file}'"
-dodo.settings.file_browser_command = "alacritty -e ranger '{dir}'"
+dodo.settings.file_browser_command = "alacritty -e mc '{dir}'"
dodo.settings.file_picker_command = "alacritty -e ranger --choosefiles='{tempfile}'"
dodo.settings.sync_mail_interval = -1
dodo.settings.default_thread_list_mode = "thread"
@@ -35,6 +38,7 @@ dodo.settings.tag_icons = {
dodo.settings.default_to_html = False
dodo.settings.html_block_remote_requests = False
+dodo.settings.html_confirm_open_links = False
dodo.util.html2html = dodo.util.clean_html2html
del dodo.keymap.global_keymap["`"]
diff --git a/config/guix/channels.scm b/config/guix/channels.scm
new file mode 100644
index 0000000..a56d8b6
--- /dev/null
+++ b/config/guix/channels.scm
@@ -0,0 +1,10 @@
+(cons* (channel
+ (name 'nonguix)
+ (url "https://gitlab.com/nonguix/nonguix")
+ ;; Enable signature verification:
+ (introduction
+ (make-channel-introduction
+ "897c1a470da759236cc11798f4e0a5f7d4d59fbc"
+ (openpgp-fingerprint
+ "2A39 3FFF 68F4 EF7A 3D29 12AF 6F51 20A0 22FB B2D5"))))
+ %default-channels)
diff --git a/config/i3/scripts/keyboard_switch b/config/i3/scripts/keyboard_switch
index 7ba27f8..168d577 100755
--- a/config/i3/scripts/keyboard_switch
+++ b/config/i3/scripts/keyboard_switch
@@ -1,13 +1,13 @@
#!/bin/bash
-active=`~/.config/i3/scripts/keyboard_layout`
+active=$(~/.config/i3/scripts/keyboard_layout)
case "$active" in
- us)
- setxkbmap cz_qwerty
- ;;
- cz_qwerty)
- setxkbmap us
- ;;
+us)
+ setxkbmap cz_qwerty
+ ;;
+cz_qwerty)
+ setxkbmap us
+ ;;
esac
# Send update to i3blocks
diff --git a/config/i3/scripts/pass b/config/i3/scripts/pass
index aa2ad96..4777c1c 100755
--- a/config/i3/scripts/pass
+++ b/config/i3/scripts/pass
@@ -1,6 +1,6 @@
#!/bin/sh
-find ~/.password-store -type f -printf '%P\n' | \
- sed 's/\.gpg$//' | dmenu -p 'Pass:' | \
+find ~/.password-store -type f -printf '%P\n' |
+ sed 's/\.gpg$//' | dmenu -p 'Pass:' |
while read -r psw; do
pass -c "$psw"
-done
+ done
diff --git a/config/nvim/init.vim b/config/nvim/init.vim
index 77e572d..c269b77 100644
--- a/config/nvim/init.vim
+++ b/config/nvim/init.vim
@@ -55,8 +55,8 @@ set laststatus=2
set noshowmode
set number
-set colorcolumn=80
set textwidth=80
+set colorcolumn=+0
nmap <c-/> :noh<cr>
@@ -99,6 +99,9 @@ nnoremap <c-c><CR> :Explore<cr>
nnoremap <c-c>l :bnext<cr>
nnoremap <c-c>h :bprev<cr>
+" Table mode
+let g:table_mode_syntax = 0
+
" Format
nmap <leader>f :lua require("conform").format()<cr>
@@ -108,10 +111,6 @@ highlight GitGutterAdd ctermfg=2
highlight GitGutterChange ctermfg=3
highlight GitGutterDelete ctermfg=1
-" Setup table-mode to markdown compliant
-" Note: to start use "\ t m"
-let g:table_mode_corner='|'
-
" Spell checking
map <F10> :setlocal spell!<cr>
function LangToggle()
@@ -138,6 +137,8 @@ let g:UltiSnipsJumpBackwardTrigger='<c-k>'
nnoremap <c-c><c-c> :Telescope buffers<cr>
nnoremap <c-p> :lua require('mytelescopefiles')()<cr>
nnoremap <c-s-p> :Telescope lsp_document_symbols<cr>
+nnoremap <c-s-g> :Telescope live_grep<cr>
+nnoremap <c-s-8> :Telescope grep_string<cr>
nmap <leader>] :Telescope lsp_definitions<cr>
nmap <leader><leader>] :Telescope lsp_type_definitions<cr>
nmap <leader>[ :Telescope lsp_implementations<cr>
diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua
index f323106..d1a4c55 100644
--- a/config/nvim/lua/plugins.lua
+++ b/config/nvim/lua/plugins.lua
@@ -4,47 +4,12 @@ if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
vim.cmd([[packadd packer.nvim]])
end
-local treesitter_formaters = {
- "c",
- "lua",
- "kconfig",
- "make",
- "markdown",
- "markdown_inline",
- "meson",
- "ninja",
- "ini",
- "gitcommit",
- "git_rebase",
- "git_config",
- "nix",
- "python",
- "toml",
- "vim",
- "vimdoc",
- "yaml",
- "xml",
-}
-
require("packer").startup(function(use)
use("wbthomason/packer.nvim")
-- Visual ------------------------------------------------------------------
use("shaunsingh/nord.nvim")
use("MunifTanjim/nui.nvim")
use({
- "nvim-treesitter/nvim-treesitter",
- run = ":TSUpdate",
- config = function()
- require("nvim-treesitter.configs").setup({
- ensure_installed = treesitter_formaters,
- highlight = {
- enable = true,
- additional_vim_regex_highlighting = false,
- },
- })
- end,
- })
- use({
"lukas-reineke/indent-blankline.nvim",
config = function()
local highlight = { "CursorColumn", "Whitespace" }
@@ -162,9 +127,9 @@ require("packer").startup(function(use)
-- Additional integrations -------------------------------------------------
use({
"chomosuke/typst-preview.nvim",
- tag = "v0.1.*",
- run = function()
- require("typst-preview").update()
+ tag = "v1.*",
+ config = function()
+ require("typst-preview").setup({})
end,
})
-- Movement, format and others ---------------------------------------------
@@ -178,10 +143,10 @@ require("packer").startup(function(use)
use("aliou/bats.vim")
-- LSP ---------------------------------------------------------------------
- local lspconfig = require("lspconfig")
- lspconfig.bashls.setup({})
- lspconfig.clangd.setup({})
- lspconfig.nil_ls.setup({})
- lspconfig.pylsp.setup({})
- lspconfig.tinymist.setup({})
+ vim.lsp.enable("bashls")
+ vim.lsp.enable("clangd")
+ vim.lsp.enable("nil_ls")
+ vim.lsp.enable("pylsp")
+ vim.lsp.enable("tinymist")
+ vim.lsp.enable("guile_ls")
end)
diff --git a/config/sway/bindsym-launch b/config/sway/bindsym-launch
index b568a2d..8572004 100644
--- a/config/sway/bindsym-launch
+++ b/config/sway/bindsym-launch
@@ -19,7 +19,7 @@ bindsym $mod+Shift+w exec --no-startup-id ~/.config/sway/scripts/pass
bindsym $mod+Shift+n exec --no-startup-id ~/.config/sway/scripts/notes
for_window [ title="notes-terminal-window" ] floating enable sticky enable
# Mail client
-bindsym $mod+m exec astroid
+bindsym $mod+m exec dodo
# Run and configure synchronization
diff --git a/config/sway/bindsym-media b/config/sway/bindsym-media
index 13026fc..b1159ef 100644
--- a/config/sway/bindsym-media
+++ b/config/sway/bindsym-media
@@ -12,8 +12,8 @@ for_window [ title="Pulsemixer" ] move position center
# Screen brightness controls
-bindsym XF86MonBrightnessUp exec --no-startup-id light -A 10
-bindsym XF86MonBrightnessDown exec --no-startup-id light -U 10
+bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl set +10%
+bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl set 10%-
# Media player controls
bindsym XF86AudioPlay exec --no-startup-id mpc toggle && pkill -RTMIN+12 i3blocks
diff --git a/config/sway/bindsym-system b/config/sway/bindsym-system
index 7afcb4c..79094be 100644
--- a/config/sway/bindsym-system
+++ b/config/sway/bindsym-system
@@ -13,10 +13,12 @@ mode "$mode_system" {
bindsym $mod+Shift+q mode "$mode_system"
-set $screenshot Screenshot: (s)elect or (d)desktop
+set $screenshot Screenshot: (s)elect or (w)indow or (o)tput or (d)desktop
mode "$screenshot" {
- bindsym --release d exec --no-startup-id grim, mode "default"
- bindsym --release s exec --no-startup-id sh -c "slurp | grim -g -", mode "default"
+ bindsym --locked s exec --no-startup-id ~/.config/sway/scripts/screenshot select, mode "default"
+ bindsym --locked w exec --no-startup-id ~/.config/sway/scripts/screenshot window, mode "default"
+ bindsym --locked o exec --no-startup-id ~/.config/sway/scripts/screenshot output, mode "default"
+ bindsym --locked d exec --no-startup-id ~/.config/sway/scripts/screenshot desktop, mode "default"
bindsym Return mode "default"
bindsym Escape mode "default"
diff --git a/config/sway/daemons b/config/sway/daemons
index 786fa70..a6579da 100644
--- a/config/sway/daemons
+++ b/config/sway/daemons
@@ -2,8 +2,10 @@
exec --no-startup-id {
kanshi
swayidle
+ waybar
dunst
}
for_window [class="Ferdi"] move scratchpad
exec ferdium
+exec sh -c 'if commad -v openrgb >/dev/null; then exec openrgb --startminimized; fi'
diff --git a/config/sway/scripts/pass b/config/sway/scripts/pass
index 06383b3..11700e6 100755
--- a/config/sway/scripts/pass
+++ b/config/sway/scripts/pass
@@ -1,6 +1,6 @@
#!/bin/sh
-find ~/.password-store -name .git -prune -o -type f -printf '%P\n' | \
- sed 's/\.gpg$//' | wofi -d -p 'Pass:' | \
+find ~/.password-store -name .git -prune -o -type f -printf '%P\n' |
+ sed 's/\.gpg$//' | wofi -d -p 'Pass:' |
while read -r psw; do
pass -c "$psw"
-done
+ done
diff --git a/config/sway/scripts/screenshot b/config/sway/scripts/screenshot
new file mode 100755
index 0000000..45086f1
--- /dev/null
+++ b/config/sway/scripts/screenshot
@@ -0,0 +1,19 @@
+#!/bin/sh
+case "${1:-}" in
+desktop)
+ exec grim
+ ;;
+output)
+ exec grim -o "$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name')"
+ ;;
+window)
+ exec grim -g "$(swaymsg -t get_tree |
+ jq -j '.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"')"
+ # TODO the second variant is newer but doesn't work with my version of sway
+ exec grim -T "$(swaymsg -t get_tree |
+ jq -j '.. | select(.type?) | select(.focused).foreign_toplevel_identifier')"
+ ;;
+select)
+ exec grim -g "$(slurp)"
+ ;;
+esac
diff --git a/config/systemd/user/davmail.service b/config/systemd/user/davmail.service
new file mode 100644
index 0000000..b0f239b
--- /dev/null
+++ b/config/systemd/user/davmail.service
@@ -0,0 +1,5 @@
+[Unit]
+Description=DavMail
+
+[Service]
+ExecStart="/run/current-system/sw/bin/davmail"
diff --git a/config/systemd/user/waybar.service b/config/systemd/user/waybar.service
deleted file mode 100644
index 110ab83..0000000
--- a/config/systemd/user/waybar.service
+++ /dev/null
@@ -1,8 +0,0 @@
-[Unit]
-Description=Waybar
-
-[Service]
-ExecStart="/run/current-system/sw/bin/waybar"
-
-[Install]
-WantedBy="graphical-session.target"
diff --git a/config/waybar/email.sh b/config/waybar/email.sh
index 437566f..16b0d9f 100755
--- a/config/waybar/email.sh
+++ b/config/waybar/email.sh
@@ -10,7 +10,7 @@ fi
part=()
for mail in email gmail elektroline fel; do
counts="$(notmuch count -- "${filter[@]}" and "tag:$mail")"
- [ "$counts" = "0" ] || \
+ [ "$counts" = "0" ] ||
part+=("$mail:$counts")
done
diff --git a/gitconfig b/gitconfig
index 1aa8898..23f3f27 100644
--- a/gitconfig
+++ b/gitconfig
@@ -45,6 +45,7 @@
dump = cat-file -p
please = push --force-with-lease
supdate = submodule update --init --recursive
+ ffetch = fetch --all --prune
fclean = "!git clean -xdff && git submodule foreach git clean -xdff && :"
cleanup = "!git branch --merged HEAD --format=\"%(refname:lstrip=2)\" | grep -vx master | xargs git branch -d"
[sendemail]
diff --git a/guile b/guile
new file mode 100644
index 0000000..5646cf9
--- /dev/null
+++ b/guile
@@ -0,0 +1,4 @@
+(use-modules (ice-9 readline) (ice-9 colorized))
+
+(activate-readline)
+(activate-colorized)
diff --git a/infokey b/infokey
new file mode 100644
index 0000000..a3405e5
--- /dev/null
+++ b/infokey
@@ -0,0 +1,4 @@
+#var
+link-style=blue,bold,underline
+active-link-style=yellow,bold
+match-style=underline,bold,nocolor
diff --git a/install b/install
index d0b26b3..abe157b 100755
--- a/install
+++ b/install
@@ -8,7 +8,9 @@ git submodule update --init --recursive || (
)
# Source inst and diff function
+. ./utils/ask
. ./utils/inst
+. ./utils/guix
# Load if we force changes (implies no interaction)
[ "$1" = "-f" ] && FORCE=true || FORCE=false
@@ -37,7 +39,15 @@ if ask "nix" "Install Nix configuration"; then
inst private/config/nix/builders ~/.config/nix/builders
fi
-if ask "clituls" "Install configurations for various CLI utility tools"; then
+if hascmd guix && ask "guix" "Install Guix configuration"; then
+ inst guile ~/.guile
+ inst config/guix/channels.scm ~/.config/guix/channels.scm
+ guix_install \
+ guile guile-colorized guile-readline guile-lsp-server
+fi
+
+if ask "cliutils" "Install configurations for various CLI utility tools"; then
+ inst infokey ~/.infokey
inst screenrc ~/.screenrc
inst local/share/mc/skins/nord16M.ini ~/.local/share/mc/skins/nord16M.ini
fi
@@ -60,9 +70,9 @@ if ask "nvim" "Install NeoVIM scripts"; then
nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'
# cs spelling
mkdir -p ~/.local/share/nvim/site/spell
- curl "https://ftp.nluug.nl/pub/vim/runtime/spell/cs.utf-8.spl" \
+ curl -L "https://ftp.nluug.nl/pub/vim/runtime/spell/cs.utf-8.spl" \
>~/.local/share/nvim/site/spell/cs.utf-8.spl
- curl "https://ftp.nluug.nl/pub/vim/runtime/spell/cs.utf-8.sug" \
+ curl -L "https://ftp.nluug.nl/pub/vim/runtime/spell/cs.utf-8.sug" \
>~/.local/share/nvim/site/spell/cs.utf-8.sug
fi
@@ -74,7 +84,6 @@ if ask "dev" "Development tools configuration"; then
inst pylintrc ~/.pylintrc
inst config/mypy/ ~/.config/mypy
inst local/bin/new-flake-dev ~/.local/bin/new-flake-dev
- inst shvcli.ini ~/.shvcli.ini
curl "https://github.com/cyrus-and/gdb-dashboard/raw/master/.gdbinit" >~/.gdbinit
fi
@@ -83,21 +92,24 @@ if ask "sync" "Install synchronization"; then
if [ "$(ps -o comm= 1)" = "systemd" ]; then
inst config/systemd/user/allsync.service ~/.config/systemd/user/
inst config/systemd/user/allsync.timer ~/.config/systemd/user/
+ inst config/systemd/user/davmail.service ~/.config/systemd/user/
fi
inst private/mbsyncrc ~/.mbsyncrc
+ inst private/msmtprc ~/.msmtprc
+ inst private/davmail.properties ~/.davmail.properties
inst private/notmuch-config ~/.notmuch-config
inst private/notmuch-tag-new ~/.notmuch-tag-new
inst local/bin/email-unread ~/.local/bin/email-unread
inst local/sbin/newmail-notify ~/.local/sbin/newmail-notify
- inst private/msmtprc ~/.msmtprc
inst config/dodo/config.py ~/.config/dodo/config.py
- inst private/astroid/config ~/.config/astroid/config
inst private/vdirsyncer/ ~/.vdirsyncer
inst config/khal/config ~/.config/khal/config
inst config/khard/khard.conf ~/.config/khard/khard.conf
+ inst local/bin/cloud ~/.local/bin/cloud
+
inst_sync
fi
@@ -124,7 +136,6 @@ if ask "desktop" "Install desktop"; then
inst config/swaylock/ ~/.config/swaylock
inst config/swayidle/ ~/.config/swayidle
inst config/wofi/ ~/.config/wofi
- inst config/systemd/user/waybar.service ~/.config/systemd/user/waybar.service
[ -f "private/kanshi/$(hostname)" ] &&
inst "private/kanshi/$(hostname)" ~/.config/kanshi/config
inst config/xdg-desktop-portal-wlr/ ~/.config/xdg-desktop-portal-wlr
@@ -143,6 +154,7 @@ if ask "elektroline" "Install Elektroline scripts"; then
inst shvcli.toml ~/.shvcli.toml
inst local/bin/elektroline-git-config ~/.local/bin/elektroline-git-config
inst local/bin/elektroline-windows ~/.local/bin/elektroline-windows
+ inst local/share/applications/elektroline-windows.desktop ~/.local/share/applications/elektroline-windows.desktop
inst local/bin/elektroline00 ~/.local/bin/elektroline00
fi
diff --git a/local/bin/allsync b/local/bin/allsync
index 6e537e2..70c9d29 100755
--- a/local/bin/allsync
+++ b/local/bin/allsync
@@ -8,21 +8,22 @@ notify_bar() {
i3_astroid() {
pkill -0 astroid || return 0
- find "/run/user/$(id -u)/i3" "/tmp/i3-$(id -un)".* -name ipc-socket\* 2>/dev/null | \
+ find "/run/user/$(id -u)/i3" "/tmp/i3-$(id -un)".* -name ipc-socket\* 2>/dev/null |
while read -r socket; do
i3-msg -s "$socket" "exec astroid $*"
- done
+ done
}
cron_enable() {
pass mail/cynerd@email.cz >/dev/null # Cache keys
if command -v crontab >/dev/null; then
{
- crontab -l
+ crontab -l
echo "$cronline"
} | crontab -
else
systemctl --user start allsync.timer
+ systemctl --user start davmail.service
fi
notify_bar
}
@@ -46,33 +47,33 @@ cron_enabled() {
if [ "$#" -gt 0 ]; then
case "$1" in
- enable)
- cron_enable
- ;;
- disable)
+ enable)
+ cron_enable
+ ;;
+ disable)
+ cron_disable
+ ;;
+ enabled)
+ cron_enabled
+ ;;
+ state)
+ if cron_enabled; then
+ echo "Enabled"
+ else
+ echo "Disabled"
+ fi
+ ;;
+ toggle)
+ if cron_enabled; then
cron_disable
- ;;
- enabled)
- cron_enabled
- ;;
- state)
- if cron_enabled; then
- echo "Enabled"
- else
- echo "Disabled"
- fi
- ;;
- toggle)
- if cron_enabled; then
- cron_disable
- else
- cron_enable
- fi
- ;;
- *)
- echo "${0##*/}: Unknown argument: $1" >&2
- exit 1
- ;;
+ else
+ cron_enable
+ fi
+ ;;
+ *)
+ echo "${0##*/}: Unknown argument: $1" >&2
+ exit 1
+ ;;
esac
exit
fi
@@ -97,7 +98,6 @@ if [ "${ALLSYNC_FLOCK:-n}" != "y" ]; then
exit 1
fi
-
sec() {
echo -e '\e[1;34m==========' "$@" '==========\e[0m'
}
@@ -108,18 +108,15 @@ fail() {
ecode=1
}
-
sec "Passwords"
pass git pull || fail "Passwords pull failed"
pass git push || fail "Passwords push failed"
sec "Mail"
-i3_astroid --start-polling
mbsync -a || fail "Mail synchronization reported failure"
notmuch new
~/.local/sbin/newmail-notify || fail "Mail notifications not sent"
notmuch tag --batch --input="$HOME/.notmuch-tag-new"
-i3_astroid --stop-polling
notify_bar
#sec "Calendar and contacts"
diff --git a/local/bin/cloud b/local/bin/cloud
new file mode 100755
index 0000000..187db18
--- /dev/null
+++ b/local/bin/cloud
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+path="/media/cloud"
+
+usage() {
+ echo "Usage: $0 [OPTION].." >&2
+}
+
+umount="n"
+while getopts "u" opt; do
+ case "$opt" in
+ u)
+ umount="y"
+ ;;
+ *)
+ usage
+ exit 2
+ ;;
+ esac
+done
+
+if [ "$umount" = "n" ]; then
+ url="https://cloud.cynerd.cz/remote.php/dav/files/cynerd"
+ conf="$(mktemp)"
+ secrets="$(mktemp)"
+ trap 'rm -f "$conf" "$secrets"' EXIT HUP INT QUIT SEGV PIPE TERM
+ cat >"$conf" <<-EOF
+ [$path]
+ secrets ${secrets}
+ use_locks 0
+ EOF
+ chmod 600 "$secrets"
+ echo "$url cynerd $(pass cynerd.cz/nextcloud/davfs)" >"$secrets"
+ sudo chown root "$secrets"
+ sudo mkdir -p "$path"
+ sudo mount.davfs -o "conf=${conf}" -o uid=1000 "$url" "$path"
+ sudo rm -f "$secrets"
+else
+ sudo umount "$path"
+fi
diff --git a/local/bin/elektroline-windows b/local/bin/elektroline-windows
index 5a13732..26e6228 100755
--- a/local/bin/elektroline-windows
+++ b/local/bin/elektroline-windows
@@ -9,8 +9,8 @@ fi
exec xfreerdp \
"${args[@]}" \
- -decorations /w:1700 /h:1000 \
+ -decorations /dynamic-resolution \
/d:ELEKTROLINE /u:kkoci \
/bpp:24 /audio-mode:0 /sound:sys:alsa /network:lan /rfx \
+clipboard /port:3389 \
- /v:elvirt00.elektroline.cz /p:"$(pass elektroline.cz/kkoci)"
+ /v:czellts.elektroline.cz /p:"$(pass elektroline.cz/kkoci)"
diff --git a/local/bin/elektroline00 b/local/bin/elektroline00
index 0d6520b..99664d2 100755
--- a/local/bin/elektroline00
+++ b/local/bin/elektroline00
@@ -19,10 +19,18 @@ while getopts "u" opt; do
done
if [ "$umount" = "n" ]; then
+ mount_cifs() {
+ sudo mkdir -p "$path/$2"
+ sudo --preserve-env=PASSWD mount.cifs -o username=kkoci,uid=1000 "$1" "$path/$2"
+ echo "Mounted $path/$2"
+ }
+
sudo mkdir -p "$path"
- sudo mount.cifs -o username=kkoci,uid=1000 "//czelldata.elektroline.cz/Share" "$path"
- #sudo mount.cifs -o username=kkoci "//Elektroline00/company" "$path/company"
- #sudo mount.cifs -o username=kkoci "//Elektroline00/elektro_doc" "$path/elektro_doc"
+ export PASSWD
+ PASSWD="$(pass elektroline.cz/kkoci)"
+ mount_cifs "//czelldata.elektroline.cz/Share" "share"
+ mount_cifs "//10.0.0.3/company" "company"
+ mount_cifs "//10.0.0.3/elektro_doc" "elektro_doc"
else
- sudo umount "$path"
+ sudo umount "$path"/{share,company,elektro_doc}
fi
diff --git a/local/bin/new-flake-dev b/local/bin/new-flake-dev
index 2c4a280..c28f2fd 100755
--- a/local/bin/new-flake-dev
+++ b/local/bin/new-flake-dev
@@ -6,24 +6,37 @@ if [ -f ./flake.nix ]; then
fi
cat >./flake.nix <<"EOF"
{
- outputs = { self, nixpkgs, flake-utils, personal }:
- with flake-utils.lib;
- eachDefaultSystem (system: let
- pkgs = nixpkgs.legacyPackages.${system};
+ outputs = {
+ self,
+ systems,
+ nixpkgs,
+ }: let
+ inherit (nixpkgs.lib) genAttrs composeManyExtensions;
+ forSystems = genAttrs (import systems);
+ withPkgs = func: forSystems (system: func self.legacyPackages.${system});
in {
- devShells = filterPackages system {
- default = pkgs.mkShell {
- packages = with pkgs; [
- clang-tools
- gcc gdb pkg-config
- cppcheck flawfinder bear
- meson
- ];
- inputsFrom = with pkgs; [
- personal.devShells.${system}.default
- ];
- };
+ overlays = {
+ packages = final: prev: {};
+ default = composeManyExtensions [self.overlays.packages];
};
- });
+
+ devShells = withPkgs (pkgs: {
+ default = with pkgs;
+ mkShell {
+ packages = [
+ # TODO development packages
+ ];
+ inputsFrom = [
+ # TODO other packages development is done for
+ ];
+ };
+ });
+
+ formatter = withPkgs (pkgs: pkgs.alejandra);
+
+ legacyPackages =
+ forSystems (system:
+ nixpkgs.legacyPackages.${system}.extend self.overlays.default);
+ };
}
EOF
diff --git a/local/bin/project-test b/local/bin/project-test
index e8c6261..feab447 100755
--- a/local/bin/project-test
+++ b/local/bin/project-test
@@ -15,21 +15,21 @@ print_help() {
while [ -n "$1" ]; do
case $1 in
- -r|--ref)
- shift
- REF=$1
- ;;
- -c|--count)
- shift
- REF=HEAD~$1
- ;;
- --)
- shift
- break
- ;;
- *)
- break
- ;;
+ -r | --ref)
+ shift
+ REF=$1
+ ;;
+ -c | --count)
+ shift
+ REF=HEAD~$1
+ ;;
+ --)
+ shift
+ break
+ ;;
+ *)
+ break
+ ;;
esac
shift
done
diff --git a/local/bin/startsway b/local/bin/startsway
index 3982c19..262a997 100755
--- a/local/bin/startsway
+++ b/local/bin/startsway
@@ -14,9 +14,10 @@ export MOZ_ENABLE_WAYLAND=1
# Java application do not display properly
export _JAVA_AWT_WM_NONREPARENTING=1
-dbus="dbus-run-session"
if [ "$(ps -o comm= 1)" = "systemd" ]; then
- dbus=""
+ launch="systemd-cat --identifier=sway --stderr-priority=err"
+else
+ launch="dbus-run-session"
fi
-exec $dbus sway
+exec $launch sway
diff --git a/local/sbin/wayvnc1 b/local/sbin/wayvnc1
index b21479d..64edd39 100755
--- a/local/sbin/wayvnc1
+++ b/local/sbin/wayvnc1
@@ -1,3 +1,5 @@
#!/usr/bin/env bash
export WAYLAND_DISPLAY=wayland-1
+export SWAYSOCK="/run/user/${UID=$(id -u)}/sway-ipc.$UID.$(pgrep -x sway).sock"
+swaymsg output '*' power on
exec wayvnc localhost 5901
diff --git a/local/share/applications/elektroline-windows.desktop b/local/share/applications/elektroline-windows.desktop
new file mode 100755
index 0000000..9b488a9
--- /dev/null
+++ b/local/share/applications/elektroline-windows.desktop
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Version=1.0
+Name=Elektroline Windows
+Exec="/home/cynerd/.local/bin/elektroline-windows" %U
+Terminal=false
+Type=Application
diff --git a/private b/private
-Subproject 12dce134d62a4651e93a5b68099c3b4e4c5a856
+Subproject 10d7c501c5a3c08670ba74098bfd81db3baf600
diff --git a/profile b/profile
index f0a9fd5..dd95c0a 100644
--- a/profile
+++ b/profile
@@ -19,6 +19,12 @@ for profile in "$HOME"/.nix-profile/etc/profile.d/*; do
source "$profile"
done
+# Guix
+export GUIX_PROFILE="/home/cynerd/.guix-profile"
+if [[ -d "$GUIX_PROFILE" ]]; then
+ source "$GUIX_PROFILE/etc/profile"
+fi
+
# Rest of the profile run only if login is from linux console
[[ "$(tty)" != /dev/tty* ]] && return
diff --git a/shvcli.ini b/shvcli.ini
deleted file mode 100644
index 66caf52..0000000
--- a/shvcli.ini
+++ /dev/null
@@ -1,7 +0,0 @@
-[hosts]
-localhost = tcp://admin@localhost?password=admin!123
-test = tcp://test@localhost?password=test
-brcg2 = tcp://cli@localhost
-
-[hosts-shell]
-nirvana = tcp://kkoci@nirvana.elektroline.cz:3756?password=$(pass elektroline.cz/nirvana/kkoci)
diff --git a/shvcli.toml b/shvcli.toml
index 5a3e9e8..0c262b4 100644
--- a/shvcli.toml
+++ b/shvcli.toml
@@ -2,7 +2,9 @@
localhost = "tcp://admin@localhost?password=admin!123"
test = "tcp://test@localhost?password=test"
brcg2 = "tcp://cli@localhost"
+nirvanaa = "tcp://kkoci@nirvana.elektroline.cz:3755?oauth2=y"
[hosts-shell]
-nirvana = "tcp://kkoci@nirvana.elektroline.cz:3756?password=$(pass elektroline.cz/nirvana/kkoci)"
+nirvana = "tcp://kkoci@nirvana.elektroline.cz:3755?password=$(pass elektroline.cz/nirvana/kkoci)"
+nirvana-old = "tcp://kkoci@nirvana.elektroline.cz:3756?password=$(pass elektroline.cz/nirvana/kkoci)"
ats = "tcp://atsshv@czellats.elektroline.cz?password=$(pass elektroline.cz/czellats/atsshv)"
diff --git a/utils/ask b/utils/ask
new file mode 100644
index 0000000..4b47c7e
--- /dev/null
+++ b/utils/ask
@@ -0,0 +1,24 @@
+# vim: ft=sh
+
+# Ask if given section should be installed
+# First argument is name (take care not to use special characters for regulard
+# expression) and second argument is a question
+ask() {
+ local ignore_file
+ ignore_file=".ignore-$(hostname)"
+ [ -f "$ignore_file" ] && grep -q "^$1$" "$ignore_file" && return 1
+ if $FORCE; then
+ echo "\e[1;34m$2\e[0m"
+ # Fall trough with 0 exit (always yes)
+ else
+ echo -e -n "\e[1;34m$2? (Y/n) \e[0m"
+ local reply
+ read -r reply
+ echo "$reply" | grep -qE '^[Yy]?$'
+ fi
+}
+
+# Check if command is available
+hascmd() {
+ command -v "$1" >/dev/null 2>&1
+}
diff --git a/utils/guix b/utils/guix
new file mode 100644
index 0000000..bbfb8e5
--- /dev/null
+++ b/utils/guix
@@ -0,0 +1,16 @@
+# Functions used for interactive installation of new changes to running system
+# vim: ft=sh
+
+guix_install() {
+ local installed
+ installed="$(guix package --list-installed)"
+ local -a toinstall
+ for pkg in "$@"; do
+ if awk -v ec=0 -v "PKG=$pkg" '$1 == PKG { ec = 1; } END { exit ec; }' <<<"$installed"; then
+ toinstall+=("$pkg")
+ fi
+ done
+ if [[ "${#toinstall[@]}" -gt 0 ]]; then
+ guix install "${toinstall[@]}"
+ fi
+}
diff --git a/utils/inst b/utils/inst
index a32c36b..eb25ceb 100644
--- a/utils/inst
+++ b/utils/inst
@@ -1,45 +1,29 @@
# Functions used for interactive installation of new changes to running system
# vim: ft=sh
-# Ask if given section should be installed
-# First argument is name (take care not to use special characters for regulard
-# expression) and second argument is a question
-ask() {
- local ignore_file=".ignore-$(hostname)"
- [ -f "$ignore_file" ] && grep -q "^$1$" "$ignore_file" && return 1
- if $FORCE; then
- echo "\e[1;34m$2\e[0m"
- # Fall trough with 0 exit (always yes)
- else
- echo -e -n "\e[1;34m$2? (Y/n) \e[0m"
- local reply
- read -r reply
- echo "$reply" | grep -qE '^[Yy]?$'
- fi
-}
-
dodiff() {
+ local out
if [ -d "$2" ]; then
# If we just copying some file to directory
- OUT=$2/$(basename "$1")
+ out="$2/$(basename "$1")"
else
- OUT=$2
+ out="$2"
fi
- if ! [ -f "$OUT" ]; then
- echo -e "\e[1;33mNot installed:\e[0m $1 => $OUT"
+ if ! [ -f "$out" ]; then
+ echo -e "\e[1;33mNot installed:\e[0m $1 => $out"
if ask "Install?"; then
- doinst "$1" "$OUT"
+ doinst "$1" "$out"
fi
return
fi
- if cmp "$1" "$OUT" >/dev/null 2>&1; then
- echo -e "\e[1;32mNo difference detected:\e[0m $OUT"
+ if cmp "$1" "$out" >/dev/null 2>&1; then
+ echo -e "\e[1;32mNo difference detected:\e[0m $out"
return
fi
if $FORCE; then
- doinst "$1" "$OUT"
+ doinst "$1" "$out"
else
- nvim -d "$1" "$OUT"
+ nvim -d "$1" "$out"
fi
}
@@ -48,11 +32,12 @@ dodiff() {
# commands not on deployed tree but on tree in this repository, so we need specify
# work tree on command line every time we want target deployed work tree.
gitrepo_relink() {
- local GITD="gitdir: $PWD/.git$(sed "s/^gitdir: [./]*git//" "$1")"
+ local gitdir
+ gitdir="gitdir: $PWD/.git$(sed "s/^gitdir: [./]*git//" "$1")"
# We check that we are pointing to correct path just because of making message correct
- if ! grep -q "$GITD" "$2"; then
+ if ! grep -q "$gitdir" "$2"; then
echo -e "\e[1;34mPointing git repository $2 to this repository\e[0m"
- echo "$GITD" > "$2"
+ echo "$gitdir" >"$2"
fi
# else probably not a git repository or who knows.
}
@@ -69,12 +54,12 @@ checkdiff() {
exit 1
fi
# Got trough all files ignoring git repositories
- for f in `find "$1" \( -type d -exec test -e '{}'/.git \; \) -prune -o -type f -print`; do
+ for f in $(find "$1" \( -type d -exec test -e '{}'/.git \; \) -prune -o -type f -print); do
F="${f#$1}"
dodiff "$1/$F" "$2/$F"
done
# Check if we have all directories ignoring those in git repositories
- for d in `find "$1" -type d -print -exec test -e '{}'/.git \; -prune`; do
+ for d in $(find "$1" -type d -print -exec test -e '{}'/.git \; -prune); do
D="${d#$1}"
if [ ! -d "$2/$D" ]; then
echo -e "\e[1;33mDirectory not installed:\e[0m $1/$D => $2/$D"
@@ -84,7 +69,7 @@ checkdiff() {
fi
done
# Now checkout git repositories
- for g in `find "$1" -type d -exec test -e '{}'/.git \; -print -prune`; do
+ for g in $(find "$1" -type d -exec test -e '{}'/.git \; -print -prune); do
G="$2/${g#$1}"
gitrepo_relink "$g/.git" "$G/.git" # Always reling .git just to be sure
PREV="$(pwd)"
@@ -111,13 +96,13 @@ doinst() {
mkdir -p "$(dirname "$2")"
rsync -rlpt $1 $2
# Now edit all .git files in target directory
- for g in `find "$1" -name '.git' -type f`; do
+ for g in $(find "$1" -name '.git' -type f); do
gitrepo_relink "$g" "$2/${g#$1}"
done
}
inst() {
- if [ ! -e "$1" ]; then
+ if [ ! -e "$1" ]; then
echo "Missing file to be installed: $1" >&2
fi
if [ -e "$2" ]; then