Compare commits

..

No commits in common. "deb977de090cd98b9f735321c118c5cabe5d7b24" and "c9617dd3cce9b7b17241a0004f27f9c5ed8315ea" have entirely different histories.

38 changed files with 215 additions and 319 deletions

View File

@ -50,8 +50,6 @@
- docker
- vscode
- javascript
- launch_keyboard
- lvfs
- hosts: nat_dhcp:homeserver_nat_dhcp:mrmanager_nat_dhcp
vars:

View File

@ -1,3 +1,2 @@
.idea
.python-version
.dir-locals.el

View File

@ -1,5 +1,3 @@
(use-package diminish)
;; Eglot recommends pulling the latest of the standard libraries it
;; uses from ELPA if you're not tracking the current emacs development
;; branch.
@ -29,16 +27,18 @@
:config
(dashboard-setup-startup-hook))
(use-package ediff
:config
(setq ediff-window-setup-function 'ediff-setup-windows-plain)
(setq-default ediff-highlight-all-diffs 'nil)
(setq ediff-diff-options "-w"))
(when (version<= "26.0.50" emacs-version )
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
(add-hook 'prog-mode-hook 'column-number-mode)
)
;; Display a horizontal line instead of ^L for page break characters
(use-package page-break-lines
:config
(global-page-break-lines-mode +1)
)
(use-package page-break-lines)
(use-package recentf
;; This is an emacs built-in but we're pulling the latest version

View File

@ -0,0 +1,103 @@
(package-initialize)
(use-package use-package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/")
)
(use-package auto-package-update
:ensure t
:config
(setq auto-package-update-delete-old-versions t
auto-package-update-interval 14)
(auto-package-update-maybe))
(defconst private-dir (expand-file-name "private" user-emacs-directory))
(defconst temp-dir (format "%s/cache" private-dir)
"Hostname-based elisp temp directories")
;; Emacs customizations
(setq-default
inhibit-startup-screen t
initial-scratch-message nil
;; Send prompts to mini-buffer not the GUI
use-dialog-box nil
confirm-nonexistent-file-or-buffer t
save-interprogram-paste-before-kill t
mouse-yank-at-point t
require-final-newline t
visible-bell nil
ring-bell-function 'ignore
;; Write custom variables to an unused file so in-editor changes do not persist.
custom-file "~/.emacs.d/.custom.el"
;; http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html
minibuffer-prompt-properties
'(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)
;; Disable non selected window highlight
cursor-in-non-selected-windows nil
highlight-nonselected-windows nil
;; PATH
exec-path (append exec-path '("/usr/local/bin/"))
indent-tabs-mode nil
tab-width 4
inhibit-startup-message t
fringes-outside-margins t
x-select-enable-clipboard t
use-package-always-ensure t
ispell-program-name "aspell"
browse-url-browser-function 'browse-url-generic
browse-url-generic-program "firefox-developer-edition"
frame-title-format '("" invocation-name ": "(:eval (if (buffer-file-name)
(abbreviate-file-name (buffer-file-name))
"%b")))
;; mouse-wheel-progressive-speed nil ;; Don't accelerate mouse wheel
;; mouse-wheel-scroll-amount '(5 ((shift) . 3))
use-short-answers t
package-native-compile t
delete-selection-mode t
;; Don't show warnings when compiling elisp to native binaries.
native-comp-async-report-warnings-errors 'silent
)
(defun assert-directory (p)
(unless (file-exists-p p) (make-directory p t))
p
)
(assert-directory (concat temp-dir "/auto-save-list/"))
(setq autoload-directory (concat user-emacs-directory (file-name-as-directory "elisp") (file-name-as-directory "autoload")))
(add-to-list 'load-path (assert-directory autoload-directory))
;; Bookmarks
(setq
;; persistent bookmarks
bookmark-save-flag t
bookmark-default-file (concat temp-dir "/bookmarks"))
;; Backups enabled, use nil to disable
(setq
history-length 1000
backup-inhibited nil
make-backup-files nil
auto-save-default nil
auto-save-list-file-name (concat temp-dir "/autosave")
create-lockfiles nil
backup-directory-alist `((".*" . ,(concat temp-dir "/backup/")))
auto-save-file-name-transforms `((".*" ,(concat temp-dir "/auto-save-list/") t)))
;; Disable toolbar & menubar
(menu-bar-mode -1)
(when (fboundp 'tool-bar-mode)
(tool-bar-mode -1))
(when ( fboundp 'scroll-bar-mode)
(scroll-bar-mode -1))
(context-menu-mode +1)
;; Delete trailing whitespace before save
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(use-package diminish)
(provide 'base)
;;; base ends here

View File

@ -7,8 +7,6 @@
;; M-?
;; ([remap xref-find-references] . lsp-ui-peek-find-references)
("C-c C-a" . eglot-code-actions)
;; C-M-.
([remap xref-find-apropos] . #'consult-eglot-symbols)
)
:hook (
(eglot-managed-mode . (lambda ()
@ -18,19 +16,27 @@
))
)
:config
(fset #'jsonrpc--log-event #'ignore) ;; Disable logging LSP traffic for performance boost
;; Increase garbage collection threshold for performance (default 800000)
(setq gc-cons-threshold 100000000)
;; Increase amount of data read from processes, default 4k
(when (>= emacs-major-version 27)
(setq read-process-output-max (* 1024 1024)) ;; 1mb
)
(set-face-attribute 'eglot-highlight-symbol-face nil :background "#0291a1" :foreground "black")
(set-face-attribute 'eglot-mode-line nil :inherit 'mode-line :bold nil)
(use-package consult-eglot
:bind (
:map eglot-mode-map
;; C-M-.
([remap xref-find-apropos] . #'consult-eglot-symbols)
)
)
:custom
(eglot-autoshutdown t "Shut down server when last buffer is killed.")
(eglot-sync-connect 0 "Don't block on language server starting.")
(eglot-send-changes-idle-time 0.1)
)
(use-package consult-eglot
:commands (consult-eglot-symbols)
)
(provide 'common-lsp)

View File

@ -1,25 +0,0 @@
(setq gc-cons-threshold 100000000) ;; Increase garbage collection threshold for performance (default 800000)
;; Increase amount of data read from processes, default 4k
(when (>= emacs-major-version 27)
(setq read-process-output-max (* 1024 1024)) ;; 1mb
)
;; Suppress warnings
(setq byte-compile-warnings '(not obsolete))
(setq warning-suppress-log-types '((comp) (bytecomp)))
(setq native-comp-async-report-warnings-errors 'silent)
;; Set up default visual settings
(setq frame-resize-pixelwise t)
;; Disable toolbar & menubar
(menu-bar-mode -1)
(when (fboundp 'tool-bar-mode)
(tool-bar-mode -1))
(when (display-graphic-p)
(context-menu-mode +1))
(setq default-frame-alist '((fullscreen . maximized)
(vertical-scroll-bars . nil)
(horizontal-scroll-bars . nil)
;; Set dark colors in early-init to prevent flashes of white.
(background-color . "#000000")))

View File

@ -1,69 +0,0 @@
(package-initialize)
(use-package use-package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/")
)
(use-package auto-package-update
:ensure t
:config
(setq auto-package-update-delete-old-versions t
auto-package-update-interval 14)
(auto-package-update-maybe))
(defun assert-directory (p)
(unless (file-exists-p p) (make-directory p t))
p
)
(defconst private-dir (expand-file-name "private" user-emacs-directory))
(defconst temp-dir (format "%s/cache" private-dir)
"Hostname-based elisp temp directories")
(assert-directory (concat temp-dir "/auto-save-list/"))
(setq autoload-directory (concat user-emacs-directory (file-name-as-directory "elisp") (file-name-as-directory "autoload")))
(add-to-list 'load-path (assert-directory autoload-directory))
(setq-default
;; Disable backup files and lockfiles
make-backup-files nil
auto-save-default nil
create-lockfiles nil
;; Unless otherwise specified, always install packages if they are absent.
use-package-always-ensure t
;; Point custom-file at /dev/null so emacs does not write any settings to my dotfiles.
custom-file "/dev/null"
;; Don't pop up a small window at the bottom of emacs at launch.
inhibit-startup-screen t
inhibit-startup-message t
;; Give the scratch buffer a clean slate.
initial-major-mode 'fundamental-mode
initial-scratch-message nil
;; Send prompts to mini-buffer not the GUI
use-dialog-box nil
;; End files with line break
require-final-newline t
;; Use spaces, not tabs
indent-tabs-mode nil
;; Use a better frame title
frame-title-format '("" invocation-name ": "(:eval (if (buffer-file-name)
(abbreviate-file-name (buffer-file-name))
"%b")))
;; Use 'y' or 'n' instead of 'yes' or 'no'
use-short-answers t
;; Natively compile packages
package-native-compile t
;; Typed text replaces selection
delete-selection-mode t
;; Confirm when opening a file that does not exist
confirm-nonexistent-file-or-buffer t
)
;; (setq-default fringes-outside-margins t)
(pixel-scroll-precision-mode)
;; Delete trailing whitespace before save
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(provide 'base)

View File

@ -1,89 +0,0 @@
(require 'common-lsp)
(require 'util-tree-sitter)
(defun locate-rust-analyzer ()
"Find rust-analyzer."
(let ((rust-analyzer-paths (list (locate-rust-analyzer-rustup) (locate-rust-analyzer-ansible-built) (locate-rust-analyzer-in-path))))
(let ((first-non-nil-path (seq-find (lambda (elt) elt) rust-analyzer-paths)))
first-non-nil-path
)
)
)
(defun locate-rust-analyzer-rustup ()
"Find rust-analyzer through rustup."
(run-command-in-directory nil "rustup" "which" "rust-analyzer")
)
(defun locate-rust-analyzer-ansible-built ()
"Find rust-analyzer where the ansible playbook built it."
(let ((rust-analyzer-path "/opt/rust-analyzer/target/release/rust-analyzer"))
(when (file-exists-p rust-analyzer-path)
rust-analyzer-path
)
)
)
(defun locate-rust-analyzer-in-path ()
"Find rust-analyzer in $PATH."
(executable-find "rust-analyzer")
)
(use-package rust-ts-mode
:pin manual
:mode (
("\\.rs\\'" . rust-ts-mode)
)
:commands (rust-ts-mode)
:hook (
(rust-ts-mode . (lambda ()
(eglot-ensure)
(let ((rust-analyzer-command (locate-rust-analyzer)))
(when rust-analyzer-command
;; (add-to-list 'eglot-server-programs `(rust-ts-mode . (,rust-analyzer-command)))
(add-to-list 'eglot-server-programs `(rust-ts-mode . (,rust-analyzer-command :initializationOptions (:imports (:granularity (:enforce t :group "item")
:merge (:glob nil)
:prefix "self")
:inlayHints (:maxLength nil)
:workspace (:symbol (:search (:limit 1024)))))))
)
)
(add-hook 'before-save-hook 'eglot-format-buffer nil 'local)
))
)
:init
(add-to-list 'major-mode-remap-alist '(rust-mode . rust-ts-mode))
(add-to-list 'treesit-language-source-alist '(rust "https://github.com/tree-sitter/tree-sitter-rust"))
(unless (treesit-ready-p 'yaml) (treesit-install-language-grammar 'rust))
:config
;; Add keybindings for interacting with Cargo
(use-package cargo
:hook (rust-ts-mode . cargo-minor-mode))
)
(use-package toml-ts-mode
:ensure nil
:pin manual
:mode (
("\\.toml\\'" . toml-ts-mode)
)
:commands (toml-ts-mode)
:init
(add-to-list 'treesit-language-source-alist '(toml "https://github.com/tree-sitter/tree-sitter-toml"))
(unless (treesit-ready-p 'toml) (treesit-install-language-grammar 'toml))
)
;; Set additional rust-analyzer settings:
;;
;; (add-to-list 'eglot-server-programs `(rust-ts-mode . (,rust-analyzer-command :initializationOptions (:cargo (:features "all")))))
;;
;; In addition to the above, directory-specific settings can be written to a .dir-locals.el with the contents:
;;
;; (
;; (rust-ts-mode . ((eglot-workspace-configuration
;; . (:rust-analyzer (:cargo (:noDefaultFeatures t :features ["compare" "tracing"]))))
;; ))
;; )
(provide 'lang-rust)

View File

@ -2,7 +2,7 @@
(use-package bash-ts-mode
:ensure nil
:commands (bash-ts-mode)
:commands bash-ts-mode
:init
(add-to-list 'major-mode-remap-alist '(sh-mode . bash-ts-mode))
(add-to-list 'treesit-language-source-alist '(bash "https://github.com/tree-sitter/tree-sitter-bash"))

View File

@ -0,0 +1,66 @@
(require 'common-lsp)
(require 'util-tree-sitter)
(defun locate-rust-analyzer ()
"Find rust-analyzer."
(let ((rust-analyzer-paths (list (locate-rust-analyzer-rustup) (locate-rust-analyzer-ansible-built))))
(let ((first-non-nil-path (seq-find (lambda (elt) elt) rust-analyzer-paths)))
first-non-nil-path
)
)
)
(defun locate-rust-analyzer-rustup ()
"Find rust-analyzer through rustup."
(run-command-in-directory nil "rustup" "which" "rust-analyzer")
)
(defun locate-rust-analyzer-ansible-built ()
"Find rust-analyzer where the ansible playbook built it."
(let ((rust-analyzer-path "/opt/rust-analyzer/target/release/rust-analyzer"))
(when (file-exists-p rust-analyzer-path)
rust-analyzer-path
)
)
)
(use-package rust-ts-mode
:pin manual
:mode (
("\\.rs\\'" . rust-ts-mode)
)
:hook (
(rust-ts-mode . (lambda ()
(eglot-ensure)
(let ((rust-analyzer-command (locate-rust-analyzer)))
(when rust-analyzer-command
(add-to-list 'eglot-server-programs (cons 'rust-ts-mode (list rust-analyzer-command)))
)
)
(add-hook 'before-save-hook 'eglot-format-buffer nil 'local)
))
)
:init
(add-to-list 'major-mode-remap-alist '(rust-mode . rust-ts-mode))
(add-to-list 'treesit-language-source-alist '(rust "https://github.com/tree-sitter/tree-sitter-rust"))
(unless (treesit-ready-p 'yaml) (treesit-install-language-grammar 'rust))
:config
;; Add keybindings for interacting with Cargo
(use-package cargo
:hook (rust-ts-mode . cargo-minor-mode))
)
(use-package toml-ts-mode
:ensure nil
:pin manual
:mode (
("\\.toml\\'" . toml-ts-mode)
)
:commands (toml-ts-mode)
:init
(add-to-list 'treesit-language-source-alist '(toml "https://github.com/tree-sitter/tree-sitter-toml"))
(unless (treesit-ready-p 'toml) (treesit-install-language-grammar 'toml))
)
(provide 'lang-rust)

View File

@ -12,7 +12,6 @@
("environments/[^/]*/group_vars/[^/]*\\'" . yaml-ts-mode)
("environments/[^/]*/host_vars/[^/]*\\'" . yaml-ts-mode)
)
:commands (yaml-ts-mode)
:hook (
(yaml-ts-mode . (lambda ()
(add-hook 'before-save-hook 'yaml-format-buffer nil 'local)

View File

@ -2,7 +2,7 @@
package:
name:
- aspell-en
- emacs-wayland
- emacs
state: present
- name: Install packages

View File

@ -22,8 +22,6 @@
loop:
- src: init.el
dest: .emacs.d/init.el
- src: early-init.el
dest: .emacs.d/early-init.el
- name: Configure dotfiles
when: 'emacs_flavor == "plain"'
@ -40,13 +38,31 @@
- name: Configure elisp files
when: 'emacs_flavor == "full"'
copy:
src: "files/{{ item.src }}"
dest: "{{ account_homedir.stdout }}/{{ item.dest }}"
src: "files/{{ item }}"
dest: "{{ account_homedir.stdout }}/.emacs.d/elisp/{{ item }}"
mode: 0600
owner: "{{ account_name.stdout }}"
group: "{{ group_name.stdout }}"
loop:
- src: elisp
dest: .emacs.d/
- base-extensions.el
- base-functions.el
- base-global-keys.el
- base-theme.el
- base.el
- common-lsp.el
- lang-bash.el
- lang-dockerfile.el
- lang-go.el
- lang-javascript.el
- lang-lua.el
- lang-markdown.el
- lang-org.el
- lang-python.el
- lang-rust.el
- lang-terraform.el
- lang-yaml.el
- util-vertico.el
- util-tree-sitter.el
- name: Configure zshrc additional imports
copy:

View File

@ -1,15 +0,0 @@
- import_tasks: tasks/freebsd.yaml
when: 'os_flavor == "freebsd"'
- import_tasks: tasks/linux.yaml
when: 'os_flavor == "linux"'
- include_tasks:
file: tasks/peruser.yaml
apply:
become: yes
become_user: "{{ initialize_user }}"
when: users is defined
loop: "{{ users | dict2items | community.general.json_query('[?value.initialize==`true`].key') }}"
loop_control:
loop_var: initialize_user

View File

@ -1,5 +0,0 @@
# - name: Install packages
# package:
# name:
# - foo
# state: present

View File

@ -1,24 +0,0 @@
- name: Build aur packages
register: buildaur
become_user: "{{ build_user.name }}"
command: "aurutils-sync --no-view {{ item }}"
args:
creates: "/var/cache/pacman/custom/{{ item }}-*.pkg.tar.*"
loop:
- system76-keyboard-configurator
- name: Update cache
when: buildaur.changed
pacman:
name: []
state: present
update_cache: true
- name: Install packages
package:
name:
- dfu-programmer # For flashing keyboard https://support.system76.com/articles/launch_2-firmware-update/
- avrdude # For flashing keyboard https://support.system76.com/articles/launch_2-firmware-update/
- lxqt-policykit # Need a polkit agent to launch the keyboard configurator
- system76-keyboard-configurator
state: present

View File

@ -1,2 +0,0 @@
- import_tasks: tasks/common.yaml
when: install_graphics

View File

@ -1,29 +0,0 @@
- include_role:
name: per_user
# - name: Create directories
# file:
# name: "{{ account_homedir.stdout }}/{{ item }}"
# state: directory
# mode: 0700
# owner: "{{ account_name.stdout }}"
# group: "{{ group_name.stdout }}"
# loop:
# - ".config/foo"
# - name: Copy files
# copy:
# src: "files/{{ item.src }}"
# dest: "{{ account_homedir.stdout }}/{{ item.dest }}"
# mode: 0600
# owner: "{{ account_name.stdout }}"
# group: "{{ group_name.stdout }}"
# loop:
# - src: foo.conf
# dest: .config/foo/foo.conf
- import_tasks: tasks/peruser_freebsd.yaml
when: 'os_flavor == "freebsd"'
- import_tasks: tasks/peruser_linux.yaml
when: 'os_flavor == "linux"'

View File

@ -1,5 +0,0 @@
- import_tasks: tasks/freebsd.yaml
when: 'os_flavor == "freebsd"'
- import_tasks: tasks/linux.yaml
when: 'os_flavor == "linux"'

View File

@ -1,5 +0,0 @@
# - name: Install packages
# package:
# name:
# - foo
# state: present

View File

@ -1,14 +0,0 @@
- name: Install packages
package:
name:
- fwupd
- gnome-firmware
state: present
- name: Enable services
systemd:
enabled: yes
name: "{{ item }}"
daemon_reload: yes
loop:
- fwupd.service

View File

@ -1,2 +0,0 @@
- import_tasks: tasks/common.yaml
# when: foo is defined

View File

@ -1,9 +1,2 @@
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="1038", ATTR{idProduct}=="1832", TEST=="power/autosuspend" ATTR{power/autosuspend}="-1"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="308f", ATTR{idProduct}=="0011", TEST=="power/autosuspend" ATTR{power/autosuspend}="-1"
# Launch keyboard
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="3384", ATTR{idProduct}=="0006", TEST=="power/autosuspend" ATTR{power/autosuspend}="-1"
# DFU Programmer on launch keyboard
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="03eb", ATTR{idProduct}=="2ff9", TEST=="power/autosuspend" ATTR{power/autosuspend}="-1"
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="03eb", ATTR{idProduct}=="2ff9", TAG+="uaccess"