mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-10 04:49:19 -08:00
Refactor, mumble domain change, sway changes
This commit is contained in:
parent
22cf8ab600
commit
1de1018c02
113 changed files with 53 additions and 46 deletions
12
profiles/kat/home.nix
Normal file
12
profiles/kat/home.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{ lib, ... }:
|
||||
|
||||
{
|
||||
imports = [ ./home ];
|
||||
|
||||
#home-manager.useGlobalPkgs = true;
|
||||
#home-manager.users.kat = {
|
||||
# imports = [ ../../../modules/home ];
|
||||
#};
|
||||
|
||||
options = { deploy.profile.kat = lib.mkEnableOption "uhh meow"; };
|
||||
}
|
||||
14
profiles/kat/home/base16.nix
Normal file
14
profiles/kat/home/base16.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
config = lib.mkIf config.deploy.profile.kat {
|
||||
base16 = {
|
||||
shell.enable = true;
|
||||
schemes = [ "rebecca.rebecca" ];
|
||||
};
|
||||
# home.base16-shell = {
|
||||
# enable = true;
|
||||
# defaultTheme = "rebecca.rebecca";
|
||||
# };
|
||||
};
|
||||
}
|
||||
16
profiles/kat/home/default.nix
Normal file
16
profiles/kat/home/default.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./zsh
|
||||
./vim
|
||||
./git.nix
|
||||
./kitty.nix
|
||||
./tmux.nix
|
||||
./secrets.nix
|
||||
#./base16.nix
|
||||
./xdg.nix
|
||||
./ssh.nix
|
||||
./packages.nix
|
||||
];
|
||||
}
|
||||
32
profiles/kat/home/git.nix
Normal file
32
profiles/kat/home/git.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
config = lib.mkIf config.deploy.profile.kat {
|
||||
home.packages = with pkgs; [
|
||||
git-crypt
|
||||
gitAndTools.gitRemoteGcrypt
|
||||
unstable.gitAndTools.gitAnnex
|
||||
git-revise
|
||||
arc.pkgs.gitAndTools.git-annex-remote-b2
|
||||
];
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
package = pkgs.gitAndTools.gitFull;
|
||||
userName = "kat witch";
|
||||
userEmail = "kat@kittywit.ch";
|
||||
extraConfig = {
|
||||
protocol.gcrypt.allow = "always";
|
||||
annex = {
|
||||
autocommit = false;
|
||||
backend = "BLAKE2B512";
|
||||
synccontent = true;
|
||||
};
|
||||
};
|
||||
signing = {
|
||||
key = "01F50A29D4AA91175A11BDB17248991EFA8EFBEE";
|
||||
signByDefault = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
6
profiles/kat/home/kitty.nix
Normal file
6
profiles/kat/home/kitty.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
home.sessionVariables.TERMINFO_DIRS =
|
||||
"${pkgs.kitty.terminfo.outPath}/share/terminfo";
|
||||
}
|
||||
7
profiles/kat/home/packages.nix
Normal file
7
profiles/kat/home/packages.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
config = lib.mkIf config.deploy.profile.kat {
|
||||
home.packages = with pkgs; [ kitty.terminfo ];
|
||||
};
|
||||
}
|
||||
27
profiles/kat/home/ssh.nix
Normal file
27
profiles/kat/home/ssh.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
config = lib.mkIf config.deploy.profile.kat {
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
controlMaster = "auto";
|
||||
controlPersist = "10m";
|
||||
hashKnownHosts = true;
|
||||
matchBlocks = let
|
||||
common = {
|
||||
forwardAgent = true;
|
||||
extraOptions = {
|
||||
RemoteForward =
|
||||
"/run/user/1000/gnupg/S.gpg-agent /run/user/1000/gnupg/S.gpg-agent.extra";
|
||||
};
|
||||
port = 62954;
|
||||
};
|
||||
in {
|
||||
"athame" = { hostname = "athame.kittywit.ch"; } // common;
|
||||
"samhain" = { hostname = "192.168.1.135"; } // common;
|
||||
"yule" = { hostname = "192.168.1.92"; } // common;
|
||||
"boline" = { hostname = "boline.kittywit.ch"; } // common;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
57
profiles/kat/home/tmux.nix
Normal file
57
profiles/kat/home/tmux.nix
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
config = lib.mkIf config.deploy.profile.kat {
|
||||
programs.zsh.shellAliases = {
|
||||
tne = "tmux new -s";
|
||||
tat = "tmux attach -t";
|
||||
tren = "tmux new -AD -s";
|
||||
};
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
# start from 1
|
||||
set -g base-index 1
|
||||
setw -g pane-base-index 1
|
||||
|
||||
# proper title handling
|
||||
set -g set-titles on
|
||||
set -g set-titles-string "#T"
|
||||
|
||||
# 256 color
|
||||
set -g default-terminal "screen-256color"
|
||||
|
||||
# modes
|
||||
setw -g clock-mode-colour colour5
|
||||
setw -g mode-style 'fg=colour1 bg=colour18 bold'
|
||||
|
||||
# panes
|
||||
set -g pane-border-style 'fg=colour19 bg=colour0'
|
||||
set -g pane-active-border-style 'bg=colour0 fg=colour9'
|
||||
|
||||
# statusbar
|
||||
set -g status-position bottom
|
||||
set -g status-justify left
|
||||
set -g status-style 'bg=colour18 fg=colour137 dim'
|
||||
set -g status-left '''
|
||||
set -g status-right '#[fg=colour233,bg=colour19] %F #[fg=colour233,bg=colour8] %H:%M:%S %Z'
|
||||
set -g status-right-length 50
|
||||
set -g status-left-length 20
|
||||
|
||||
setw -g window-status-current-style 'fg=colour1 bg=colour19 bold'
|
||||
setw -g window-status-current-format ' #I#[fg=colour249]:#[fg=colour255]#W#[fg=colour249]#F '
|
||||
|
||||
setw -g window-status-style 'fg=colour9 bg=colour18'
|
||||
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
|
||||
|
||||
setw -g window-status-bell-style 'fg=colour255 bg=colour1 bold'
|
||||
|
||||
# messages
|
||||
set -g message-style 'fg=colour232 bg=colour16 bold'
|
||||
|
||||
# mouse
|
||||
set -g mouse on
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
7
profiles/kat/home/vim/coc-settings.json
Normal file
7
profiles/kat/home/vim/coc-settings.json
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"python.formatting.provider": "black",
|
||||
"python.jediEnabled": true,
|
||||
"python.linting.flake8Enabled": true,
|
||||
"python.linting.enabled": true,
|
||||
"python.pythonPath": "nvim-python3"
|
||||
}
|
||||
39
profiles/kat/home/vim/default.nix
Normal file
39
profiles/kat/home/vim/default.nix
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
{ config, lib, pkgs, witch, ... }:
|
||||
|
||||
{
|
||||
config = lib.mkIf config.deploy.profile.kat {
|
||||
home.sessionVariables.EDITOR = "vim";
|
||||
programs.vim = {
|
||||
enable = true;
|
||||
package = pkgs.arc.pkgs.vim_configurable-pynvim;
|
||||
#withPython3 = true;
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
nerdtree
|
||||
vim-nix
|
||||
coc-nvim
|
||||
coc-yank
|
||||
coc-python
|
||||
coc-json
|
||||
coc-yaml
|
||||
coc-git
|
||||
vim-fugitive
|
||||
vim-startify
|
||||
vim-airline
|
||||
vim-airline-themes
|
||||
base16-vim
|
||||
];
|
||||
#extraPackages = with pkgs;
|
||||
# [ (python3.withPackages (ps: with ps; [ black flake8 ])) ];
|
||||
#extraPython3Packages = (ps: with ps; [ jedi pylint ]);
|
||||
extraConfig = import ./vimrc.nix { inherit pkgs config; };
|
||||
};
|
||||
xdg.dataFile = {
|
||||
"vim/undo/.keep".text = "";
|
||||
"vim/swap/.keep".text = "";
|
||||
"vim/backup/.keep".text = "";
|
||||
};
|
||||
xdg.configFile = {
|
||||
"vim/coc-settings.json".text = builtins.readFile ./coc-settings.json;
|
||||
};
|
||||
};
|
||||
}
|
||||
211
profiles/kat/home/vim/vimrc.nix
Normal file
211
profiles/kat/home/vim/vimrc.nix
Normal file
|
|
@ -0,0 +1,211 @@
|
|||
{ config, pkgs }:
|
||||
|
||||
''
|
||||
" Enable mouse
|
||||
set mouse=a
|
||||
|
||||
" colors
|
||||
let base16colorspace=256
|
||||
"colorscheme base16-rebecca
|
||||
colorscheme default
|
||||
|
||||
" tabline
|
||||
let g:airline#extensions#tabline#enabled = 1
|
||||
|
||||
" notmuch!
|
||||
let g:notmuch_config_file='${config.xdg.configHome}/notmuch/notmuchrc'
|
||||
let g:notmuch_folders_count_threads=0
|
||||
let g:notmuch_date_format='%y-%m-%d %H:%M'
|
||||
let g:notmuch_datetime_format='%y-%m-%d %H:%M'
|
||||
let g:notmuch_show_date_format='%Y/%m/%d %H:%M'
|
||||
let g:notmuch_search_date_format='%Y/%m/%d %H:%M'
|
||||
let g:notmuch_html_converter='${pkgs.elinks}/bin/elinks --dump'
|
||||
|
||||
" Line numbers!
|
||||
set number
|
||||
|
||||
" Open NERDTree at start
|
||||
autocmd VimEnter * NERDTree | wincmd p
|
||||
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() |
|
||||
\ quit | endif
|
||||
autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 |
|
||||
\ let buf=bufnr() | buffer# | execute "normal! \<C-W>w" | execute 'buffer'.buf | endif
|
||||
nnoremap <leader>n :NERDTreeFocus<CR>
|
||||
nnoremap <C-n> :NERDTree<CR>
|
||||
nnoremap <C-t> :NERDTreeToggle<CR>
|
||||
nnoremap <C-f> :NERDTreeFind<CR>
|
||||
|
||||
let g:coc_node_path='${pkgs.nodejs}/bin/node'
|
||||
|
||||
" idk but this means .swp isn't everywhere
|
||||
set undodir=$XDG_DATA_HOME/vim/undo
|
||||
set directory=$XDG_DATA_HOME/vim/swap//
|
||||
set backupdir=$XDG_DATA_HOME/vim/backup
|
||||
|
||||
" TextEdit might fail if hidden is not set.
|
||||
set hidden
|
||||
|
||||
" Some servers have issues with backup files, see #649.
|
||||
set nobackup
|
||||
set nowritebackup
|
||||
|
||||
" Give more space for displaying messages.
|
||||
set cmdheight=2
|
||||
|
||||
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
|
||||
" delays and poor user experience.
|
||||
set updatetime=300
|
||||
|
||||
" Don't pass messages to |ins-completion-menu|.
|
||||
set shortmess+=c
|
||||
|
||||
" Always show the signcolumn, otherwise it would shift the text each time
|
||||
" diagnostics appear/become resolved.
|
||||
if has("patch-8.1.1564")
|
||||
" Recently vim can merge signcolumn and number column into one
|
||||
set signcolumn=number
|
||||
else
|
||||
set signcolumn=yes
|
||||
endif
|
||||
|
||||
" Use tab for trigger completion with characters ahead and navigate.
|
||||
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
|
||||
" other plugin before putting this into your config.
|
||||
inoremap <silent><expr> <TAB>
|
||||
\ pumvisible() ? "\<C-n>" :
|
||||
\ <SID>check_back_space() ? "\<TAB>" :
|
||||
\ coc#refresh()
|
||||
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
||||
|
||||
function! s:check_back_space() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~# '\s'
|
||||
endfunction
|
||||
|
||||
" Use <c-space> to trigger completion.
|
||||
if has('nvim')
|
||||
inoremap <silent><expr> <c-space> coc#refresh()
|
||||
else
|
||||
inoremap <silent><expr> <c-@> coc#refresh()
|
||||
endif
|
||||
|
||||
" Make <CR> auto-select the first completion item and notify coc.nvim to
|
||||
" format on enter, <cr> could be remapped by other vim plugin
|
||||
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
|
||||
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
||||
|
||||
" Use `[g` and `]g` to navigate diagnostics
|
||||
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
|
||||
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
||||
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
||||
|
||||
" GoTo code navigation.
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
|
||||
" Use K to show documentation in preview window.
|
||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||
|
||||
function! s:show_documentation()
|
||||
if (index(['vim','help'], &filetype) >= 0)
|
||||
execute 'h '.expand('<cword>')
|
||||
elseif (coc#rpc#ready())
|
||||
call CocActionAsync('doHover')
|
||||
else
|
||||
execute '!' . &keywordprg . " " . expand('<cword>')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Highlight the symbol and its references when holding the cursor.
|
||||
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
|
||||
" Symbol renaming.
|
||||
nmap <leader>rn <Plug>(coc-rename)
|
||||
|
||||
" Formatting selected code.
|
||||
xmap <leader>f <Plug>(coc-format-selected)
|
||||
nmap <leader>f <Plug>(coc-format-selected)
|
||||
|
||||
augroup mygroup
|
||||
autocmd!
|
||||
" Setup formatexpr specified filetype(s).
|
||||
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
|
||||
" Update signature help on jump placeholder.
|
||||
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
|
||||
augroup end
|
||||
|
||||
" Applying codeAction to the selected region.
|
||||
" Example: `<leader>aap` for current paragraph
|
||||
xmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
nmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
|
||||
" Remap keys for applying codeAction to the current buffer.
|
||||
nmap <leader>ac <Plug>(coc-codeaction)
|
||||
" Apply AutoFix to problem on the current line.
|
||||
nmap <leader>qf <Plug>(coc-fix-current)
|
||||
|
||||
" Map function and class text objects
|
||||
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
|
||||
xmap if <Plug>(coc-funcobj-i)
|
||||
omap if <Plug>(coc-funcobj-i)
|
||||
xmap af <Plug>(coc-funcobj-a)
|
||||
omap af <Plug>(coc-funcobj-a)
|
||||
xmap ic <Plug>(coc-classobj-i)
|
||||
omap ic <Plug>(coc-classobj-i)
|
||||
xmap ac <Plug>(coc-classobj-a)
|
||||
omap ac <Plug>(coc-classobj-a)
|
||||
|
||||
" Remap <C-f> and <C-b> for scroll float windows/popups.
|
||||
if has('nvim-0.4.0') || has('patch-8.2.0750')
|
||||
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
||||
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
||||
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
|
||||
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
|
||||
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
||||
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
||||
endif
|
||||
|
||||
" Use CTRL-S for selections ranges.
|
||||
" Requires 'textDocument/selectionRange' support of language server.
|
||||
nmap <silent> <C-s> <Plug>(coc-range-select)
|
||||
xmap <silent> <C-s> <Plug>(coc-range-select)
|
||||
|
||||
" Add `:Format` command to format current buffer.
|
||||
command! -nargs=0 Format :call CocAction('format')
|
||||
|
||||
" Add `:Fold` command to fold current buffer.
|
||||
command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
||||
|
||||
" Add `:OR` command for organize imports of the current buffer.
|
||||
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
|
||||
|
||||
" Add (Neo)Vim's native statusline support.
|
||||
" NOTE: Please see `:h coc-status` for integrations with external plugins that
|
||||
" provide custom statusline: lightline.vim, vim-airline.
|
||||
set statusline^=%{coc#status()}%{get(b:,'coc_current_function',''')}
|
||||
|
||||
" Mappings for CoCList
|
||||
" Show all diagnostics.
|
||||
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
|
||||
" Manage extensions.
|
||||
nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr>
|
||||
" Show commands.
|
||||
nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr>
|
||||
" Find symbol of current document.
|
||||
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr>
|
||||
" Search workspace symbols.
|
||||
nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr>
|
||||
" Do default action for next item.
|
||||
nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR>
|
||||
" Do default action for previous item.
|
||||
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
|
||||
" Resume latest coc list.
|
||||
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>
|
||||
'' + (if config.deploy.profile.sway then ''
|
||||
noremap "+y y:call system("wl-copy", @")<CR>
|
||||
nnoremap "+p :let @"=substitute(system("wl-paste --no-newline"), '<C-v><C-m>', ''', 'g')<CR>p
|
||||
nnoremap "*p :let @"=substitute(system("wl-paste --no-newline --primary"), '<C-v><C-m>', ''', 'g')<CR>p
|
||||
'' else
|
||||
"")
|
||||
20
profiles/kat/home/xdg.nix
Normal file
20
profiles/kat/home/xdg.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
config = lib.mkIf config.deploy.profile.kat {
|
||||
xdg = {
|
||||
enable = true;
|
||||
userDirs = {
|
||||
enable = true;
|
||||
pictures = "$HOME/media";
|
||||
videos = "$HOME/media/videos";
|
||||
documents = "$HOME/docs";
|
||||
download = "$HOME/downloads";
|
||||
desktop = "$HOME/tmp";
|
||||
templates = "$HOME/tmp";
|
||||
publicShare = "$HOME/shared";
|
||||
music = "$HOME/media-share/music";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
42
profiles/kat/home/zsh/default.nix
Normal file
42
profiles/kat/home/zsh/default.nix
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
config = lib.mkIf config.deploy.profile.kat {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
shellAliases = {
|
||||
nixdirfmt = "fd --color=never .nix | xargs nixfmt";
|
||||
exa = "exa --time-style long-iso";
|
||||
ls = "exa -G";
|
||||
la = "exa -Ga";
|
||||
ll = "exa -l";
|
||||
lla = "exa -lga";
|
||||
};
|
||||
initExtra = ''
|
||||
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=3,bold"
|
||||
'';
|
||||
plugins = [{
|
||||
name = "zsh-autosuggestions";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "zsh-users";
|
||||
repo = "zsh-autosuggestions";
|
||||
rev = "v0.6.4";
|
||||
sha256 = "0h52p2waggzfshvy1wvhj4hf06fmzd44bv6j18k3l9rcx6aixzn6";
|
||||
};
|
||||
}];
|
||||
oh-my-zsh = {
|
||||
enable = true;
|
||||
plugins = [ "git" "sudo" "adb" "cargo" "emoji" ];
|
||||
};
|
||||
};
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
enableNixDirenvIntegration = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
142
profiles/kat/home/zsh/zshrc-title
Normal file
142
profiles/kat/home/zsh/zshrc-title
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
function term_title {
|
||||
emulate -L zsh
|
||||
unsetopt prompt_subst
|
||||
|
||||
[[ -t 1 ]] || return
|
||||
|
||||
local TITLE="$1"
|
||||
local TAB="${2-$1}"
|
||||
|
||||
case "$TERM" in
|
||||
cygwin|xterm*|putty*|rxvt*|ansi)
|
||||
print -Pn "\e]2;$TITLE:q\a"
|
||||
print -Pn "\e]1;$TAB:q\a"
|
||||
;;
|
||||
screen*)
|
||||
print -Pn "\ek$TITLE:q\e\\"
|
||||
;;
|
||||
*)
|
||||
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||
print -Pn "\e]2;$TITLE:q\a"
|
||||
print -Pn "\e]1;$TAB:q\a"
|
||||
else
|
||||
if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then
|
||||
echoti tsl
|
||||
print -Pn "$TITLE"
|
||||
echoti fsl
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function term_dir {
|
||||
emulate -L zsh
|
||||
|
||||
[[ -t 1 ]] || return
|
||||
|
||||
local DIR="${1-$PWD}"
|
||||
|
||||
if [[ "${TERM_PROGRAM-}" == "Apple_Terminal" ]]; then
|
||||
local URL_PATH="$(__omz_urlencode -P "$DIR")"
|
||||
[[ $? != 0 ]] && return 1
|
||||
|
||||
printf '\e]7;%s\a' "file://$HOST$URL_PATH"
|
||||
fi
|
||||
}
|
||||
|
||||
function __arc_update_precmd {
|
||||
local TERM_TITLE="%~"
|
||||
local TERM_TAB="%~"
|
||||
|
||||
if [[ "${TERM_PROGRAM-}" == "Apple_Terminal" ]]; then
|
||||
TERM_TAB="$USER@%m"
|
||||
TERM_TITLE="$TERM_TAB"
|
||||
elif [[ "$USER" != "$DEFAULT_USER" || -n "${SSH_CLIENT-}" ]]; then
|
||||
TERM_TAB="$USER@%m"
|
||||
TERM_TITLE="$TERM_TAB - $TERM_TITLE"
|
||||
fi
|
||||
|
||||
term_title "$TERM_TITLE" "$TERM_TAB"
|
||||
}
|
||||
|
||||
function __arc_update_preexec {
|
||||
emulate -L zsh
|
||||
setopt extended_glob
|
||||
|
||||
local TERM_TAB=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}
|
||||
local TERM_TITLE="${2:gs/%/%%}"
|
||||
|
||||
if [[ "$USER" != "$DEFAULT_USER" || -n "${SSH_CLIENT-}" ]]; then
|
||||
TERM_TAB="$USER@%m - $TERM_TAB"
|
||||
TERM_TITLE="$USER@%m - $TERM_TITLE"
|
||||
fi
|
||||
|
||||
term_title "$TERM_TITLE" "$TERM_TAB"
|
||||
}
|
||||
|
||||
zmodload zsh/langinfo
|
||||
|
||||
function __omz_urlencode() {
|
||||
emulate -L zsh
|
||||
zparseopts -D -E -a opts r m P
|
||||
|
||||
local in_str=$1
|
||||
local url_str=""
|
||||
local spaces_as_plus
|
||||
if [[ -z $opts[(r)-P] ]]; then spaces_as_plus=1; fi
|
||||
local str="$in_str"
|
||||
|
||||
# URLs must use UTF-8 encoding; convert str to UTF-8 if required
|
||||
local encoding=$langinfo[CODESET]
|
||||
local safe_encodings
|
||||
safe_encodings=(UTF-8 utf8 US-ASCII)
|
||||
if [[ -z ${safe_encodings[(r)$encoding]} ]]; then
|
||||
str=$(echo -E "$str" | iconv -f $encoding -t UTF-8)
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Error converting string from $encoding to UTF-8" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Use LC_CTYPE=C to process text byte-by-byte
|
||||
local i byte ord LC_ALL=C
|
||||
export LC_ALL
|
||||
local reserved=';/?:@&=+$,'
|
||||
local mark='_.!~*''()-'
|
||||
local dont_escape="[A-Za-z0-9"
|
||||
if [[ -z $opts[(r)-r] ]]; then
|
||||
dont_escape+=$reserved
|
||||
fi
|
||||
# $mark must be last because of the "-"
|
||||
if [[ -z $opts[(r)-m] ]]; then
|
||||
dont_escape+=$mark
|
||||
fi
|
||||
dont_escape+="]"
|
||||
|
||||
# Implemented to use a single printf call and avoid subshells in the loop,
|
||||
# for performance (primarily on Windows).
|
||||
local url_str=""
|
||||
for (( i = 1; i <= ${#str}; ++i )); do
|
||||
byte="$str[i]"
|
||||
if [[ "$byte" =~ "$dont_escape" ]]; then
|
||||
url_str+="$byte"
|
||||
else
|
||||
if [[ "$byte" == " " && -n $spaces_as_plus ]]; then
|
||||
url_str+="+"
|
||||
else
|
||||
ord=$(( [##16] #byte ))
|
||||
url_str+="%$ord"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo -E "$url_str"
|
||||
}
|
||||
|
||||
if [[ -z "${ARC_PROMPT_RUN-}" ]]; then
|
||||
chpwd_functions+=(term_dir)
|
||||
precmd_functions+=(__arc_update_precmd)
|
||||
preexec_functions+=(__arc_update_preexec)
|
||||
|
||||
term_dir
|
||||
fi
|
||||
19
profiles/kat/nixos.nix
Normal file
19
profiles/kat/nixos.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
config = lib.mkIf config.deploy.profile.kat {
|
||||
users.users.kat = {
|
||||
uid = 1000;
|
||||
isNormalUser = true;
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCocjQqiDIvzq+Qu3jkf7FXw5piwtvZ1Mihw9cVjdVcsra3U2c9WYtYrA3rS50N3p00oUqQm9z1KUrvHzdE+03ZCrvaGdrtYVsaeoCuuvw7qxTQRbItTAEsfRcZLQ5c1v/57HNYNEsjVrt8VukMPRXWgl+lmzh37dd9w45cCY1QPi+JXQQ/4i9Vc3aWSe4X6PHOEMSBHxepnxm5VNHm4PObGcVbjBf0OkunMeztd1YYA9sEPyEK3b8IHxDl34e5t6NDLCIDz0N/UgzCxSxoz+YJ0feQuZtud/YLkuQcMxW2dSGvnJ0nYy7SA5DkW1oqcy6CGDndHl5StOlJ1IF9aGh0gGkx5SRrV7HOGvapR60RphKrR5zQbFFka99kvSQgOZqSB3CGDEQGHv8dXKXIFlzX78jjWDOBT67vA/M9BK9FS2iNnBF5x6shJ9SU5IK4ySxq8qvN7Us8emkN3pyO8yqgsSOzzJT1JmWUAx0tZWG/BwKcFBHfceAPQl6pwxx28TM3BTBRYdzPJLTkAy48y6iXW6UYdfAPlShy79IYjQtEThTuIiEzdzgYdros0x3PDniuAP0KOKMgbikr0gRa6zahPjf0qqBnHeLB6nHAfaVzI0aNbhOg2bdOueE1FX0x48sjKqjOpjlIfq4WeZp9REr2YHEsoLFOBfgId5P3BPtpBQ== cardno:000612078454"
|
||||
];
|
||||
shell = pkgs.zsh;
|
||||
extraGroups = [ "wheel" "video" ];
|
||||
hashedPassword =
|
||||
"$6$i28yOXoo$/WokLdKds5ZHtJHcuyGrH2WaDQQk/2Pj0xRGLgS8UcmY2oMv3fw2j/85PRpsJJwCB2GBRYRK5LlvdTleHd3mB.";
|
||||
};
|
||||
};
|
||||
|
||||
options = { deploy.profile.kat = lib.mkEnableOption "uhh meow"; };
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue