base: Finally, some emacs on darwin (and some other stuff I guess)
This commit is contained in:
parent
5467282626
commit
15586a8f7c
81 changed files with 469 additions and 417 deletions
|
@ -2,7 +2,10 @@
|
|||
|
||||
{
|
||||
imports = [
|
||||
./emacs
|
||||
./nix
|
||||
./phone-push
|
||||
./tmux
|
||||
./zfs
|
||||
./zsh
|
||||
];
|
||||
|
|
323
modules/shared/base/emacs/base-init.el
Normal file
323
modules/shared/base/emacs/base-init.el
Normal file
|
@ -0,0 +1,323 @@
|
|||
;;; init --- My emacs init file
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(eval-when-compile
|
||||
(require 'use-package)
|
||||
(require 'use-package-ensure)
|
||||
(setq use-package-verbose nil)
|
||||
(setq use-package-always-ensure t))
|
||||
|
||||
;; Dependencies that inject `:keywords' into `use-package' should be
|
||||
;; included before all other packages.
|
||||
;; For :diminish in (use-package). Hides minor modes from the status line.
|
||||
(use-package diminish)
|
||||
;; For :general in (use-package). Keybinding management framework.
|
||||
(use-package general
|
||||
:after evil
|
||||
:config
|
||||
(general-evil-setup t)
|
||||
|
||||
(defun chvp--kill-current-buffer ()
|
||||
(interactive)
|
||||
(kill-buffer (current-buffer))
|
||||
)
|
||||
|
||||
;; Create bindings under the leader
|
||||
(general-create-definer lmap
|
||||
:states '(normal visual insert emacs motion)
|
||||
:prefix "SPC"
|
||||
:global-prefix "C-SPC"
|
||||
)
|
||||
|
||||
(nmap "<escape>" 'save-buffer)
|
||||
(lmap
|
||||
"" nil ;; Unbind SPC, I don't use it for navigation anyway.
|
||||
|
||||
"SPC" '(:ignore t :which-key "mode")
|
||||
|
||||
":" '(eval-expression :which-key "eval")
|
||||
|
||||
"b" '(:ignore t :which-key "buffer")
|
||||
"bd" '(chvp--kill-current-buffer :which-key "kill")
|
||||
"br" '(rename-buffer :which-key "rename")
|
||||
|
||||
"f" '(:ignore t :which-key "file")
|
||||
"ff" '(find-file :which-key "find")
|
||||
"fs" '(save-buffer :which-key "save")
|
||||
|
||||
"h" '(:ignore t :which-key "help")
|
||||
"hb" '(describe-bindings :which-key "bindings")
|
||||
"hf" '(describe-function :which-key "function")
|
||||
"hv" '(describe-variable :which-key "variable")
|
||||
|
||||
"q" '(:ignore t :which-key "quit")
|
||||
"qq" '(delete-frame :which-key "quit")
|
||||
|
||||
"s" '(:ignore t :which-key "search")
|
||||
|
||||
"w" '(:ignore t :which-key "window")
|
||||
"wv" '(split-window-vertically :which-key "split vertical")
|
||||
"ws" '(split-window-horizontally :which-key "split horizontal")
|
||||
"wd" '(delete-window :which-key "delete")
|
||||
"w-" '(text-scale-decrease :which-key "decrease font size")
|
||||
"w+" '(text-scale-increase :which-key "increase font size")
|
||||
|
||||
"x" '(execute-extended-command :which-key "exec")
|
||||
)
|
||||
)
|
||||
|
||||
;; Vim keybindings
|
||||
(use-package evil
|
||||
:custom
|
||||
(evil-want-keybinding nil "Disable default evil keybindings, since
|
||||
evil-collection is a superset. See
|
||||
https://github.com/emacs-evil/evil-collection/issues/60.")
|
||||
(evil-want-integration t "Also needed for evil-collection")
|
||||
:config
|
||||
(defalias 'mu4e--main-action-str 'mu4e~main-action-str)
|
||||
(defalias 'mu4e--main-view-queue 'mu4e~main-view-queue)
|
||||
(evil-mode 1)
|
||||
)
|
||||
|
||||
;; Vim keybindings in other packages
|
||||
(use-package evil-collection
|
||||
:after (evil)
|
||||
:diminish (evil-collection-unimpaired-mode)
|
||||
:config (evil-collection-init)
|
||||
)
|
||||
|
||||
;; Easymotion-like jumping
|
||||
(use-package avy
|
||||
:custom
|
||||
(avy-style 'pre "Insert decision characters instead of overwriting")
|
||||
:general
|
||||
(lmap
|
||||
"jc" '(avy-goto-char :which-key "Jump to character")
|
||||
"j2" '(avy-goto-char-2 :which-key "Jump to 2 character sequence")
|
||||
"jl" '(avy-goto-line :which-key "Jump to line number")
|
||||
"jw" '(avy-goto-word-0 :which-key "Jump to word")
|
||||
"js" '(avy-goto-word-1 :which-key "Jump to word starting with character")
|
||||
)
|
||||
)
|
||||
|
||||
;; Better defaults that aren't defaults for some reason.
|
||||
(use-package better-defaults
|
||||
;; But don't enable ido-mode...
|
||||
:config (ido-mode nil)
|
||||
)
|
||||
|
||||
;; Handy completion-at-point-functions
|
||||
(use-package cape
|
||||
:hook
|
||||
(prog-mode . chvp--setup-capfs)
|
||||
(text-mode . chvp--setup-capfs)
|
||||
:config
|
||||
(defun chvp--setup-capfs ()
|
||||
(add-hook 'completion-at-point-functions #'tempel-complete -50 t)
|
||||
(add-hook 'completion-at-point-functions #'cape-file 10 t)
|
||||
(add-hook 'completion-at-point-functions #'cape-dabbrev 15 t)
|
||||
(add-hook 'completion-at-point-functions #'cape-line 20 t)
|
||||
)
|
||||
)
|
||||
|
||||
;; Autocomplete
|
||||
(use-package corfu
|
||||
:diminish (corfu-mode)
|
||||
:custom
|
||||
(corfu-cycle t "Enable cycling through completions")
|
||||
(corfu-auto t "Show completion preview by default")
|
||||
(corfu-auto-prefix 2 "Show completion after two characters")
|
||||
(corfu-quit-no-match t "Space occurs too often in my normal workflow to not quit on no match")
|
||||
;; Only confirm autocompletion with TAB
|
||||
:bind (:map corfu-map ("RET" . nil))
|
||||
:config
|
||||
(global-corfu-mode)
|
||||
)
|
||||
|
||||
(use-package corfu-popupinfo
|
||||
:ensure nil ;; Part of corfu
|
||||
:config (corfu-popupinfo-mode)
|
||||
)
|
||||
|
||||
;; Prescient in corfu
|
||||
(use-package corfu-prescient
|
||||
:after (corfu prescient)
|
||||
:custom (corfu-prescient-enable-filtering nil "Orderless handles filtering")
|
||||
:config (corfu-prescient-mode 1)
|
||||
)
|
||||
|
||||
;; Replacements for emacs built-ins that better integrate with `vertico'.
|
||||
(use-package consult
|
||||
:commands (consult-ripgrep)
|
||||
:general
|
||||
(lmap
|
||||
"bb" '(consult-buffer :which-key "switch")
|
||||
"fr" '(consult-recent-file :which-key "recent")
|
||||
"ha" '(consult-apropos :which-key "apropos")
|
||||
"ss" '(consult-line :which-key "search")
|
||||
)
|
||||
)
|
||||
|
||||
;; General emacs settings
|
||||
(use-package emacs
|
||||
:ensure nil ;; Not a real package, but a place to collect global settings
|
||||
:demand t
|
||||
:hook
|
||||
;; Always display line numbers for text-based modes
|
||||
((text-mode prog-mode) . display-line-numbers-mode)
|
||||
;; Enable basic auto pairs. Maybe replace this with something more
|
||||
;; advanced later? Look into configuring pairs for frequently used
|
||||
;; major modes.
|
||||
((text-mode prog-mode) . electric-pair-mode)
|
||||
;; Always highlight the current line in text modes
|
||||
((text-mode prog-mode) . hl-line-mode)
|
||||
:custom
|
||||
(use-short-answers t "Allow short answers on yes/no prompt")
|
||||
(fill-column 80 "Fill at column 80 instead of 70")
|
||||
(create-lockfiles nil "I'm the only user on my devices and use emacs as a daemon, so don't clutter with lockfiles")
|
||||
(inhibit-startup-screen t "Don't show default startup screen")
|
||||
(comp-deferred-compilation nil "Don't do native-comp at runtime")
|
||||
(project-vc-merge-submodules nil "Don't consider submodules as the same project")
|
||||
:config
|
||||
|
||||
;; Always display column number in mode line
|
||||
(column-number-mode)
|
||||
)
|
||||
|
||||
;; Linting
|
||||
(use-package flycheck
|
||||
:custom (flycheck-checker-error-threshold 10000 "Set error threshold a lot higher")
|
||||
:hook ((text-mode prog-mode) . flycheck-mode)
|
||||
:diminish (flycheck-mode)
|
||||
)
|
||||
|
||||
;; Annotations in selection interface
|
||||
(use-package marginalia
|
||||
:after (vertico)
|
||||
:custom
|
||||
(marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil))
|
||||
:config
|
||||
(marginalia-mode)
|
||||
:general
|
||||
(minibuffer-local-map "M-a" 'marginalia-cycle)
|
||||
)
|
||||
|
||||
;; Theming
|
||||
(use-package catppuccin-theme
|
||||
:custom (catppuccin-flavor 'latte)
|
||||
:config (load-theme 'catppuccin :no-confirm)
|
||||
)
|
||||
|
||||
(use-package no-littering
|
||||
:custom
|
||||
(user-emacs-directory (expand-file-name "~/.cache/emacs/") "Don't put files into .emacs.d")
|
||||
:config
|
||||
;; Also make sure auto-save files are saved out-of-tree
|
||||
(setq auto-save-file-name-transforms `((".*" ,(no-littering-expand-var-file-name "auto-save/") t)))
|
||||
)
|
||||
|
||||
;; Orderless filtering
|
||||
(use-package orderless
|
||||
:after (vertico)
|
||||
:custom
|
||||
(completion-styles '(orderless basic) "Use orderless for filtering")
|
||||
(orderless-matching-styles '(orderless-literal orderless-initialism orderless-prefixes) "More matching styles for more flexible matching.")
|
||||
)
|
||||
|
||||
;; Org
|
||||
(use-package org
|
||||
:hook
|
||||
(org-insert-heading . set-creation-date-heading-property)
|
||||
:custom
|
||||
(org-directory "~/sync/Notes" "Store org journal in synced directory")
|
||||
(org-default-notes-file (concat org-directory "/inbox.org") "Capture in inbox by default")
|
||||
(org-agenda-files '("~/sync/Notes") "Let's say all files can contain events for now")
|
||||
(org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "DOING(i)" "DONE(d)")) "Add next and doing states")
|
||||
(org-log-into-drawer "LOGBOOK" "Log repeated task state changes into drawer named LOGBOOK")
|
||||
:demand t
|
||||
:config
|
||||
(defun find-file-in-org-directory ()
|
||||
(interactive)
|
||||
(ido-find-file-in-dir org-directory)
|
||||
)
|
||||
(defun set-creation-date-heading-property () (org-set-property "CREATED" (format-time-string (org-time-stamp-format t t))))
|
||||
(defun chvp--org-inbox-length ()
|
||||
(length (org-map-entries t t (list (concat org-directory "/inbox.org"))))
|
||||
)
|
||||
(defun chvp--org-inbox-length-modeline ()
|
||||
(let ((org-len (chvp--org-inbox-length)))
|
||||
(if (<= org-len 0) nil
|
||||
(concat "Org inbox: " (propertize (format "%d" org-len) 'face 'error)))))
|
||||
(add-to-list 'global-mode-string '(:eval (chvp--org-inbox-length-modeline)))
|
||||
:general
|
||||
(lmap
|
||||
:keymaps 'org-mode-map
|
||||
"SPC a" '(org-archive-subtree :which-key "Archive subtree")
|
||||
"SPC i" '(org-insert-heading :which-key "Insert heading")
|
||||
"SPC <" '(org-promote-subtree :which-key "Decrease level")
|
||||
"SPC >" '(org-demote-subtree :which-key "Increase level")
|
||||
"SPC c" '(orc-clone-subtree-with-time-shift :which-key "Repeat subtree")
|
||||
"SPC x" '(org-cut-subtree :which-key "Cut subtree")
|
||||
"SPC p" '(org-paste-subtree :which-key "Paste subtree")
|
||||
"SPC t" '(org-todo :which-key "Cycle todo state")
|
||||
)
|
||||
(lmap
|
||||
"o a" '(org-agenda-list :which-key "Agenda")
|
||||
"o t" '(org-todo-list :which-key "Todo list")
|
||||
"o o" '(find-file-in-org-directory :which-key "Find org file")
|
||||
)
|
||||
)
|
||||
|
||||
;; Sorting when filtering
|
||||
(use-package prescient
|
||||
:custom
|
||||
(prescient-aggressive-file-save t "Be aggressive with saving prescient data since we're in daemon mode")
|
||||
(prescient-history-length 100000 "Save a lot of history")
|
||||
(prescient-frequency-threshold 0.00005 "Save a lot of history")
|
||||
:config (prescient-persist-mode 1)
|
||||
)
|
||||
|
||||
;; Rainbow delimiters
|
||||
(use-package rainbow-delimiters
|
||||
:hook (prog-mode . rainbow-delimiters-mode))
|
||||
|
||||
;; Side window with symbols or headline
|
||||
(use-package sr-speedbar
|
||||
:custom
|
||||
(speedbar-use-images nil "Don't use images in speedbar")
|
||||
:general
|
||||
(lmap
|
||||
"wb" '(sr-speedbar-toggle :which-key "Outline bar"))
|
||||
)
|
||||
|
||||
;; Tempel (snippet expansion)
|
||||
(use-package tempel
|
||||
:demand t
|
||||
:after cape
|
||||
;; This is not very nice, but let's just assume that development machines have my nixos-config checked out
|
||||
:custom (tempel-path "~/repos/nixos-config/modules/shared/base/emacs/snippets/*.eld")
|
||||
:general
|
||||
(lmap
|
||||
"t i" '(tempel-insert :which-key "Insert template")
|
||||
)
|
||||
)
|
||||
|
||||
;; List item selection interface
|
||||
(use-package vertico
|
||||
:custom (vertico-count 20 "Allow selector to be a bit higher")
|
||||
:config (vertico-mode)
|
||||
:diminish (vertico-mode)
|
||||
)
|
||||
|
||||
;; Prescient integration in vertico
|
||||
(use-package vertico-prescient
|
||||
:after (vertico prescient)
|
||||
:custom (vertico-prescient-enable-filtering nil "`orderless' manages the filtering part.")
|
||||
:config (vertico-prescient-mode 1))
|
||||
|
||||
;; Show keybindings
|
||||
(use-package which-key
|
||||
:diminish (which-key-mode)
|
||||
:config (which-key-mode)
|
||||
)
|
||||
|
54
modules/shared/base/emacs/default.nix
Normal file
54
modules/shared/base/emacs/default.nix
Normal file
|
@ -0,0 +1,54 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
username = config.chvp.username;
|
||||
in
|
||||
{
|
||||
options.chvp.base.emacs = {
|
||||
basePackage = lib.mkOption {
|
||||
example = pkgs.emacs.pgtk;
|
||||
};
|
||||
extraConfig = lib.mkOption {
|
||||
default = [ ];
|
||||
};
|
||||
extraPackages = lib.mkOption {
|
||||
default = [ ];
|
||||
};
|
||||
fullConfig = lib.mkOption {
|
||||
readOnly = true;
|
||||
default = builtins.readFile ./base-init.el + (lib.concatStringsSep "\n" config.chvp.base.emacs.extraConfig) + ''
|
||||
(provide 'init)
|
||||
;;; init.el ends here
|
||||
'';
|
||||
};
|
||||
package = lib.mkOption {
|
||||
readOnly = true;
|
||||
default = pkgs.emacsWithPackagesFromUsePackage {
|
||||
config = config.chvp.base.emacs.fullConfig;
|
||||
package = config.chvp.base.emacs.basePackage;
|
||||
alwaysEnsure = true;
|
||||
extraEmacsPackages = epkgs: builtins.foldl' (xs: ys: xs ++ ys) [ ] (builtins.map (fun: (fun epkgs)) config.chvp.base.emacs.extraPackages);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
chvp.base.zfs.homeLinks = [
|
||||
{ path = ".cache/emacs"; type = "cache"; }
|
||||
];
|
||||
|
||||
home-manager.users.${username} = { ... }: {
|
||||
home = {
|
||||
file = {
|
||||
".emacs.d/init.el".text = config.chvp.base.emacs.fullConfig;
|
||||
".emacs.d/early-init.el".source = ./early-init.el;
|
||||
};
|
||||
packages = [
|
||||
(pkgs.writeShellScriptBin "emacs" ''${config.chvp.base.emacs.package}/bin/emacsclient -c "$@"'')
|
||||
(pkgs.writeShellScriptBin "emacsclient" ''${config.chvp.base.emacs.package}/bin/emacsclient "$@"'')
|
||||
];
|
||||
sessionVariables = { EDITOR = "emacs"; };
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
32
modules/shared/base/emacs/early-init.el
Normal file
32
modules/shared/base/emacs/early-init.el
Normal file
|
@ -0,0 +1,32 @@
|
|||
;;; early-init --- My emacs early init file
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(defun hm/reduce-gc ()
|
||||
"Reduce the frequency of garbage collection."
|
||||
(setq gc-cons-threshold most-positive-fixnum
|
||||
gc-cons-percentage 0.6))
|
||||
|
||||
(defun hm/restore-gc ()
|
||||
"Restore the frequency of garbage collection."
|
||||
(setq gc-cons-threshold 16777216
|
||||
gc-cons-percentage 0.1))
|
||||
|
||||
;; Make GC more rare during init, while minibuffer is active, and
|
||||
;; when shutting down. In the latter two cases we try doing the
|
||||
;; reduction early in the hook.
|
||||
(hm/reduce-gc)
|
||||
(add-hook 'minibuffer-setup-hook #'hm/reduce-gc -50)
|
||||
(add-hook 'kill-emacs-hook #'hm/reduce-gc -50)
|
||||
|
||||
;; But make it more regular after startup and after closing minibuffer.
|
||||
(add-hook 'emacs-startup-hook #'hm/restore-gc)
|
||||
(add-hook 'minibuffer-exit-hook #'hm/restore-gc)
|
||||
|
||||
;; Nix manages our packages
|
||||
(setq package-enable-at-startup nil)
|
||||
|
||||
;; Avoid expensive frame resizing. Inspired by Doom Emacs.
|
||||
(setq frame-inhibit-implied-resize t)
|
||||
|
||||
(provide 'early-init)
|
||||
;;; early-init.el ends here
|
6
modules/shared/base/emacs/snippets/fundamental.eld
Normal file
6
modules/shared/base/emacs/snippets/fundamental.eld
Normal file
|
@ -0,0 +1,6 @@
|
|||
fundamental-mode
|
||||
|
||||
(today (format-time-string "%Y-%m-%d"))
|
||||
(NOW (format-time-string "<%Y-%0m-%0d %a %H:%0M>"))
|
||||
(yesterday (format-time-string "%Y-%0m-%0d" (time-subtract nil (* 24 60 60))))
|
||||
(tomorrow (format-time-string "%Y-%0m-%0d" (time-add nil (* 24 60 60))))
|
7
modules/shared/base/emacs/snippets/java.eld
Normal file
7
modules/shared/base/emacs/snippets/java.eld
Normal file
|
@ -0,0 +1,7 @@
|
|||
java-mode
|
||||
|
||||
(sout "System.out.println(" r ");")
|
||||
(serr "System.err.println(" r ");")
|
||||
|
||||
(class "public class " p " {" n> q n "}")
|
||||
(main "public static void main(String[] args) {" n> q n "}")
|
49
modules/shared/base/emacs/snippets/mu4e-compose.eld
Normal file
49
modules/shared/base/emacs/snippets/mu4e-compose.eld
Normal file
|
@ -0,0 +1,49 @@
|
|||
mu4e-compose-mode
|
||||
|
||||
(mvg
|
||||
"Met vriendelijke groeten" n
|
||||
"Charlotte Van Petegem"
|
||||
)
|
||||
|
||||
(spelletjesavond-schulden
|
||||
"Dag " p n n
|
||||
"Na de spelletjesavond van vrijdag zou je mij € " q " moeten. Kan je dat overschrijven op BE08 8908 0409 9113? Alvast bedankt!" n n
|
||||
"Groetjes" n
|
||||
"Charlotte"
|
||||
)
|
||||
|
||||
(teacher-reply
|
||||
"Dag " q n n
|
||||
r n
|
||||
"Welkom op Dodona! Zou je het volgende formulier kunnen invullen?" n n
|
||||
"https://dodona.ugent.be/rights_requests/new/" n n
|
||||
"Zo hebben we meteen alle info die we nodig hebben om je lesgeversrechten te geven op Dodona." n n
|
||||
"Met vriendelijke groeten" n
|
||||
"Charlotte Van Petegem"
|
||||
)
|
||||
|
||||
(twist-exam-nag-en
|
||||
"Hi " q n n
|
||||
"A part of being a member of the TWIST department is contributing to exam supervision. Since the department board meeting of september 2022 it was decided to ask a bit more of people who don't contribute or contribute less to education during the semester, to allow the people who have to mark a lot of exams to concentrate on that. You are expected to do 3 supervisions, but as far as I can see that is not the case yet. Can I ask that you register for a number of exam supervisions? You can do so via the following spreadsheet: https://sharepoint.ugent.be/teams/WE02/_layouts/15/WopiFrame2.aspx?sourcedoc=%7BAA66A430-5240-4002-9D47-F6D06CF819AA%7D&file=Examentoezichten.xlsx&action=default&IsList=1&ListId=%7BA2BEB5ED-0C41-4A4B-ADCA-8F7CD56C2BBB%7D&ListItemId=2 (see also the email that was sent to the department mailing list at the end of the semester)." n n
|
||||
"If you received this mail in error, please let me know, then I won't bother you in the future." n n
|
||||
"Kind regards" n
|
||||
"Charlotte Van Petegem"
|
||||
)
|
||||
|
||||
(twist-exam-nag-nl
|
||||
"Dag " q n n
|
||||
"Een deel van lid zijn van de TWIST vakgroep is het bijdragen aan de toezichten bij de examens. Sinds de vakgroepraad van september 2022 is er ook besloten om iets meer te vragen van mensen die minder (of niet) aan onderwijs bijdragen om de mensen met veel verbeterwerk toe te laten om zich daarop te kunnen concentreren. Jij wordt verwacht 3 toezichten te doen, maar voor zover ik kan zien is dat nog niet het geval. Mag ik vragen van je te registreren voor een aantal examentoezichten? Dat kan via de volgende spreadsheet: https://sharepoint.ugent.be/teams/WE02/_layouts/15/WopiFrame2.aspx?sourcedoc=%7BAA66A430-5240-4002-9D47-F6D06CF819AA%7D&file=Examentoezichten.xlsx&action=default&IsList=1&ListId=%7BA2BEB5ED-0C41-4A4B-ADCA-8F7CD56C2BBB%7D&ListItemId=2 (zie ook de mail die op het einde van het semester naar de mailinglijst van de vakgroep werd verstuurd)?" n
|
||||
"Als je deze mail foutief gekregen hebt, laat het mij dan zeker weten, dan val ik je in de toekomst niet meer lastig." n n
|
||||
"Alvast bedankt" n
|
||||
"Met vriendelijke groeten" n
|
||||
"Charlotte Van Petegem"
|
||||
)
|
||||
|
||||
(rode-kruis-vrijwilliger-cursussen
|
||||
"Dag " p n n
|
||||
"Je wil vrijwilliger worden bij het Rode Kruis. Super! Daarom krijg je bij het inschrijven voor de cursussen ook wat voorrang, zodat je je zeker kan inschrijven. Dit zijn de opties:" n n
|
||||
q n n
|
||||
"Kan je een seintje geven wanneer je dit gedaan hebt (of moest het niet passen)? Dan kan ik daarna de mail naar het grote publiek sturen om in te schrijven." n n
|
||||
"Met vriendelijke groeten" n
|
||||
"Charlotte Van Petegem"
|
||||
)
|
14
modules/shared/base/emacs/snippets/python.eld
Normal file
14
modules/shared/base/emacs/snippets/python.eld
Normal file
|
@ -0,0 +1,14 @@
|
|||
python-mode
|
||||
|
||||
(class "class " p ":"
|
||||
n> "\"\"\""
|
||||
n> p
|
||||
n> "\"\"\""
|
||||
n> "def __init__(self" (p ", *args, **kwargs") "):"
|
||||
n> "\"\"\""
|
||||
n> p
|
||||
n> "\"\"\""
|
||||
n> q
|
||||
)
|
||||
|
||||
(def "def " p "(" (p "*args, **kwargs") "):" n> "\"\"\"" n> p n> "\"\"\"" n> q)
|
|
@ -36,7 +36,22 @@ in
|
|||
};
|
||||
|
||||
config = {
|
||||
chvp.base.zfs.homeLinks = (lib.optional config.chvp.base.nix.enableDirenv { path = ".local/share/direnv"; type = "cache"; });
|
||||
chvp.base = {
|
||||
emacs.extraConfig = [
|
||||
''
|
||||
;; Nix syntax support
|
||||
(use-package nix-mode
|
||||
:mode "\\.nix\\'"
|
||||
)
|
||||
''
|
||||
] ++ lib.optional config.chvp.base.nix.enableDirenv ''
|
||||
;; Direnv integration in emacs.
|
||||
(use-package direnv
|
||||
:config (direnv-mode)
|
||||
)
|
||||
'';
|
||||
zfs.homeLinks = (lib.optional config.chvp.base.nix.enableDirenv { path = ".local/share/direnv"; type = "cache"; });
|
||||
};
|
||||
nix = {
|
||||
gc = {
|
||||
automatic = true;
|
||||
|
|
16
modules/shared/base/phone-push/default.nix
Normal file
16
modules/shared/base/phone-push/default.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
username = config.chvp.username;
|
||||
phone-push = pkgs.writeShellScriptBin "phone-push" ''
|
||||
curl $(cat ${config.age.secrets."files/services/phone-push-url".path}) -d "$(hostname): $@"
|
||||
'';
|
||||
in
|
||||
{
|
||||
environment.systemPackages = [ phone-push ];
|
||||
|
||||
age.secrets."files/services/phone-push-url" = {
|
||||
file = ../../../../secrets/files/services/phone-push-url.age;
|
||||
owner = username;
|
||||
};
|
||||
}
|
29
modules/shared/base/tmux/default.nix
Normal file
29
modules/shared/base/tmux/default.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
username = config.chvp.username;
|
||||
base = {
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
clock24 = true;
|
||||
extraConfig = ''
|
||||
bind q kill-session
|
||||
bind v run-shell "tmux setw main-pane-width $(($(tmux display -p '#{window_width}') * 70 / 100)); tmux select-layout main-vertical"
|
||||
bind h run-shell "tmux setw main-pane-height $(($(tmux display -p '#{window_height}') * 70 / 100)); tmux select-layout main-horizontal"
|
||||
|
||||
set -g default-terminal "screen-256color"
|
||||
set -sg escape-time 10
|
||||
'';
|
||||
keyMode = "vi";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.chvp.base.tmux.usersToConfigure = lib.mkOption {
|
||||
default = [ username ];
|
||||
};
|
||||
|
||||
config.home-manager.users = builtins.foldl' (a: b: a // b) { } (
|
||||
builtins.map (name: { "${name}" = base; }) config.chvp.base.tmux.usersToConfigure
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue