configure home

main
xenia 2023-10-12 22:51:18 +02:00
commit ccff3036c3
12 changed files with 1477 additions and 0 deletions

View File

@ -0,0 +1,154 @@
pkgs@{stdenv, ...}:
let
tmux-menu = with pkgs; writeScript "tmux-menu" "
export LC_ALL='en_US.UTF-8'
export LC_CTYPE='UTF-8'
SESSIONS=$(tmux ls)
SESSIONS=\"$ emacsclient
$ rink
$SESSIONS
Connect to coral.shoes (tmux)
Connect to coral.shoes (raw)
New session
Raw shell\"
CHOICE_LINE=$(echo \"$SESSIONS\" | fzf -1) || exit
CHOICE=$(echo \"$CHOICE_LINE\" | cut -d: -f1)
case $CHOICE in
'$ rink')
${rink}/bin/rink
;;
'$ emacsclient')
${emacs}/bin/emacsclient -n --create-frame -e '(x-focus-frame (selected-frame))' --alternate-editor=
;;
'Connect to coral.shoes (tmux)')
${mosh}/bin/mosh web -- tmux attach
;;
'Connect to coral.shoes (raw)')
${mosh}/bin/mosh web
;;
'Raw shell')
${zsh}/bin/zsh
;;
'New session')
echo 'Name? ' ; read NAME
${tmux}/bin/tmux new -s \"$NAME\" ${zsh}/bin/zsh
;;
*)
${tmux}/bin/tmux attach-session -t \"$CHOICE\"
;;
esac";
base-cfg = {
window = {
padding.x = 0;
padding.y = 0;
decorations = if stdenv.isDarwin then "Buttonless" else "Full";
startup_mode = "Windowed";
};
mouse.hide_when_typing = true;
font = {
normal.family = "SAX2";
size = 15;
};
colors.primary = {
background = "#282828";
foreground = "#ebdbb2";
};
shell.program = "${pkgs.zsh}/bin/zsh";
shell.args = [ "--login" "-c" "${tmux-menu}" ];
key_bindings = import ./keybinds.nix { bind-broken-mac-keybinds = stdenv.isDarwin; };
};
alt-patch-package = pkgs.fetchgit {
url = "https://github.com/loovjo/alacritty-modifiers-patch";
rev = "36ac4031248ba132f280017bfd8bf0a32e214f9d";
hash = "sha256-to5Tq64w8Tvt+KHjiKga3B31XC5TT/4kMR1zqp9A3AI=";
fetchSubmodules = true;
# deepClone = true;
};
rpathLibs = with pkgs; [
# expat
# fontconfig
# freetype
# libGL
# xorg.libX11
# xorg.libXcursor
# xorg.libXi
# xorg.libXrandr
# xorg.libXxf86vm
# xorg.libxcb
];
alacritty-alt-patch = with pkgs; rustPlatform.buildRustPackage {
pname = "alacritty-alt-patch";
version = "latest";
src = alt-patch-package;
cargoLock = { lockFile = alt-patch-package + "/Cargo.lock"; };
nativeBuildInputs = [
cmake
installShellFiles
makeWrapper
ncurses
pkg-config
python3
];
buildInputs = rpathLibs
++ (with pkgs.darwin.apple_sdk.frameworks; [
AppKit
CoreGraphics
CoreServices
CoreText
Foundation
libiconv
OpenGL
]);
doCheck = false; # meow
outputs = [ "out" "terminfo" ];
postPatch = lib.optionalString (!xdg-utils.meta.broken) ''
substituteInPlace alacritty/src/config/ui_config.rs \
--replace xdg-open ${xdg-utils}/bin/xdg-open
'';
checkFlags = [ "--skip=term::test::mock_term" ]; # broken on aarch64
postInstall = ''
mkdir $out/Applications
cp -r extra/osx/Alacritty.app $out/Applications
cp -r $out/bin $out/Applications/Alacritty.app/Contents/MacOS # the original script used ln -s instead of cp -r, seems launchpad dies when having symlinks inside the application?
installShellCompletion --zsh extra/completions/_alacritty
installShellCompletion --bash extra/completions/alacritty.bash
installShellCompletion --fish extra/completions/alacritty.fish
install -dm 755 "$out/share/man/man1"
# gzip -c extra/alacritty.man > "$out/share/man/man1/alacritty.1.gz"
# gzip -c extra/alacritty-msg.man > "$out/share/man/man1/alacritty-msg.1.gz"
install -Dm 644 alacritty.yml $out/share/doc/alacritty.yml
install -dm 755 "$terminfo/share/terminfo/a/"
tic -xe alacritty,alacritty-direct -o "$terminfo/share/terminfo" extra/alacritty.info
mkdir -p $out/nix-support
echo "$terminfo" >> $out/nix-support/propagated-user-env-packages
'';
dontPatchELF = true;
passthru.tests.test = nixosTests.terminal-emulators.alacritty;
};
in
{
enable = true;
settings = base-cfg;
package = if stdenv.isDarwin then alacritty-alt-patch else pkgs.alacritty;
}

View File

@ -0,0 +1,171 @@
{ bind-broken-mac-keybinds }:
let
broken-options = [
{ key = ''Backslash''; mods = ''Option''; chars = ''|''; }
{ key = ''Backslash''; mods = ''Shift|Option''; chars = ''\\''; }
{ key = ''Key6''; mods = ''Option''; chars = ''^''; } # huh?
{ key = ''Minus''; mods = ''Shift|Option''; chars = ''_''; }
{ key = ''LBracket''; mods = ''Option''; chars = ''[''; }
{ key = ''LBracket''; mods = ''Shift|Option''; chars = ''{''; }
{ key = ''RBracket''; mods = ''Option''; chars = '']''; }
{ key = ''RBracket''; mods = ''Shift|Option''; chars = ''}''; }
{ key = ''Key2''; mods = ''Option''; chars = ''@''; }
];
ralts = [
{ key = ''A''; mods = ''Alt''; chars = ''\x1ba''; }
{ key = ''B''; mods = ''Alt''; chars = ''\x1bb''; }
{ key = ''C''; mods = ''Alt''; chars = ''\x1bc''; }
{ key = ''D''; mods = ''Alt''; chars = ''\x1bd''; }
{ key = ''E''; mods = ''Alt''; chars = ''\x1be''; }
{ key = ''F''; mods = ''Alt''; chars = ''\x1bf''; }
{ key = ''G''; mods = ''Alt''; chars = ''\x1bg''; }
{ key = ''H''; mods = ''Alt''; chars = ''\x1bh''; }
{ key = ''I''; mods = ''Alt''; chars = ''\x1bi''; }
{ key = ''J''; mods = ''Alt''; chars = ''\x1bj''; }
{ key = ''K''; mods = ''Alt''; chars = ''\x1bk''; }
{ key = ''L''; mods = ''Alt''; chars = ''\x1bl''; }
{ key = ''M''; mods = ''Alt''; chars = ''\x1bm''; }
{ key = ''N''; mods = ''Alt''; chars = ''\x1bn''; }
{ key = ''O''; mods = ''Alt''; chars = ''\x1bo''; }
{ key = ''P''; mods = ''Alt''; chars = ''\x1bp''; }
{ key = ''Q''; mods = ''Alt''; chars = ''\x1bq''; }
{ key = ''R''; mods = ''Alt''; chars = ''\x1br''; }
{ key = ''S''; mods = ''Alt''; chars = ''\x1bs''; }
{ key = ''T''; mods = ''Alt''; chars = ''\x1bt''; }
{ key = ''U''; mods = ''Alt''; chars = ''\x1bu''; }
{ key = ''V''; mods = ''Alt''; chars = ''\x1bv''; }
{ key = ''W''; mods = ''Alt''; chars = ''\x1bw''; }
{ key = ''X''; mods = ''Alt''; chars = ''\x1bx''; }
{ key = ''Y''; mods = ''Alt''; chars = ''\x1by''; }
{ key = ''Z''; mods = ''Alt''; chars = ''\x1bz''; }
{ key = ''A''; mods = ''Alt|Shift''; chars = ''\x1bA''; }
{ key = ''B''; mods = ''Alt|Shift''; chars = ''\x1bB''; }
{ key = ''C''; mods = ''Alt|Shift''; chars = ''\x1bC''; }
{ key = ''D''; mods = ''Alt|Shift''; chars = ''\x1bD''; }
{ key = ''E''; mods = ''Alt|Shift''; chars = ''\x1bE''; }
{ key = ''F''; mods = ''Alt|Shift''; chars = ''\x1bF''; }
{ key = ''G''; mods = ''Alt|Shift''; chars = ''\x1bG''; }
{ key = ''H''; mods = ''Alt|Shift''; chars = ''\x1bH''; }
{ key = ''I''; mods = ''Alt|Shift''; chars = ''\x1bI''; }
{ key = ''J''; mods = ''Alt|Shift''; chars = ''\x1bJ''; }
{ key = ''K''; mods = ''Alt|Shift''; chars = ''\x1bK''; }
{ key = ''L''; mods = ''Alt|Shift''; chars = ''\x1bL''; }
{ key = ''M''; mods = ''Alt|Shift''; chars = ''\x1bM''; }
{ key = ''N''; mods = ''Alt|Shift''; chars = ''\x1bN''; }
{ key = ''O''; mods = ''Alt|Shift''; chars = ''\x1bO''; }
{ key = ''P''; mods = ''Alt|Shift''; chars = ''\x1bP''; }
{ key = ''Q''; mods = ''Alt|Shift''; chars = ''\x1bQ''; }
{ key = ''R''; mods = ''Alt|Shift''; chars = ''\x1bR''; }
{ key = ''S''; mods = ''Alt|Shift''; chars = ''\x1bS''; }
{ key = ''T''; mods = ''Alt|Shift''; chars = ''\x1bT''; }
{ key = ''U''; mods = ''Alt|Shift''; chars = ''\x1bU''; }
{ key = ''V''; mods = ''Alt|Shift''; chars = ''\x1bV''; }
{ key = ''W''; mods = ''Alt|Shift''; chars = ''\x1bW''; }
{ key = ''X''; mods = ''Alt|Shift''; chars = ''\x1bX''; }
{ key = ''Y''; mods = ''Alt|Shift''; chars = ''\x1bY''; }
{ key = ''Z''; mods = ''Alt|Shift''; chars = ''\x1bZ''; }
{ key = ''Key1''; mods = ''Alt''; chars = ''\x1b1''; }
{ key = ''Key2''; mods = ''Alt''; chars = ''\x1b2''; }
{ key = ''Key3''; mods = ''Alt''; chars = ''\x1b3''; }
{ key = ''Key4''; mods = ''Alt''; chars = ''\x1b4''; }
{ key = ''Key5''; mods = ''Alt''; chars = ''\x1b5''; }
{ key = ''Key6''; mods = ''Alt''; chars = ''\x1b6''; }
{ key = ''Key7''; mods = ''Alt''; chars = ''\x1b7''; }
{ key = ''Key8''; mods = ''Alt''; chars = ''\x1b8''; }
{ key = ''Key9''; mods = ''Alt''; chars = ''\x1b9''; }
{ key = ''Key0''; mods = ''Alt''; chars = ''\x1b0''; }
{ key = ''Grave''; mods = ''Alt''; chars = ''\x1b`''; } # Alt + `
{ key = ''Grave''; mods = ''Alt|Shift''; chars = ''\x1b~''; } # Alt + ~
{ key = ''Period''; mods = ''Alt''; chars = ''\x1b.''; } # Alt + .
{ key = ''Key8''; mods = ''Alt|Shift''; chars = ''\x1b*''; } # Alt + *
{ key = ''Key3''; mods = ''Alt|Shift''; chars = ''\x1b#''; } # Alt + #
{ key = ''Period''; mods = ''Alt|Shift''; chars = ''\x1b>''; } # Alt + >
{ key = ''Comma''; mods = ''Alt|Shift''; chars = ''\x1b<''; } # Alt + <
{ key = ''Minus''; mods = ''Alt|Shift''; chars = ''\x1b_''; } # Alt + _
{ key = ''Key5''; mods = ''Alt|Shift''; chars = ''\x1b%''; } # Alt + %
{ key = ''Key6''; mods = ''Alt|Shift''; chars = ''\x1b^''; } # Alt + ^
{ key = ''Backslash''; mods = ''Alt''; chars = ''\x1b\\''; } # Alt + \
{ key = ''Backslash''; mods = ''Alt|Shift''; chars = ''\x1b|''; } # Alt + |
];
alt-arrows = [
{ key = ''Left''; mods = ''Option''; chars = ''\x1bb''; }
{ key = ''Right''; mods = ''Option''; chars = ''\x1bf''; }
];
ctrl-binds = [
# { key = ''A''; mods = ''Control''; chars = ''\x01''; }
{ key = ''A''; mods = ''Control''; chars = ''\x01''; }
{ key = ''B''; mods = ''Control''; chars = ''\x02''; }
{ key = ''C''; mods = ''Control''; chars = ''\x03''; }
{ key = ''D''; mods = ''Control''; chars = ''\x04''; }
{ key = ''E''; mods = ''Control''; chars = ''\x05''; }
{ key = ''F''; mods = ''Control''; chars = ''\x06''; }
{ key = ''G''; mods = ''Control''; chars = ''\x07''; }
{ key = ''H''; mods = ''Control''; chars = ''\x08''; }
{ key = ''I''; mods = ''Control''; chars = ''\x09''; }
{ key = ''J''; mods = ''Control''; chars = ''\x0A''; }
{ key = ''K''; mods = ''Control''; chars = ''\x0B''; }
{ key = ''L''; mods = ''Control''; chars = ''\x0C''; }
{ key = ''M''; mods = ''Control''; chars = ''\x0D''; }
{ key = ''N''; mods = ''Control''; chars = ''\x0E''; }
{ key = ''O''; mods = ''Control''; chars = ''\x0F''; }
{ key = ''P''; mods = ''Control''; chars = ''\x10''; }
{ key = ''Q''; mods = ''Control''; chars = ''\x11''; }
{ key = ''R''; mods = ''Control''; chars = ''\x12''; }
{ key = ''S''; mods = ''Control''; chars = ''\x13''; }
{ key = ''T''; mods = ''Control''; chars = ''\x14''; }
{ key = ''U''; mods = ''Control''; chars = ''\x15''; }
{ key = ''V''; mods = ''Control''; chars = ''\x16''; }
{ key = ''W''; mods = ''Control''; chars = ''\x17''; }
{ key = ''X''; mods = ''Control''; chars = ''\x18''; }
{ key = ''Y''; mods = ''Control''; chars = ''\x19''; }
{ key = ''Z''; mods = ''Control''; chars = ''\x1A''; }
];
tmux-binds = [
{ key = ''Period''; mods = ''Control''; chars = ''\x1D''; } # tmux escape
{ key = ''Period''; mods = ''Shift|Command''; chars = ''\x1D:''; }
{ key = ''Key0''; mods = ''Command''; chars = ''\x1D0''; }
{ key = ''Key1''; mods = ''Command''; chars = ''\x1D1''; }
{ key = ''Key2''; mods = ''Command''; chars = ''\x1D2''; }
{ key = ''Key3''; mods = ''Command''; chars = ''\x1D3''; }
{ key = ''Key4''; mods = ''Command''; chars = ''\x1D4''; }
{ key = ''Key5''; mods = ''Command''; chars = ''\x1D5''; }
{ key = ''Key6''; mods = ''Command''; chars = ''\x1D6''; }
{ key = ''Key7''; mods = ''Command''; chars = ''\x1D7''; }
{ key = ''Key8''; mods = ''Command''; chars = ''\x1D8''; }
{ key = ''Key9''; mods = ''Command''; chars = ''\x1D9''; }
{ key = ''T''; mods = ''Command''; chars = ''\x1Dc''; }
{ key = ''R''; mods = ''Command''; chars = ''\x1D$''; }
{ key = ''W''; mods = ''Shift|Command''; chars = ''\x1D&''; } # kill window
{ key = ''W''; mods = ''Command''; chars = ''\x1Dx''; } # kill pane
{ key = ''Left''; mods = ''Command''; chars = ''\x1Dp''; }
{ key = ''Right''; mods = ''Command''; chars = ''\x1Dn''; }
{ key = ''Right''; mods = ''Shift|Command''; chars = ''\x1D\x1b[C''; }
{ key = ''Left''; mods = ''Shift|Command''; chars = ''\x1D\x1b[D''; }
{ key = ''O''; mods = ''Command''; chars = ''\x1Dw''; } # ''open'', open a window
{ key = ''A''; mods = ''Command''; chars = ''\x1D;''; } # Last pane
];
others = [
{ key = ''Escape''; chars = ''\x1B''; }
];
std-binds = tmux-binds;
mac-binds =
ralts
;
in
if bind-broken-mac-keybinds then
std-binds ++ mac-binds
else
std-binds

169
dotfiles/init.el 100644
View File

@ -0,0 +1,169 @@
(load "server")
(unless (server-running-p) (server-start))
(setenv "PATH" (concat (getenv "PATH") ":todo!("))
(setq exec-path (append exec-path '("/run/current-system/sw/bin" "/nix/var/nix/profiles/default/bin")))
(add-to-list 'default-frame-alist '(font . "SAX2"))
(set-face-attribute 'default nil :height 150)
(load-theme 'wombat t)
(tool-bar-mode -1)
(pixel-scroll-mode 1)
(scroll-bar-mode -1)
(setq mac-option-modifier 'none)
(setq mac-right-option-modifier 'meta)
(setq frame-resize-pixelwise t)
(setq make-backup-files nil)
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq-default sgml-basic-offset 4)
(setq whitespace-style '(trailing tabs newline tab-mark))
(setq-default show-trailing-whitespace t)
(global-whitespace-mode)
(setq backup-directory-alist `(("." . "~/.emacs/saves")))
(setq backup-by-copying t)
(add-hook 'shell-mode-hook
(lambda ()
(local-set-key (kbd "C-p") 'comint-previous-input)
(local-set-key (kbd "C-n") 'comint-next-input)
))
(require 'agda2)
(require 'bind-key)
; (bind-key* "M-p" 'pixel-scroll-down)
; (bind-key* "M-n" 'pixel-scroll-up)
(bind-key* "s-a" 'other-window)
(bind-key* "s-q" 'save-buffers-kill-terminal)
(bind-key* "s-<right>" 'windmove-right)
(bind-key* "s-<left>" 'windmove-left)
(bind-key* "s-<up>" 'windmove-up)
(bind-key* "s-<down>" 'windmove-down)
(setq lsp-keymap-prefix "M-l")
(require 'lsp-mode)
(require 'company)
(require'meow)
(meow-global-mode 1)
(defun meow-setup ()
(setq meow-expand-hint-counts
'((word . 10)
(line . 10)
(block . 10)
(find . 10)
(till . 10))
)
(meow-leader-define-key
'("1" . meow-digit-argument)
'("2" . meow-digit-argument)
'("3" . meow-digit-argument)
'("4" . meow-digit-argument)
'("5" . meow-digit-argument)
'("6" . meow-digit-argument)
'("7" . meow-digit-argument)
'("8" . meow-digit-argument)
'("9" . meow-digit-argument)
'("0" . meow-digit-argument)
'("/" . meow-keypad-describe-key)
'("?" . meow-cheatsheet))
(meow-motion-overwrite-define-key
;; custom keybinding for motion state
'("<escape>" . ignore))
(meow-normal-define-key
'("0" . meow-expand-0)
'("9" . meow-expand-9)
'("8" . meow-expand-8)
'("7" . meow-expand-7)
'("6" . meow-expand-6)
'("5" . meow-expand-5)
'("4" . meow-expand-4)
'("3" . meow-expand-3)
'("2" . meow-expand-2)
'("1" . meow-expand-1)
'("-" . negative-argument)
'(";" . meow-reverse)
'("," . meow-inner-of-thing)
'("." . meow-bounds-of-thing)
'("<" . meow-beginning-of-thing)
'(">" . meow-end-of-thing)
'("a" . meow-append)
'("A" . meow-open-below)
'("b" . meow-back-word)
'("B" . meow-back-symbol)
'("c" . meow-change)
; '("d" . meow-delete)
; '("D" . meow-backward-delete)
'("d" . meow-kill)
'("e" . meow-line)
'("E" . meow-goto-line)
'("f" . meow-find)
'("g" . meow-cancel-selection)
'("G" . meow-grab)
'("h" . meow-left)
'("H" . meow-left-expand)
'("i" . meow-insert)
'("I" . meow-open-above)
; '("j" . meow-join)
'("j" . meow-next)
'("J" . meow-next-expand)
; '("k" . meow-kill)
'("k" . meow-prev)
'("K" . meow-prev-expand)
; '("l" . meow-till)
'("l" . meow-right)
'("L" . meow-right-expand)
'("m" . meow-mark-word)
'("M" . meow-mark-symbol)
; '("n" . meow-next)
; '("N" . meow-next-expand)
'("o" . meow-block)
'("O" . meow-to-block)
; '("p" . meow-prev)
; '("P" . meow-prev-expand)
; '("q" . meow-quit)
; '("Q" . meow-goto-line)
'("r" . meow-replace)
'("R" . meow-swap-grab)
'("s" . meow-search)
; '("t" . meow-right)
; '("T" . meow-right-expand)
'("t" . meow-till)
'("u" . undo)
'("U" . undo-redo)
'("v" . meow-visit)
'("w" . meow-next-word)
'("W" . meow-next-symbol)
'("x" . meow-save)
'("X" . meow-sync-grab)
'("y" . meow-yank)
'("z" . meow-pop-selection)
'("'" . repeat)
'("<escape>" . ignore)))
(meow-setup)
(setq mark-even-if-inactive nil)
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'narrow-to-region 'disabled nil)
(require 'agda-input)
(setq agda-input-tweak-all
'(agda-input-compose
(agda-input-prepend "!")
(agda-input-nonempty))
)
(agda-input-setup)
(setq default-input-method "Agda")
(add-to-list 'auto-mode-alist '("\\.lagda.md\\'" . agda2-mode))
; (setq ring-bell-function (lambda () (call-process "sh" nil 0 nil "-c" "find /Users/xenia/cloud/configs/resources -type f | egrep -v '/_' | shuf -n 1 | xargs afplay")))

173
dotfiles/kakrc 100644
View File

@ -0,0 +1,173 @@
## Highlight whitespace at end of line
add-highlighter global/ regex '^.*[^ ]( +)$' 1:black,red
add-highlighter global/ number-lines -relative -hlcursor
hook global WinSetOption .* %{
remove-highlighter global/show-ws
add-highlighter global/show-ws show-whitespaces -tabpad ' '
face global Whitespace rgb:3c3836+f
face global comment rgb:665c54+f
}
add-highlighter global/ show-matching
set global indentwidth 4
hook global WinSetOption filetype=(verilog|nix|vhdl) %{
set buffer tabstop 2
set buffer indentwidth 2
}
hook global WinSetOption filetype=vhdl %{
set buffer comment_block_begin '/*'
set buffer comment_block_end '/*'
set buffer comment_line '--'
}
## == keybinds ==
map global normal 'J' "Jx"
map global normal 'K' "Kx"
# tabs
map global insert '<tab>' '<a-;><a-gt>'
map global insert '<s-tab>' '<a-;><a-lt>'
define-command W w
# Commenting
map global normal '#' ':comment-line<ret>'
map global user '#' ':comment-block<ret>' -docstring 'Block comment'
# Clipboard commands
map global normal '<a-y>' '|pbcopy<ret>u:echo "Copied text to clipboard"<ret>'
map global normal '<c-v>' '!pbpaste<ret>'
# Buffer user mode
map global user 'b' ':enter-user-mode buffers<ret>' -docstring 'buffer mode'
map global user 'B' ':enter-user-mode -lock buffers<ret>' -docstring 'buffer mode (lock)'
# command to copy <filename>:<line> into the clipboard (useful for pasting into debugger)
define-command copy-location -docstring "Copies <filename>:<line> for the current cursor into the clipboard" %{
evaluate-commands %sh{
set -e
printf "%s" "$kak_bufname:$kak_cursor_line" | pbcopy
echo "echo 'Copied $kak_bufname:$kak_cursor_line into clipboard'"
}
}
define-command copy-location-path -docstring "Copies <full path>:<line> for the current cursor into the clipboard" %{
evaluate-commands %sh{
set -e
printf "%s" "$kak_buffile:$kak_cursor_line" | pbcopy
echo "echo 'Copied $kak_buffile:$kak_cursor_line into clipboard'"
}
}
map global user 'y' ':copy-location<ret>' -docstring "Copy location"
map global user 'Y' ':copy-location-path<ret>' -docstring "Copy location (full path)"
## == plugin configuration ==
# Custom function surround
define-command -hidden surround-function %{
prompt 'function: ' %{
execute-keys "<a-:><a-;>Z;ha%val{text}(<esc><a-;>L<a-z>ua)<esc>"
}
}
define-command -hidden surround-tag %{
prompt 'tag: ' %{
execute-keys "<a-:><a-;>Z;ha<lt>%val{text}<gt><esc><a-;>L<a-z>ua<lt>/%val{text}<gt><esc>"
}
}
define-command -hidden surround-Tag %{
prompt 'tag: ' %{
execute-keys "xZ<a-:><a-;>gih<a-h>yz<gt>xZO<c-r>""<lt>%val{text}<gt><esc>zo<c-r>""<lt>%val{text}<gt><esc>z"
}
}
define-command -hidden surround-ins %{
prompt 'prefix: ' %{
execute-keys "<a-:><a-;>Z;ha%val{text}<esc><a-;>L<a-z>u"
}
}
map global mirror 'f' ':surround-function<ret>' -docstring 'function'
map global mirror 't' ':surround-tag<ret>' -docstring 'function'
map global mirror 'T' ':surround-Tag<ret>' -docstring 'function'
map global mirror 'i' ':surround-ins<ret>' -docstring 'function'
map global normal ö ':enter-user-mode mirror<ret>' -docstring 'mirror mode'
# LSP stuff
map global normal 'Å' ':lsp-enable<ret>' -docstring 'Enable LSP'
map global normal 'å' ':enter-user-mode lsp<ret>' -docstring 'LSP mode'
map global lsp 'R' ':lsp-rename-prompt<ret>' -docstring 'Rename symbol'
define-command lsp-clear-references %{
set-option window lsp_references # empty
}
map global lsp '"' ':lsp-clear-references<ret>' -docstring "Clear references"
face global Reference white,rgb:550055
face global ReferenceBind white,rgb:552200
map global insert '<c-s>' '<a-;>:enter-user-mode lsp<ret>s'
#TODO
# map global user '&' ':qhl-word<ret>' -docstring "Highlight current word"
# map global user '"' ':unqhl<ret>' -docstring "Remove highlight"
## == Colors ==
define-command update-cursor-style %{
evaluate-commands %sh{
if [ $(echo "$kak_selection" | wc -c) -eq 2 ] ; then
echo 'face buffer PrimaryCursor white,+uiF'
else
echo 'face buffer PrimaryCursor white,rgb:b05fde+uiF'
fi
}
}
hook global NormalKey .* %{
update-cursor-style
}
hook global WinCreate .* %{
update-cursor-style
}
face global PrimaryCursorEol PrimaryCursor
face global SecondaryCursorEol SecondaryCursor
face global operator blue
face global type rgb:aa66ee+b
face global MenuBackground rgb:eecc44+i
face global MenuForeground blue+bi
face global Information rgb:44ccee+b
face global MatchingChar ,rgb:665c54+bF
## Filetype formatting
hook global BufSetOption filetype=rust %{
set-option buffer formatcmd 'rustfmt'
hook buffer -group rust-inlay-hints BufReload .* rust-analyzer-inlay-hints
hook buffer -group rust-inlay-hints NormalIdle .* rust-analyzer-inlay-hints
}
hook global WinSetOption filetype=python %{
set-option window formatcmd 'black -q -'
}
set-option global ignored_files "^(\..*|.*\.(o|so|a)|__pycache__)$"
## APL execute on =
define-command -hidden dyalog-execute %{
execute-keys -itersel 'i⎕←<esc>HH|dyalogscript /dev/fd/0<ret>'
}
map global normal '=' ':dyalog-execute<ret>'

85
dotfiles/zshrc 100755
View File

@ -0,0 +1,85 @@
#!/bin/zsh
export PATH="$HOME/.cargo/bin:$PATH"
export PATH="/Applications/ARM/bin:$PATH"
mkdir -p "$XDG_RUNTIME_DIR"
alias ls="ls -G"
alias bashcols="python3 ~/cloud/Projekt/Programmering/Python/BashCols.py"
alias bashcurmov="python3 ~/cloud/Projekt/Programmering/Python/Bashcurmoves.py"
alias objdump="objdump -M intel"
alias atsc="patscc -cleanaft -DATS_MEMALLOC_LIBC"
alias i2="idris2"
alias py="python"
alias ipy="ipython"
alias c="cargo"
alias bqn="rlwrap BQN"
alias nix-zsh="nix-shell --run zsh"
alias z=nix-zsh
_BLUE="\033[38;5;4m"
_GREEN="\033[38;5;2m"
_RED="\033[38;5;1m"
_RESET="\033[0m"
function activate {
(
cd ~/cloud/Projekt
F=$( fd '' -t d -d 4 . | fzf -1 -q "$1" ) || return
LINKEE=$(realpath "$F")
DEFAULT_NAME=$(basename "$LINKEE")
LINK="${2:-${DEFAULT_NAME}}"
cd ~/cloud/A-Aktivta
if [[ -d "$LINK" ]] then
echo "Project ${_BLUE}$LINK${_RESET} already exists!"
else
echo "${_BLUE}$LINK${_RESET} -> ${_BLUE}$LINKEE${_RESET} has been ${_GREEN}activated${_RESET}"
ln -s "$LINKEE" "$LINK"
fi
)
_check_proj_count
}
function _check_proj_count {
(
cd ~/cloud/A-Aktivta
N_FILES=$(ls | wc -l | tr -d ' ')
if [[ $N_FILES > 4 ]] then
echo "You have $_RED$N_FILES$_RESET active projets. Consider deactivating some"
fi
)
}
function deactivate {
(
cd ~/cloud/A-Aktivta
F=$( fd '' -t l -d 1 . | fzf -1 -q "$1" ) || return
rm "$F"
echo "Deactivated $_BLUE$F$RESET"
)
_check_proj_count
}
function project {
pushd >/dev/null
cd ~/cloud/A-Aktivta
PROJ_NAME=$( fd '' -t l -d 1 . | fzf -1 -q "$1" ) || { popd >/dev/null ; return }
F=$(realpath "$PROJ_NAME")
echo "In $_BLUE${PROJ_NAME}$_RESET"
cd "$F"
_check_proj_count
}
alias p=project
setopt prompt_subst
# export RPROMPT='%(?.%F{green}√.%?%F{red}?)%f'
# tmux stuff
function setwd {
tmux command-prompt -I "attach -c $(pwd)"
}
alias nix-zsh="nix-shell --run zsh"

17
emacs_build.sh 100755
View File

@ -0,0 +1,17 @@
PATH="/usr/bin:/bin"
set -e
mkdir -p "${out}/Applications"
appOut="${out}/Applications/${appName}.app"
osacompile -o "${appOut}" <<EOF
do shell script "env -i XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR} ${emacs}/bin/emacsclient -n --create-frame -e '(x-focus-frame (selected-frame))' --alternate-editor=''"
EOF
cp "${icon}" "${appOut}/Contents/Resources/EmacsClient.icns"
chmod 644 "${appOut}/Contents/Resources/EmacsClient.icns"
plutil -replace CFBundleIconFile -json '"EmacsClient"' "${appOut}/Contents/Info.plist"
plutil -replace CFBundleDisplayName -json '"EmacsClient"' "${appOut}/Contents/Info.plist"

69
extras.nix 100644
View File

@ -0,0 +1,69 @@
pkgs:
rec {
qr-generator = pkgs.writeShellScriptBin "qr" ''
${pkgs.qrencode}/bin/qrencode -t ansiutf8 "$@"
'';
qr-paste = pkgs.writeShellScriptBin "qrpaste" ''
pbpaste | ${pkgs.qrencode}/bin/qrencode -t ansiutf8
'';
challtools = (ps: with ps;
buildPythonPackage rec {
pname = "challtools";
version = "0.4.8";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-nfPAm7rgSMwGq2fgrG82xbdo/YIapDAVR+YGFROBBCU=";
};
propagatedBuildInputs = [
pyyaml jsonschema docker requests argcomplete google-cloud-storage
];
}
);
sax2 = pkgs.fetchurl {
name = "SAX2";
url = "https://abrudz.github.io/SAX2/SAX2.ttf";
sha256 = "sha256-DgvDWXO2fnKZNu9EvQOq8GNMTU3PUdp85+/0ZHdRXZc=";
recursiveHash = true;
downloadToTemp = true;
postFetch = ''
mkdir -p $out/share/fonts/truetype
mv $downloadedFile $out/share/fonts/truetype/SAX2.ttf
'';
};
manrope = pkgs.fetchurl {
name = "manrope";
url = "https://www.gent.media/assets/manrope/manrope.zip";
downloadToTemp = true;
recursiveHash = true;
postFetch = ''
mkdir -p $out/share/fonts
${pkgs.unzip}/bin/unzip -j $downloadedFile 'fonts/otf/*.otf' -d $out/share/fonts/opentype
'';
sha256 = "sha256-9FYNbuQQ6j35eUizGT2hUzp2s6Cc8x3IgU7XPxAumUY=";
};
metrophobic = pkgs.fetchurl {
name = "metrophobic";
url = "https://www.fontsquirrel.com/fonts/download/metrophobic";
downloadToTemp = true;
recursiveHash = true;
postFetch = ''
mkdir -p $out/share/fonts/opentype
${pkgs.unzip}/bin/unzip -j $downloadedFile 'Metrophobic.otf' -d $out/share/fonts/opentype
'';
sha256 = "sha256-ASDT1T+6/n4HR0ubgkn0qwdijY91VVL2Y9OUkKQMKKc=";
};
all = [ qr-generator qr-paste sax2 manrope metrophobic ];
}

268
flake.lock 100644
View File

@ -0,0 +1,268 @@
{
"nodes": {
"ansi-utils": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1697106759,
"narHash": "sha256-3j2wNkY9XiA1ZxmUe4eGDmq3t0ZkhMWiBDPXYoaTbrY=",
"ref": "refs/heads/main",
"rev": "e4ab20623e30ef730dc4a30decfeae0daa2a8761",
"revCount": 2,
"type": "git",
"url": "https://git@githug.xyz/xenia/ansi-utils"
},
"original": {
"type": "git",
"url": "https://git@githug.xyz/xenia/ansi-utils"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_3": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_4": {
"inputs": {
"systems": "systems_4"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1696940889,
"narHash": "sha256-p2Wic74A1tZpFcld1wSEbFQQbrZ/tPDuLieCnspamQo=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "6bba64781e4b7c1f91a733583defbd3e46b49408",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"kak": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1697112703,
"narHash": "sha256-LFGZnAaoEevR533tnjm+nCw0S0nYcRtZtyIQgR5h4Kk=",
"ref": "refs/heads/main",
"rev": "1fbcf088fbf1fdc02a8ef4aebc073b2fb8d25987",
"revCount": 10136,
"type": "git",
"url": "https://githug.xyz/xenia/kakoune.git"
},
"original": {
"type": "git",
"url": "https://githug.xyz/xenia/kakoune.git"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1696879762,
"narHash": "sha256-Ud6bH4DMcYHUDKavNMxAhcIpDGgHMyL/yaDEAVSImQY=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "f99e5f03cc0aa231ab5950a15ed02afec45ed51a",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"ansi-utils": "ansi-utils",
"home-manager": "home-manager",
"kak": "kak",
"nixpkgs": "nixpkgs",
"unambig-path": "unambig-path",
"unispect": "unispect"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_4": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"unambig-path": {
"inputs": {
"flake-utils": "flake-utils_3",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1697107924,
"narHash": "sha256-1XAXaOoLOK+Zcjn2PfZWA1RNUqBCkYyymR7w9J8lytA=",
"ref": "refs/heads/main",
"rev": "b7e2777f9c91f668a37a91db8a81648793988f00",
"revCount": 3,
"type": "git",
"url": "https://git@githug.xyz/xenia/unambig-path"
},
"original": {
"type": "git",
"url": "https://git@githug.xyz/xenia/unambig-path"
}
},
"unispect": {
"inputs": {
"flake-utils": "flake-utils_4",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1697048433,
"narHash": "sha256-B8Vk8EtPEKYPQqfQzG2IdfDlOGMPISmsQlc3+7MmfDo=",
"ref": "refs/heads/main",
"rev": "da8bf51586beae47282900a6de9691f6c5bccfb0",
"revCount": 7,
"type": "git",
"url": "https://git@githug.xyz/xenia/unispect"
},
"original": {
"type": "git",
"url": "https://git@githug.xyz/xenia/unispect"
}
}
},
"root": "root",
"version": 7
}

56
flake.nix 100644
View File

@ -0,0 +1,56 @@
{
description = "Home Manager configuration of xenia";
inputs = {
# Specify the source of Home Manager and Nixpkgs.
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
kak = {
url = "git+https://githug.xyz/xenia/kakoune.git";
inputs.nixpkgs.follows = "nixpkgs";
};
unispect = {
url = "git+https://git@githug.xyz/xenia/unispect";
inputs.nixpkgs.follows = "nixpkgs";
};
ansi-utils = {
url = "git+https://git@githug.xyz/xenia/ansi-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
unambig-path = {
url = "git+https://git@githug.xyz/xenia/unambig-path";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, home-manager, kak, unispect, ansi-utils, unambig-path }:
let
system = "aarch64-darwin";
pkgs = import nixpkgs { system = system; config.allowUnfree = true; };
xdg-runtime-dir = "/tmp/xdg-rt";
home = import ./home.nix {
kak-pkg = kak.packages.${system}.kak;
unispect = unispect.packages.${system}.unispect;
ansi-utils = ansi-utils.packages.${system};
unambig-path = unambig-path.packages.${system}.unambig-path;
inherit pkgs xdg-runtime-dir;
};
in {
homeConfigurations."xenia" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
home
( import ./mac.nix { emacs = home.programs.emacs.package; inherit pkgs xdg-runtime-dir; } )
];
};
};
}

176
home.nix 100644
View File

@ -0,0 +1,176 @@
{ pkgs, xdg-runtime-dir, kak-pkg, unispect, ansi-utils, unambig-path }:
let
alacritty = import ./alacritty/alacritty.nix pkgs;
kak = import ./kak.nix { kak = kak-pkg; inherit pkgs; };
extras = import ./extras.nix pkgs;
in rec {
home.username = "xenia";
home.homeDirectory = "/Users/xenia";
home.stateVersion = "23.05";
home.packages = with pkgs; extras.all ++ [
# Input packages
unispect
ansi-utils.ansicols
ansi-utils.ansimove
unambig-path
# # Terminal utilities
ripgrep fd bat
watchexec unixtools.watch
htop
fzf
pv
binwalk
ffmpeg yt-dlp
nmap
blahaj
# Programming languages
jq
rink
ghc
( python310.withPackages (ps: with ps; [
ipython numpy matplotlib sympy scipy pwntools z3 tqdm pwntools mypy # (pylsp-mypy.overrideAttrs (old: { doCheck = false; }))
(extras.challtools ps)
]))
( agda.withPackages (ps: with ps; [ standard-library cubical ]) )
# jupyter
# nodePackages.typescript
# nodePackages.typescript-language-server
# rust-analyzer
# # Other stuff
kak-lsp
discord-canary
# libreoffice-bin
fira-code ibm-plex
# nix-tree
];
home.sessionVariables = {
XDG_RUNTIME_DIR = xdg-runtime-dir;
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
programs.alacritty = alacritty;
programs.kakoune = kak;
programs.emacs = {
package = pkgs.emacs;
enable = true;
extraPackages = epkgs: with epkgs; [
vterm bind-key rust-mode lsp-mode company meow agda2-mode haskell-mode
terraform-mode nix-mode insert-kaomoji
];
extraConfig = builtins.readFile ./dotfiles/init.el;
};
programs.zsh = {
enable = true;
package = pkgs.zsh;
history = {
path = "${home.homeDirectory}/.zsh_history";
save = 100000000000000;
size = 100000000000000;
extended = true; # Save timestamps
share = true;
};
localVariables = {
TERM = "xterm-256color";
LC_ALL = "en_US.UTF-8";
ARCHFLAGS = "-arch arm64";
RPROMPT = "";
};
# We put PROMPT in initExtra instead of localVariables.PROMPT because nix puts the string in double quotes, whereas we want single quotes for the command to run each time
initExtra =
''
export PROMPT='$(
BG=172
FG=0
if [ ! -z $NIX_BUILD_CORES ] ; then
BG=56
FG=15
fi
echo -en "%{\033[0m\033[38;5;''${FG}m\033[48;5;''${BG}m%} ";
echo -n "["
${unambig-path}/bin/unambig-path
echo -en "] %T ";
echo -en "%{\033[0m\033[38:5:''${BG}m%}"
echo -en "%{\033[0m%} ";
)'
'' + ''
export EDITOR=${programs.kakoune.package}
''
+ builtins.readFile ./dotfiles/zshrc;
};
programs.direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
programs.tmux = {
enable = true;
escapeTime = 50;
prefix = "C-]";
shell = "${programs.zsh.package}/bin/zsh";
historyLimit = 30000;
sensibleOnTop = false;
extraConfig =
''
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
bind left swap-window -d -t -1
bind right swap-window -d -t +1
set-option -sa terminal-overrides ",xterm*:Tc"
# Status bar options
set-option -g status on
set-option -g status-bg colour235
set-option -g status-fg "#FFC757"
set-option -g status-interval 2
set-option -g status-justify "centre"
set-option -g status-left-length 60
set-option -g status-left " [#S] "
set-option -g status-right " :3 "
set-option -g status-right-length 90
set -g status-interval 1
set-window-option -g window-status-separator "-"
set-window-option -g window-status-current-format " #[fg=#df73ff bold]!![ #{b:pane_current_path}/ ] #{b:window_index} $ #{b:pane_current_command}!! "
set-window-option -g window-status-format " #{b:window_index} [ #{b:pane_current_path}/ ] #{b:pane_current_command} "
set -g mouse on
set-option -g renumber-windows on # Make windows contiguous
'';
};
programs.git = {
enable = true;
aliases = {
s = "status";
lg = "log --graph --branches --all --decorate --pretty=\"%C(magenta)[%C(red)%an%C(magenta) %ad] %C(yellow)%h: %C(green)%s %C(blue)%N\" --date=short";
};
userName = "xenia";
userEmail = "xenia.agda@gmail.com";
ignores = [ "**/.DS_Store" ];
extraConfig = {
init.defaultBranch = "main";
pull.ff = "only";
pull.rebase = true;
core.editor = "${pkgs.emacs}/bin/emacsclient --create-frame --alternate-editor=''";
};
};
}

100
kak.nix 100644
View File

@ -0,0 +1,100 @@
{ pkgs, kak }:
with pkgs; let
kakoune-mirror = kakouneUtils.buildKakounePluginFrom2Nix {
pname = "kakoune-mirror";
version = "latest";
src = fetchFromGitHub {
owner = "Delapouite";
repo = "kakoune-mirror";
rev = "5710635f440bcca914d55ff2ec1bfcba9efe0f15";
sha256 = "sha256-uslx4zZhvjUylrPWvTOugsKYKKpF0EEz1drc1Ckrpjk=";
};
meta.homepage = "https://github.com/Delapouite/kakoune-mirror";
};
ad-hoc-org-mode = kakouneUtils.buildKakounePluginFrom2Nix {
pname = "ad-hoc-org-mode";
version = "latest";
src = fetchFromGitHub {
owner = "loovjo";
repo = "ad-hoc-org-mode";
rev = "e32a5d18cbe9eec244695f9e39277c90d2960147";
sha256 = "sha256-BhyrOVJxbnB0NI3BBLwNTuPc3WgeuJKjuL2CPLqX8jA=";
};
meta.homepage = "https://github.com/loovjo/ad-hoc-org-mode";
};
# NOTE: kak-lsp must be in packages
kakoune-lsp = kakouneUtils.buildKakounePluginFrom2Nix {
pname = "kak-lsp";
version = "latest";
src = fetchFromGitHub {
owner = "kak-lsp";
repo = "kak-lsp";
rev = "v14.2.0";
sha256 = "sha256-U4eqIzvYzUfwprVpPHV/OFPKiBXK4/5z2p8kknX2iME=";
};
meta.homepage = "https://github.com/kak-lsp/kak-lsp/";
};
kak-lsp-config-file = writeText "kak-lsp.toml" ''
snippet_support = true
verbosity = 2
[language.haskell]
filetypes = ["haskell"]
roots = ["Setup.hs", "stack.yaml", "*.cabal"]
command = "hls"
[language.python]
filetypes = ["python"]
roots = ["requirements.txt", "setup.py", ".git", ".hg"]
command = "pylsp"
offset_encoding = "utf-8"
[language.rust]
filetypes = ["rust"]
roots = ["Cargo.toml"]
command = "rust-analyzer"
[language.c]
filetypes = ["c"]
roots = ["compile_commands.json"]
command = "clangd"
'';
kak-lsp-config-line = "set global lsp_cmd \"kak-lsp -s %val{session} --config ${kak-lsp-config-file} --log /tmp/kak-lsp.log\"";
in
{
enable = true;
plugins = with kakounePlugins; [
kakoune-buffers
kakoune-extra-filetypes
kakoune-mirror
ad-hoc-org-mode
kakoune-lsp
];
config = {
colorScheme = "gruvbox-dark";
indentWidth = 4;
ui.assistant = "cat"; # mjau
ui.statusLine = "top";
ui.useBuiltinKeyParser = true;
ui.enableMouse = true;
wrapLines = {
enable = true;
indent = true;
word = true;
};
};
extraConfig = kak-lsp-config-line + "\n" + builtins.readFile ./dotfiles/kakrc ;
} // (if stdenv.isDarwin then { package = kak; } else {}) # package seems to be broken on unix?

39
mac.nix 100644
View File

@ -0,0 +1,39 @@
{ pkgs, xdg-runtime-dir, emacs, ... }:
let
appName = "EmacsClient";
icon = "${emacs}/Applications/Emacs.app/Contents/Resources/Emacs.icns";
emacsclient = pkgs.stdenv.mkDerivation {
name = appName;
src = ./. ;
installPhase = ./emacs_build.sh;
XDG_RUNTIME_DIR = xdg-runtime-dir;
inherit emacs appName icon;
};
in {
home.packages = [ emacsclient ];
# Swap right keys (command, shift and alt) at login
launchd.agents.swap-keys = {
enable = true;
config = {
Label = "swap-keys";
Program = /usr/bin/hidutil;
ProgramArguments = [
"property" "--set" ''
[{
"HIDKeyboardModifierMappingSrc":0x7000000e7,
"HIDKeyboardModifierMappingDst":0x7000000e1,
}, {
"HIDKeyboardModifierMappingSrc":0x7000000e5,
"HIDKeyboardModifierMappingDst":0x7000000e6,
}, {
"HIDKeyboardModifierMappingSrc":0x7000000e6,
"HIDKeyboardModifierMappingDst":0x7000000e3,
}]
''
];
};
};
}