This commit is contained in:
Mateusz Słodkowicz 2024-11-27 13:46:39 +01:00
parent 434aae4ac5
commit a69bbcbf6a
Signed by: materus
GPG Key ID: 28D140BCA60B4FD1
6 changed files with 238 additions and 80 deletions

View File

@ -1,15 +1,44 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
let
mainMirror = "https://ftp.icm.edu.pl/pub/Linux/dist/archlinux";
extraMirrors = [ ];
getty = [ 6 7 ];
ttys = [ 6 7 8 ] ++ getty;
getty = [
6
7
];
ttys = [
6
7
8
] ++ getty;
startPkgs = lib.strings.concatStringsSep " " [ "base" "base-devel" "dbus" "less" "nano" "bash-completion" ];
startPkgs = lib.strings.concatStringsSep " " [
"base"
"base-devel"
"dbus"
"less"
"nano"
"bash-completion"
];
scripts = {
preStart = pkgs.writeShellScript "arch-pre-start" ''
if [ ! -d "/var/lib/machines/archlinux" ]; then
export PATH=''${PATH:+''${PATH}:}${lib.strings.makeBinPath (with pkgs; [ wget coreutils-full gnutar zstd ]) }
export PATH=''${PATH:+''${PATH}:}${
lib.strings.makeBinPath (
with pkgs;
[
wget
coreutils-full
gnutar
zstd
]
)
}
ARCH_IMAGE=$(mktemp)
trap 'rm $ARCH_IMAGE' EXIT
@ -35,7 +64,11 @@ let
pacman -Syu --noconfirm
systemctl disable getty@tty1.service
${lib.strings.concatStringsSep "\n" (lib.lists.forEach getty (x: "systemctl enable getty@tty${builtins.toString x}.service"))}
${
lib.strings.concatStringsSep "\n" (
lib.lists.forEach getty (x: "systemctl enable getty@tty${builtins.toString x}.service")
)
}
"
@ -51,13 +84,12 @@ in
SystemCallFilter = [ "@known" ];
Timezone = "bind";
Capability = "all";
PrivateUsers="no";
PrivateUsers = "no";
ResolvConf = "copy-host";
};
filesConfig = {
BindReadOnly = [
"/etc/resolv.conf:/etc/resolv.conf"
"/nix"
"/run/current-system"
@ -93,7 +125,11 @@ in
preStart = "${scripts.preStart}";
overrideStrategy = "asDropin";
serviceConfig = {
DeviceAllow = [ "char-tty rwm" "char-input rwm" "char-drm rwm" ];
DeviceAllow = [
"char-tty rwm"
"char-input rwm"
"char-drm rwm"
];
};
};
}

View File

@ -41,9 +41,7 @@ let
which-key
iedit
hideshowvis
evil
perspective
treemacs-evil
treemacs
treemacs-perspective
treemacs-nerd-icons
@ -81,7 +79,7 @@ let
org-roam-ui
org-review
org-present
org-superstar
org-modern
org-auto-tangle
visual-fill-column
csharp-mode
@ -100,6 +98,7 @@ let
bash-completion
eldoc-box
yasnippet
yasnippet-capf
async
request
markdown-ts-mode
@ -128,14 +127,15 @@ let
scroll-restore
highlight-indent-guides
diff-hl
transient
embark
embark-consult
ef-themes
# Completions & Minibuffer
corfu
corfu-terminal
kind-icon
cape
embark
embark-consult
orderless
vertico
marginalia
@ -167,7 +167,9 @@ let
jdk
gradle
fpc
nodejs
omnisharp-roslyn
texlive.combined.scheme-basic
];
};
@ -175,6 +177,7 @@ let
setNixInit = ''
(defvar lsp-java-configuration-runtimes nil)
(setq dap-lldb-debug-program '("${pkgs.llvmPackages.lldb}/bin/lldb-vscode"))
(setq lsp-java-configuration-runtimes '[(:name "JavaSE-1.8"
:path "${pkgs.jdk8}/lib/openjdk/")
(:name "JavaSE-17"

View File

@ -158,6 +158,9 @@ in
bindkey "^[[1;5A" history-substring-search-up-prefixed
bindkey "^[[1;5B" history-substring-search-down-prefixed
bindkey '^[[3~' delete-char
bindkey '^[[3;2~' delete-word
zsh-private() {
__MATERUS_HM_ZSH_PRIVATE=1 ${lib.getExe config.programs.zsh.package}
}

View File

@ -2,14 +2,13 @@
#+AUTHOR: materus
#+DESCRIPTION: materus emacs configuration
#+STARTUP: overview
#+PROPERTY: EMACS-DIR: "./"
#+PROPERTY: EMACS-DIR: ./
#+PROPERTY: header-args :tangle (concat (org-entry-get nil "EMACS-DIR" t) "etc/materus/emacs-config.el") :comments link
#+OPTIONS: \n:t
#+auto_tangle: t
My emacs config, tangled file is [[file:etc/materus/emacs-config.el][there]]
* Table of Contents :noexport:TOC_3:
- [[#init-files][Init Files]]
- [[#early-init][Early Init]]
@ -48,6 +47,7 @@ My emacs config, tangled file is [[file:etc/materus/emacs-config.el][there]]
- [[#perspective][Perspective]]
- [[#programming][Programming]]
- [[#lsp][LSP]]
- [[#dap][DAP]]
- [[#nix][Nix]]
- [[#emacs-lisp][Emacs Lisp]]
- [[#cc][C/C++]]
@ -55,6 +55,8 @@ My emacs config, tangled file is [[file:etc/materus/emacs-config.el][there]]
- [[#java][Java]]
- [[#other][Other]]
- [[#keybindings][Keybindings]]
- [[#keys][Keys]]
- [[#cua-overrides][CUA Overrides]]
- [[#snippets][Snippets]]
- [[#yasnippet-init][Yasnippet init]]
- [[#other-1][Other]]
@ -171,6 +173,7 @@ Sets up package.el
#+begin_src emacs-lisp :comments no
;;; -*- lexical-binding: t; -*-
#+end_src
#+begin_src emacs-lisp
(setq-default materus/use-nix-packages (require 'materus-config nil 'noerror))
(require 'cl-lib)
@ -211,9 +214,11 @@ Some defvar so native-compile wont complain
Package manager config if not using nix.
After some testing default package manager works best for me.
** Init package manager config
#+begin_src emacs-lisp
#+end_src
#+end_src
** Packages list & function
Packages to install
#+begin_src emacs-lisp
@ -338,6 +343,7 @@ Packages to install
(unless materus/use-nix-packages
(materus/install-packages))
#+end_src
* Configuration
General configurations of packages modes etc.
** No Littering
@ -370,7 +376,8 @@ Graphical related settings.
(when (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame) (when (= (length (frame-list)) 2)
(set-frame-parameter frame 'fullscreen 'maximized)))))
(set-frame-parameter frame 'fullscreen 'maximized))
(select-frame-set-input-focus frame) )))
(when (display-graphic-p)
@ -388,7 +395,7 @@ Graphical related settings.
(setq window-divider-default-right-width 1)
(window-divider-mode 1)
(setq-default cursor-type '(bar . 1))
(setq-default cursor-type '(bar . 2))
;; Rainbow mode
(use-package rainbow-mode
:hook
@ -476,7 +483,8 @@ Graphical related settings.
#+end_src
** Org-mode
Org mode settings
#+begin_src emacs-lisp
#+begin_SRC emacs-lisp
(use-package org
:mode (("\\.org$" . org-mode))
:hook
@ -494,22 +502,23 @@ Org mode settings
(if
(char-equal c ?<) t (,electric-pair-inhibit-predicate c)))))))
(use-package org-superstar
(use-package org-modern
:after (org)
:hook
(org-mode . org-superstar-mode))
(org-indent-mode . org-modern-mode)
(org-agenda-finalize . org-modern-agenda)
:config
(setq org-superstar-leading-bullet " ")
(setq org-modern-block-name '("▼ " . "▲ ")))
(use-package org-auto-tangle
:after (org)
:hook (org-mode . org-auto-tangle-mode))
:hook (org-mode . org-auto-tangle-mode)
)
(use-package toc-org
:after (org)
:hook
((org-mode . toc-org-mode )
(markdown-mode . toc-org-mode)))
#+end_src
#+end_SRC
** Completions
*** Style
#+begin_src emacs-lisp
@ -593,11 +602,16 @@ Org mode settings
:config
(add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
(global-completion-preview-mode 1)
#+end_src
** Terms
*** Eat
#+begin_src emacs-lisp
(use-package eat)
(defvar cua--eat-semi-char-keymap (copy-keymap cua--cua-keys-keymap) "EAT semi-char mode CUA keymap")
(defvar cua--eat-char-keymap (copy-keymap cua--cua-keys-keymap) "EAT char mode CUA keymap")
#+end_src
** Miscellaneous
Other configs
@ -680,7 +694,8 @@ Other configs
(use-package lsp-mode
:custom
(lsp-completion-provider :none) ;; we use Corfu!
:config
(require 'lsp-ui)
:init
(defun materus/orderless-dispatch-flex-first (_pattern index _total)
(and (eq index 0) 'orderless-flex))
@ -697,10 +712,6 @@ Other configs
(lsp-completion-mode . materus/lsp-mode-setup-completion))
(use-package lsp-ui)
(use-package dap-mode)
(use-package dap-lldb)
(use-package dap-gdb-lldb)
(setq read-process-output-max (* 1024 1024 3))
@ -736,7 +747,18 @@ Other configs
orig-result)))
(advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command)
#+end_src
** DAP
#+begin_src emacs-lisp
(use-package dap-mode
:config
(require 'dap-lldb)
(require 'dap-gdb-lldb)
(require 'dap-cpptools)
(setq dap-gdb-lldb-extension-version "0.27.0")
(dap-auto-configure-mode 1)
)
#+end_src
** Nix
#+begin_src emacs-lisp
(use-package nix-mode)
@ -828,39 +850,82 @@ Other configs
(add-hook 'prog-mode-hook 'electric-indent-local-mode)
#+end_src
* Keybindings
** Keys
#+begin_src emacs-lisp
(use-package cua-base)
;;; Keybinds
;; Eat Term
(keymap-set eat-semi-char-mode-map "C-v" #'eat-yank)
(keymap-set eat-char-mode-map "C-V" #'eat-yank)
(define-key cua--eat-semi-char-keymap (kbd "C-v") #'eat-yank)
(define-key cua--eat-char-keymap (kbd "C-S-v") #'eat-yank)
(define-key eat-mode-map (kbd "C-<right>") #'eat-self-input)
(define-key eat-mode-map (kbd "C-<left>") #'eat-self-input)
;; perspective
(global-set-key (kbd "C-x C-b") 'persp-list-buffers)
(global-set-key (kbd "C-x C-B") 'list-buffers)
(global-set-key (kbd "C-x b") 'persp-switch-to-buffer)
(global-set-key (kbd "C-x B") 'consult-buffer)
(define-key global-map (kbd "C-x C-b") 'persp-list-buffers)
(define-key global-map (kbd "C-x C-B") 'list-buffers)
(define-key global-map (kbd "C-x b") 'persp-switch-to-buffer)
(define-key global-map (kbd "C-x B") 'consult-buffer)
;; CUA-like global
(define-key global-map (kbd "C-s") 'save-buffer)
(define-key global-map (kbd "C-r") 'query-replace)
(define-key global-map (kbd "C-S-r") 'replace-string)
(define-key global-map (kbd "M-r") 'query-replace-regexp)
(define-key global-map (kbd "M-S-r") 'replace-regexp)
(define-key global-map (kbd "C-a") 'mark-whole-buffer)
(define-key global-map (kbd "C-f") 'isearch-forward)
(define-key global-map (kbd "C-S-f") 'isearch-backward)
(define-key isearch-mode-map (kbd "C-f") 'isearch-repeat-forward)
(define-key isearch-mode-map (kbd "C-S-f") 'isearch-repeat-backward)
(define-key global-map (kbd "M-f") 'consult-ripgrep)
(define-key global-map (kbd "C-M-f") 'consult-find)
;; CUA
(keymap-set cua--cua-keys-keymap "C-z" 'undo-tree-undo)
(keymap-set cua--cua-keys-keymap "C-y" 'undo-tree-redo)
(define-key cua--cua-keys-keymap (kbd "C-z") 'undo-tree-undo)
(define-key cua--cua-keys-keymap (kbd "C-y") 'undo-tree-redo)
(define-key cua-global-keymap (kbd "C-SPC") 'completion-at-point)
(define-key cua-global-keymap (kbd "C-M-SPC") 'cua-set-mark)
(cua-mode 1)
;; TAB
(keymap-set global-map "C-<iso-lefttab>" #'indent-rigidly-left-to-tab-stop)
(keymap-set global-map "C-<tab>" #'indent-rigidly-right-to-tab-stop)
(define-key global-map (kbd "C-<iso-lefttab>") #'indent-rigidly-left)
(define-key global-map (kbd "C-<tab>") #'indent-rigidly-right)
;; Dashboard
(define-key dashboard-mode-map (kbd "C-r") #'dashboard-refresh-buffer)
;; Hyper
(define-key key-translation-map (kbd "<XF86Calculator>") 'event-apply-hyper-modifier )
(define-key key-translation-map (kbd "<Calculator>") 'event-apply-hyper-modifier )
(define-key key-translation-map (kbd "∇") 'event-apply-hyper-modifier )
;; Treemacs
(define-key global-map (kbd "C-H-t") 'treemacs)
(global-set-key (kbd "C-H-t") 'treemacs)
;; Unbind
(define-key isearch-mode-map (kbd "C-s") nil)
(define-key isearch-mode-map (kbd "C-r") nil)
#+end_src
** CUA Overrides
#+begin_src emacs-lisp
(defun cua--eat-semi-char-override-keymap ()
(setq-local cua--keymap-alist (copy-tree cua--keymap-alist))
(setf (alist-get 'cua--ena-cua-keys-keymap cua--keymap-alist) cua--eat-semi-char-keymap))
(defun cua--eat-char-override-keymap ()
(setq-local cua--keymap-alist (copy-tree cua--keymap-alist))
(setf (alist-get 'cua--ena-cua-keys-keymap cua--keymap-alist) cua--eat-char-keymap))
(advice-add 'eat-semi-char-mode :after #'cua--eat-semi-char-override-keymap)
(advice-add 'eat-char-mode :after #'cua--eat-char-override-keymap)
;(add-hook 'eat-char-mode-hook #'cua--eat-char-override-keymap)
#+end_src
* Snippets
** Yasnippet init
#+begin_src emacs-lisp
(use-package yasnippet
:config (yas-global-mode 1))
#+end_src
* Other
** Update config script
#+begin_src emacs-lisp

View File

@ -165,7 +165,8 @@
(when (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame) (when (= (length (frame-list)) 2)
(set-frame-parameter frame 'fullscreen 'maximized)))))
(set-frame-parameter frame 'fullscreen 'maximized))
(select-frame-set-input-focus frame) )))
(when (display-graphic-p)
@ -183,7 +184,7 @@
(setq window-divider-default-right-width 1)
(window-divider-mode 1)
(setq-default cursor-type '(bar . 1))
(setq-default cursor-type '(bar . 2))
;; Rainbow mode
(use-package rainbow-mode
:hook
@ -287,15 +288,17 @@
(if
(char-equal c ?<) t (,electric-pair-inhibit-predicate c)))))))
(use-package org-superstar
(use-package org-modern
:after (org)
:hook
(org-mode . org-superstar-mode))
:config
(setq org-superstar-leading-bullet " ")
(org-indent-mode . org-modern-mode)
(org-agenda-finalize . org-modern-agenda)
:config
(setq org-modern-block-name '("" . "")))
(use-package org-auto-tangle
:after (org)
:hook (org-mode . org-auto-tangle-mode))
:hook (org-mode . org-auto-tangle-mode)
)
(use-package toc-org
:after (org)
:hook
@ -382,10 +385,14 @@
(use-package kind-icon
:config
(add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
(global-completion-preview-mode 1)
;; Code completion:1 ends here
;; [[file:../../emacs-materus-config.org::*Eat][Eat:1]]
(use-package eat)
(defvar cua--eat-semi-char-keymap (copy-keymap cua--cua-keys-keymap) "EAT semi-char mode CUA keymap")
(defvar cua--eat-char-keymap (copy-keymap cua--cua-keys-keymap) "EAT char mode CUA keymap")
;; Eat:1 ends here
;; [[file:../../emacs-materus-config.org::*Defaults][Defaults:1]]
@ -464,7 +471,8 @@
(use-package lsp-mode
:custom
(lsp-completion-provider :none) ;; we use Corfu!
:config
(require 'lsp-ui)
:init
(defun materus/orderless-dispatch-flex-first (_pattern index _total)
(and (eq index 0) 'orderless-flex))
@ -481,10 +489,6 @@
(lsp-completion-mode . materus/lsp-mode-setup-completion))
(use-package lsp-ui)
(use-package dap-mode)
(use-package dap-lldb)
(use-package dap-gdb-lldb)
(setq read-process-output-max (* 1024 1024 3))
@ -521,6 +525,17 @@
(advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command)
;; LSP:1 ends here
;; [[file:../../emacs-materus-config.org::*DAP][DAP:1]]
(use-package dap-mode
:config
(require 'dap-lldb)
(require 'dap-gdb-lldb)
(require 'dap-cpptools)
(setq dap-gdb-lldb-extension-version "0.27.0")
(dap-auto-configure-mode 1)
)
;; DAP:1 ends here
;; [[file:../../emacs-materus-config.org::*Nix][Nix:1]]
(use-package nix-mode)
(use-package nix-ts-mode)
@ -610,33 +625,69 @@
(add-hook 'prog-mode-hook 'electric-indent-local-mode)
;; Other:1 ends here
;; [[file:../../emacs-materus-config.org::*Keybindings][Keybindings:1]]
;; [[file:../../emacs-materus-config.org::*Keys][Keys:1]]
(use-package cua-base)
;;; Keybinds
;; Eat Term
(keymap-set eat-semi-char-mode-map "C-v" #'eat-yank)
(keymap-set eat-char-mode-map "C-V" #'eat-yank)
(define-key cua--eat-semi-char-keymap (kbd "C-v") #'eat-yank)
(define-key cua--eat-char-keymap (kbd "C-S-v") #'eat-yank)
(define-key eat-mode-map (kbd "C-<right>") #'eat-self-input)
(define-key eat-mode-map (kbd "C-<left>") #'eat-self-input)
;; perspective
(global-set-key (kbd "C-x C-b") 'persp-list-buffers)
(global-set-key (kbd "C-x C-B") 'list-buffers)
(global-set-key (kbd "C-x b") 'persp-switch-to-buffer)
(global-set-key (kbd "C-x B") 'consult-buffer)
(define-key global-map (kbd "C-x C-b") 'persp-list-buffers)
(define-key global-map (kbd "C-x C-B") 'list-buffers)
(define-key global-map (kbd "C-x b") 'persp-switch-to-buffer)
(define-key global-map (kbd "C-x B") 'consult-buffer)
;; CUA-like global
(define-key global-map (kbd "C-s") 'save-buffer)
(define-key global-map (kbd "C-r") 'query-replace)
(define-key global-map (kbd "C-S-r") 'replace-string)
(define-key global-map (kbd "M-r") 'query-replace-regexp)
(define-key global-map (kbd "M-S-r") 'replace-regexp)
(define-key global-map (kbd "C-a") 'mark-whole-buffer)
(define-key global-map (kbd "C-f") 'isearch-forward)
(define-key global-map (kbd "C-S-f") 'isearch-backward)
(define-key isearch-mode-map (kbd "C-f") 'isearch-repeat-forward)
(define-key isearch-mode-map (kbd "C-S-f") 'isearch-repeat-backward)
(define-key global-map (kbd "M-f") 'consult-ripgrep)
(define-key global-map (kbd "C-M-f") 'consult-find)
;; CUA
(keymap-set cua--cua-keys-keymap "C-z" 'undo-tree-undo)
(keymap-set cua--cua-keys-keymap "C-y" 'undo-tree-redo)
(define-key cua--cua-keys-keymap (kbd "C-z") 'undo-tree-undo)
(define-key cua--cua-keys-keymap (kbd "C-y") 'undo-tree-redo)
(define-key cua-global-keymap (kbd "C-SPC") 'completion-at-point)
(define-key cua-global-keymap (kbd "C-M-SPC") 'cua-set-mark)
(cua-mode 1)
;; TAB
(keymap-set global-map "C-<iso-lefttab>" #'indent-rigidly-left-to-tab-stop)
(keymap-set global-map "C-<tab>" #'indent-rigidly-right-to-tab-stop)
(define-key global-map (kbd "C-<iso-lefttab>") #'indent-rigidly-left)
(define-key global-map (kbd "C-<tab>") #'indent-rigidly-right)
;; Dashboard
(define-key dashboard-mode-map (kbd "C-r") #'dashboard-refresh-buffer)
;; Hyper
(define-key key-translation-map (kbd "<XF86Calculator>") 'event-apply-hyper-modifier )
(define-key key-translation-map (kbd "<Calculator>") 'event-apply-hyper-modifier )
(define-key key-translation-map (kbd "") 'event-apply-hyper-modifier )
;; Treemacs
(define-key global-map (kbd "C-H-t") 'treemacs)
(global-set-key (kbd "C-H-t") 'treemacs)
;; Keybindings:1 ends here
;; Unbind
(define-key isearch-mode-map (kbd "C-s") nil)
(define-key isearch-mode-map (kbd "C-r") nil)
;; Keys:1 ends here
;; [[file:../../emacs-materus-config.org::*CUA Overrides][CUA Overrides:1]]
(defun cua--eat-semi-char-override-keymap ()
(setq-local cua--keymap-alist (copy-tree cua--keymap-alist))
(setf (alist-get 'cua--ena-cua-keys-keymap cua--keymap-alist) cua--eat-semi-char-keymap))
(defun cua--eat-char-override-keymap ()
(setq-local cua--keymap-alist (copy-tree cua--keymap-alist))
(setf (alist-get 'cua--ena-cua-keys-keymap cua--keymap-alist) cua--eat-char-keymap))
(advice-add 'eat-semi-char-mode :after #'cua--eat-semi-char-override-keymap)
(advice-add 'eat-char-mode :after #'cua--eat-char-override-keymap)
;(add-hook 'eat-char-mode-hook #'cua--eat-char-override-keymap)
;; CUA Overrides:1 ends here
;; [[file:../../emacs-materus-config.org::*Yasnippet init][Yasnippet init:1]]
(use-package yasnippet