From 429bf12cd70405d6ea18d14fe9d384a6458ae99d Mon Sep 17 00:00:00 2001 From: spl3g Date: Tue, 29 Aug 2023 05:05:22 +0000 Subject: thats a lot of changes --- flake.lock | 100 ++++- flake.nix | 8 +- home-manager/home.nix | 3 - home-manager/programs/emacs/config.org | 571 +++++++++++++++++++++++++ home-manager/programs/emacs/default.nix | 41 +- home-manager/programs/emacs/default.nix~ | 14 + home-manager/programs/emacs/early-init.el | 2 - home-manager/programs/emacs/init.el | 678 +++++++++++------------------- home-manager/programs/emacs/init.old.el | 592 ++++++++++++++++++++++++++ home-manager/programs/firefox/default.nix | 12 + home-manager/programs/ranger/default.nix | 11 +- home-manager/programs/ranger/default.nix~ | 7 + nixos/#hardware-configuration.nix# | 90 ++++ nixos/configuration.new.nix~ | 100 +++++ nixos/configuration.nix | 3 +- nixos/configuration.old.nix | 181 ++++++++ overlays/default.nix | 2 + pkgs/pokemon-colorscripts/#default.nix# | 21 + result | 1 + 19 files changed, 1959 insertions(+), 478 deletions(-) create mode 100644 home-manager/programs/emacs/config.org create mode 100644 home-manager/programs/emacs/default.nix~ create mode 100644 home-manager/programs/emacs/init.old.el create mode 100644 home-manager/programs/ranger/default.nix~ create mode 100644 nixos/#hardware-configuration.nix# create mode 100644 nixos/configuration.new.nix~ create mode 100644 nixos/configuration.old.nix create mode 100644 pkgs/pokemon-colorscripts/#default.nix# create mode 120000 result diff --git a/flake.lock b/flake.lock index cf2d8f7..ba78f36 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,43 @@ { "nodes": { + "emacs-overlay": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1692787545, + "narHash": "sha256-07MW3+hYXARr2oJHnvHJ+Af3UizRYQOfquemYSOa5Aw=", + "owner": "nix-community", + "repo": "emacs-overlay", + "rev": "05a1511966eeb5218d55f921146abff21aad1684", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "emacs-overlay", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -23,11 +61,43 @@ }, "nixpkgs": { "locked": { - "lastModified": 1692447944, - "narHash": "sha256-fkJGNjEmTPvqBs215EQU4r9ivecV5Qge5cF/QDLVn3U=", + "lastModified": 1692638711, + "narHash": "sha256-J0LgSFgJVGCC1+j5R2QndadWI1oumusg6hCtYAzLID4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "91a22f76cd1716f9d0149e8a5c68424bb691de15", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1692698134, + "narHash": "sha256-YtMmZWR/dlTypOcwiZfZTMPr3tj9fwr05QTStfSyDSg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a16f7eb56e88c8985fcc6eb81dabd6cade4e425a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1692638711, + "narHash": "sha256-J0LgSFgJVGCC1+j5R2QndadWI1oumusg6hCtYAzLID4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d680ded26da5cf104dd2735a51e88d2d8f487b4d", + "rev": "91a22f76cd1716f9d0149e8a5c68424bb691de15", "type": "github" }, "original": { @@ -51,11 +121,11 @@ }, "nurpkgs": { "locked": { - "lastModified": 1692546305, - "narHash": "sha256-wkh3AW5dMoZzpoois0EjUa+4iLjDIapCnMHNj5RPSWM=", + "lastModified": 1692809195, + "narHash": "sha256-eGYPC2xz2rB6lCsE3lcCeskVo0cePyTNDExviZZU11E=", "owner": "nix-community", "repo": "NUR", - "rev": "3ab8a848ef9af7c63a4740b3f1906704bb1677cc", + "rev": "1c9ad8e64530d2e3d3315055e13640153a354318", "type": "github" }, "original": { @@ -66,11 +136,27 @@ }, "root": { "inputs": { + "emacs-overlay": "emacs-overlay", "home-manager": "home-manager", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nur": "nur", "nurpkgs": "nurpkgs" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index aa9ef49..616a63c 100644 --- a/flake.nix +++ b/flake.nix @@ -18,12 +18,8 @@ url = github:/nix-community/NUR; inputs.nixpkgs.follows = "nixpkgs"; }; - # TODO: Add any other flake you might need - # hardware.url = "github:nixos/nixos-hardware"; - # Shameless plug: looking for a way to nixify your themes and make - # everything match nicely? Try nix-colors! - # nix-colors.url = "github:misterio77/nix-colors"; + emacs-overlay.url = "github:nix-community/emacs-overlay"; }; outputs = { self, nixpkgs, home-manager, nur, ... }@inputs: @@ -38,8 +34,6 @@ ]; in rec { - # Your custom packages - # Acessible through 'nix build', 'nix shell', etc packages = forAllSystems (system: let pkgs = nixpkgs.legacyPackages.${system}; in import ./pkgs { inherit pkgs; } diff --git a/home-manager/home.nix b/home-manager/home.nix index 8bf7006..4bbf9ce 100644 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -68,9 +68,6 @@ in inherit username homeDirectory; stateVersion = "23.05"; packages = defaultPkgs ++ pythonPkgs ++ yeahGamingPkgs ++ sysPkgs; - sessionVariables = { - DISPLAY = ":0"; - }; }; xdg = { diff --git a/home-manager/programs/emacs/config.org b/home-manager/programs/emacs/config.org new file mode 100644 index 0000000..f9938ce --- /dev/null +++ b/home-manager/programs/emacs/config.org @@ -0,0 +1,571 @@ +#+TITLE: spl3g's Emacs config +#+AUTHOR: spl3g +#+STARTUP: showeverything +#+PROPERTY: header-args :tangle init.el +#+OPTIONS: toc:2 +#+auto_tangle: t + +* Table Of Contents :toc: +- [[#progs-to-load-first][Progs to load first]] + - [[#use-package][use-package]] + - [[#meow-mode][Meow mode]] + - [[#general-keybindings][General keybindings]] +- [[#gui-tweaks][GUI tweaks]] + - [[#fonts][Fonts]] + - [[#display-line-numbers][Display line numbers]] + - [[#theme][Theme]] + - [[#icons][Icons]] + - [[#modeline][Modeline]] + - [[#smooth-scroll][Smooth scroll]] + - [[#dashboard][Dashboard]] + - [[#popper][Popper]] +- [[#org-mode][Org mode]] + - [[#enabling-toc][Enabling toc]] + - [[#org-bullets][Org bullets]] + - [[#auto-tangle][Auto-tangle]] +- [[#better-ux][Better UX]] + - [[#vertico][Vertico]] + - [[#consult][Consult]] + - [[#treemacs][Treemacs]] +- [[#lsp][LSP]] + - [[#languages][Languages]] + - [[#corfu--cape][Corfu + cape]] + - [[#flycheck][Flycheck]] + +* Progs to load first +** use-package +every package is installed by nix and configured by use-package +#+begin_src emacs-lisp + (require 'use-package) + (eval-and-compile + (setq use-package-always-ensure t + use-package-expand-minimally t)) +#+end_src +** Meow mode +#+begin_src emacs-lisp + (use-package meow + :config + (defun meow-setup () + (setq meow-cheatsheet-layout meow-cheatsheet-layout-qwerty) + (meow-motion-overwrite-define-key + '("j" . meow-next) + '("k" . meow-prev) + '("" . ignore)) + (meow-leader-define-key + ;; SPC j/k will run the original command in MOTION state. + '("j" . "H-j") + '("k" . "H-k") + ;; Use SPC (0-9) for digit arguments. + '("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) + '("bk" . kill-this-buffer)) + (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) + '("e" . meow-next-word) + '("E" . meow-next-symbol) + '("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-next) + '("J" . meow-next-expand) + '("k" . meow-prev) + '("K" . meow-prev-expand) + '("l" . meow-right) + '("L" . meow-right-expand) + '("m" . meow-join) + '("n" . meow-search) + '("o" . meow-block) + '("O" . meow-to-block) + '("p" . meow-yank) + '("q" . meow-quit) + '("Q" . meow-goto-line) + '("r" . meow-replace) + '("R" . meow-swap-grab) + '("s" . meow-kill) + '("t" . meow-till) + '("u" . meow-undo) + '("U" . meow-undo-in-selection) + '("v" . meow-visit) + '("w" . meow-mark-word) + '("W" . meow-mark-symbol) + '("x" . meow-line) + '("X" . meow-goto-line) + '("y" . meow-save) + '("Y" . meow-sync-grab) + '("z" . meow-pop-selection) + '("'" . repeat) + '("" . ignore))) + (setq meow-use-cursor-position-hack t + meow-use-enhanced-selection-effect t) + (meow-setup) + (meow-global-mode 1)) +#+end_src +** General keybindings +#+begin_src emacs-lisp + (use-package general + :config + ;; SPC as the global leader key + (general-create-definer spl3g/leader-keys + :prefix "C-c") + + (spl3g/leader-keys + ;; Buffers + "b" '(:ignore t :wk "Buffer") + "bi" '(ibuffer :wk "ibuffer") + "bk" '(kill-this-buffer :wk "Kill this buffer") + "bn" '(next-buffer :wk "Next buffer") + "bp" '(previous-buffer :wk "Previous buffer") + "br" '(revert-buffer :wk "Reload buffer") + "," '(consult-buffer :wk "Switch to buffer") + "." '(find-file :wk "Find file") + ;; Splits + "w" '(:ignore t :wk "Evil splits") + "wv" '(split-window-right :wk "Split vertical") + "ws" '(split-window-below :wk "Split") + "ww" '(other-window :wk "Cycle throug windows") + "wc" '(delete-window :wk "Close window") + "wd" '(delete-window :wk "Close window") + ;; Files + "f" '(:ignore t :wk "Files") + "fr" '(consult-recent-file :wk "Resent files") + "fc" '((lambda () (interactive) (find-file "~/.config/emacs/init.el")) :wk "Edit emacs config") + "fu" '(sudo-edit-find-file :wk "Sudo find file") + "fU" '(sudo-edit :wk "Sudo edit file") + ;; Quiting + "q" '(:ignore t :wk "Quiting") + "qq" '(:ignore t :wk "Quit TBD") + "qr" '(:ignore t :wk "Restart TBD") + "qe" '(eval-buffer :wk "Eval buffer") + "r" '(reload-init-file :wk "Reload config") + "l" '(lsp-keymap-prefix :wk "LSP"))) +#+end_src +* GUI tweaks +** Fonts +#+begin_src emacs-lisp + (set-face-attribute 'default nil + :font "Source Code Pro" + :height 113 + :weight 'medium) + (set-face-attribute 'fixed-pitch nil + :font "Source Code Pro" + :height 113 + :weight 'medium) + (set-face-attribute 'variable-pitch nil + :font "Rubik" + :height 113 + :weight 'medium) + (set-face-attribute 'font-lock-comment-face nil + :slant 'italic) + (set-face-attribute 'font-lock-keyword-face nil + :weight 'bold) +#+end_src +** Display line numbers +#+begin_src emacs-lisp +(global-display-line-numbers-mode 1) +(global-visual-line-mode t) +#+end_src + +** Theme +#+begin_src emacs-lisp +(use-package autothemer) +(use-package catppuccin-theme + :ensure t + :config + (load-theme 'catppuccin t) + (setq catppuccin-flavor 'mocha) + (catppuccin-reload)) +#+end_src + +** Icons +#+begin_src emacs-lisp + (use-package all-the-icons + :ensure t + :if (display-graphic-p)) +#+end_src + +** Modeline +#+begin_src emacs-lisp + (use-package mood-line + :init + (mood-line-mode) + :config + (setq mood-line-glyph-alist mood-line-glyphs-unicode)) +#+end_src + +** Smooth scroll +#+begin_src emacs-lisp + (use-package good-scroll + :init (good-scroll-mode)) +#+end_src + +** Dashboard +#+begin_src emacs-lisp + (use-package dashboard + :init + (dashboard-setup-startup-hook) + :config + (setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*"))) + (setq dashboard-banner-logo-title "Yep, it's emacs, not vim") + (setq dashboard-startup-banner 'logo) + (setq dashboard-center-content t)) +#+end_src +** Popper +#+begin_src emacs-lisp + (use-package popper + :ensure t ; or :straight t + :bind (("C-`" . popper-toggle-latest) + ("M-`" . popper-cycle) + ("C-M-`" . popper-toggle-type)) + :init + (setq popper-reference-buffers + '("\\*Messages\\*" + "Output\\*$" + "\\*Async Shell Command\\*" + help-mode + "^\\*vterm.*\\*$" vterm-mode + compilation-mode)) + (popper-mode +1) + (popper-echo-mode +1)) +#+end_src + +* Org mode +#+begin_src emacs-lisp + (add-hook 'org-mode-hook 'org-indent-mode) + (require 'org-tempo) +#+end_src + +** Enabling toc +#+begin_src emacs-lisp + (use-package toc-org) + (add-hook 'org-mode-hook 'toc-org-mode) +#+end_src + +** Org bullets +#+begin_src emacs-lisp + (use-package org-bullets) + (add-hook 'org-mode-hook 'org-bullets-mode) +#+end_src +** Auto-tangle +#+begin_src emacs-lisp + (use-package org-auto-tangle) + (add-hook 'org-mode-hook 'org-auto-tangle-mode) +#+end_src +* Better UX +** Vertico +#+begin_src emacs-lisp + (use-package vertico + :init + (vertico-mode) + :config + (savehist-mode 1)) + (use-package emacs + :init + ;; Add prompt indicator to `completing-read-multiple'. + ;; We display [CRM], e.g., [CRM,] if the separator is a comma. + (defun crm-indicator (args) + (cons (format "[CRM%s] %s" + (replace-regexp-in-string + "\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" "" + crm-separator) + (car args)) + (cdr args))) + (advice-add #'completing-read-multiple :filter-args #'crm-indicator) + + ;; Do not allow the cursor in the minibuffer prompt + (setq minibuffer-prompt-properties + '(read-only t cursor-intangible t face minibuffer-prompt)) + (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) + + ;; Emacs 28: Hide commands in M-x which do not work in the current mode. + ;; Vertico commands are hidden in normal buffers. + ;; (setq read-extended-command-predicate + ;; #'command-completion-default-include-p) + + ;; Enable recursive minibuffers + (setq enable-recursive-minibuffers t)) +#+end_src +*** Ordeless +#+begin_src emacs-lisp + (use-package orderless + :init + (setq completion-styles '(orderless basic) + completion-category-defaults nil + completion-category-overrides '((file (styles partial-completion))))) +#+end_src +*** Marginalia +#+begin_src emacs-lisp + (use-package marginalia + :bind (:map minibuffer-local-map + ("M-A" . marginalia-cycle)) + :init + (marginalia-mode)) +#+end_src +** Consult +#+begin_src emacs-lisp + (use-package consult + ;; Replace bindings. Lazily loaded due by `use-package'. + :bind (;; C-c bindings in `mode-specific-map' + ("C-c M-x" . consult-mode-command) + ("C-c h" . consult-history) + ("C-c k" . consult-kmacro) + ("C-c m" . consult-man) + ("C-c i" . consult-info) + ([remap Info-search] . consult-info) + ;; C-x bindings in `ctl-x-map' + ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command + ("C-x b" . consult-buffer) ;; orig. switch-to-buffer + ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window + ("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame + ("C-x r b" . consult-bookmark) ;; orig. bookmark-jump + ("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer + ;; Custom M-# bindings for fast register access + ("M-#" . consult-register-load) + ("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated) + ("C-M-#" . consult-register) + ;; Other custom bindings + ("M-y" . consult-yank-pop) ;; orig. yank-pop + ;; M-g bindings in `goto-map' + ("M-g e" . consult-compile-error) + ("M-g f" . consult-flymake) ;; Alternative: consult-flycheck + ("M-g g" . consult-goto-line) ;; orig. goto-line + ("M-g M-g" . consult-goto-line) ;; orig. goto-line + ("M-g o" . consult-outline) ;; Alternative: consult-org-heading + ("M-g m" . consult-mark) + ("M-g k" . consult-global-mark) + ("M-g i" . consult-imenu) + ("M-g I" . consult-imenu-multi) + ;; M-s bindings in `search-map' + ("M-s d" . consult-find) + ("M-s D" . consult-locate) + ("M-s g" . consult-grep) + ("M-s G" . consult-git-grep) + ("M-s r" . consult-ripgrep) + ("M-s l" . consult-line) + ("M-s L" . consult-line-multi) + ("M-s k" . consult-keep-lines) + ("M-s u" . consult-focus-lines) + ;; Isearch integration + ("M-s e" . consult-isearch-history) + :map isearch-mode-map + ("M-e" . consult-isearch-history) ;; orig. isearch-edit-string + ("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string + ("M-s l" . consult-line) ;; needed by consult-line to detect isearch + ("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch + ;; Minibuffer history + :map minibuffer-local-map + ("M-s" . consult-history) ;; orig. next-matching-history-element + ("M-r" . consult-history)) ;; orig. previous-matching-history-element + + ;; Enable automatic preview at point in the *Completions* buffer. This is + ;; relevant when you use the default completion UI. + :hook (completion-list-mode . consult-preview-at-point-mode) + + ;; The :init configuration is always executed (Not lazy) + :init + + ;; Optionally configure the register formatting. This improves the register + ;; preview for `consult-register', `consult-register-load', + ;; `consult-register-store' and the Emacs built-ins. + (setq register-preview-delay 0.5 + register-preview-function #'consult-register-format) + + ;; Optionally tweak the register preview window. + ;; This adds thin lines, sorting and hides the mode line of the window. + (advice-add #'register-preview :override #'consult-register-window) + + ;; Use Consult to select xref locations with preview + (setq xref-show-xrefs-function #'consult-xref + xref-show-definitions-function #'consult-xref) + + ;; Configure other variables and modes in the :config section, + ;; after lazily loading the package. + :config + + ;; Optionally configure preview. The default value + ;; is 'any, such that any key triggers the preview. + ;; (setq consult-preview-key 'any) + ;; (setq consult-preview-key "M-.") + ;; (setq consult-preview-key '("S-" "S-")) + ;; For some commands and buffer sources it is useful to configure the + ;; :preview-key on a per-command basis using the `consult-customize' macro. + (consult-customize + consult-ripgrep consult-git-grep consult-grep + consult-bookmark consult-recent-file consult-xref + consult--source-bookmark consult--source-file-register + consult--source-recent-file consult--source-project-recent-file) + ;; :preview-key "M-." + + ;; Optionally configure the narrowing key. + ;; Both < and C-+ work reasonably well. + (setq consult-narrow-key "<") ;; "C-+" + + ;; Optionally make narrowing help available in the minibuffer. + ;; You may want to use `embark-prefix-help-command' or which-key instead. + ;; (define-key consult-narrow-map (vconcat consult-narrow-key "?") #'consult-narrow-help) + + ;; By default `consult-project-function' uses `project-root' from project.el. + ;; Optionally configure a different project root function. + ;;;; 1. project.el (the default) + ;; (setq consult-project-function #'consult--default-project--function) + ;;;; 2. vc.el (vc-root-dir) + ;; (setq consult-project-function (lambda (_) (vc-root-dir))) + ;;;; 3. locate-dominating-file + ;; (setq consult-project-function (lambda (_) (locate-dominating-file "." ".git"))) + ;;;; 4. projectile.el (projectile-project-root) + ;; (autoload 'projectile-project-root "projectile") + ;; (setq consult-project-function (lambda (_) (projectile-project-root))) + ;;;; 5. No project support + ;; (setq consult-project-function nil) + ) +#+end_src +** Treemacs +#+begin_src emacs-lisp + (use-package treemacs + :config + (setq treemacs-no-png-images t)) +#+end_src +*** Treemacs evil +#+begin_src emacs-lisp + (use-package treemacs-evil) +#+end_src +*** Treemacs all the icons +#+begin_src emacs-lisp + (use-package treemacs-all-the-icons) +#+end_src +* LSP +#+begin_src emacs-lisp + (use-package lsp-mode + :hook + (python-mode . lsp) + (rust-mode . lsp) + (lsp-mode . lsp-enable-which-key-integration) + (sh-mode . lsp) + :commands lsp) +#+end_src +** Languages +*** Python +#+begin_src emacs-lisp + (use-package lsp-pyright + :ensure t) +#+end_src +*** Rust +#+begin_src emacs-lisp + (use-package rustic + :ensure + :bind (:map rustic-mode-map + ("M-j" . lsp-ui-imenu) + ("M-?" . lsp-find-references) + ("C-c C-c l" . flycheck-list-errors) + ("C-c C-c a" . lsp-execute-code-action) + ("C-c C-c r" . lsp-rename) + ("C-c C-c q" . lsp-workspace-restart) + ("C-c C-c Q" . lsp-workspace-shutdown) + ("C-c C-c s" . lsp-rust-analyzer-status)) + :config + ;; uncomment for less flashiness + ;; (setq lsp-eldoc-hook nil) + ;; (setq lsp-enable-symbol-highlighting nil) + ;; (setq lsp-signature-auto-activate nil) + + ;; comment to disable rustfmt on save + (setq rustic-format-on-save t) + (add-hook 'rustic-mode-hook 'rk/rustic-mode-hook)) + (use-package flycheck-rust + :config + (with eval-after-load 'rust-mode + (add-hook 'flycheck-mode-hook #'flycheck-rust-setup))) + + (defun rk/rustic-mode-hook () + ;; so that run C-c C-c C-r works without having to confirm, but don't try to + ;; save rust buffers that are not file visiting. Once + ;; https://github.com/brotzeit/rustic/issues/253 has been resolved this should + ;; no longer be necessary. + (when buffer-file-name + (setq-local buffer-save-without-query t)) + (add-hook 'before-save-hook 'lsp-format-buffer nil t)) +#+end_src +*** Fish +#+begin_src emacs-lisp + (use-package fish-mode + :mode "(.fish)$") +#+end_src +*** Nix +#+begin_src emacs-lisp + (use-package nix-mode + :mode "(.nix)$") +#+end_src +** Corfu + cape +#+begin_src emacs-lisp + (use-package corfu + :custom + (corfu-cycle t) + (corfu-auto t) + (corfu-preselect 'prompt) + :bind + (:map corfu-map + ("TAB" . corfu-next) + ([tab] . corfu-next) + ("S-TAB" . corfu-previous) + ([backtab] . corfu-previous)) + :init + (global-corfu-mode)) +#+end_src +#+begin_src emacs-lisp + (use-package cape + :init + (add-to-list 'completion-at-point-functions #'cape-file)) +#+end_src +#+begin_src emacs-lisp + (use-package emacs + :init + (setq completion-cycle-threshold 3) + (setq tab-always-indent 'complete)) +#+end_src +** Flycheck +#+begin_src emacs-lisp + (use-package flycheck + :init (global-flycheck-mode)) +#+end_src +*** Flycheck inline errors +#+begin_src emacs-lisp + (use-package flycheck-inline + :config + (with-eval-after-load 'flycheck + (add-hook 'flycheck-mode-hook #'flycheck-inline-mode))) +#+end_src diff --git a/home-manager/programs/emacs/default.nix b/home-manager/programs/emacs/default.nix index d74c93a..829c2c6 100644 --- a/home-manager/programs/emacs/default.nix +++ b/home-manager/programs/emacs/default.nix @@ -1,29 +1,26 @@ { pkgs, ... }: let - service = { - client = { - enable = true; - arguments = [ "-c" "-a emacs" ]; - }; - defaultEditor = true; - startWithUserSession = "graphical"; - package = pkgs.emacs-gtk; - }; - configs = { - "emacs/init.el".text = builtins.readFile ./init.el; - "emacs/early-init.el".text = builtins.readFile ./init.el; - }; + pkgsForEmacs = with pkgs; [ + tree-sitter + gcc + cmake + gnumake + ]; + pkgsUsePackage = with pkgs; [ + (pkgs.emacsWithPackagesFromUsePackage { + inherit (service) package; + config = ./init.el; + alwaysEnsure = true; + extraEmacsPackages = epkgs: [ + epkgs.use-package + ]; + }) + ]; in { - services.emacs = { - enable = true; - inherit (service); - }; - programs.emacs = { - enable = true; - inherit (service) package; - }; + home.packages = pkgsForEmacs ++ pkgsUsePackage; xdg.configFile = { - inherit (configs); + "emacs/init.el".text = builtins.readFile ./init.el; + "emacs/early-init.el".text = builtins.readFile ./early-init.el; }; } diff --git a/home-manager/programs/emacs/default.nix~ b/home-manager/programs/emacs/default.nix~ new file mode 100644 index 0000000..fe1f7bc --- /dev/null +++ b/home-manager/programs/emacs/default.nix~ @@ -0,0 +1,14 @@ +{ pkgs, ... }: +let + settings = { + client.enable = true; + package = pkgs.emacs-gtk; + extraConfig = builtins.readFile ./init.el; + }; +in +{ + services.emacs = { + enable = true; + inherit (settings) client package extraConfig; + }; +} diff --git a/home-manager/programs/emacs/early-init.el b/home-manager/programs/emacs/early-init.el index 00e3392..91df91f 100644 --- a/home-manager/programs/emacs/early-init.el +++ b/home-manager/programs/emacs/early-init.el @@ -1,5 +1,3 @@ -(setq package-enable-at-startup nil) - (menu-bar-mode -1) (tool-bar-mode -1) (scroll-bar-mode -1) diff --git a/home-manager/programs/emacs/init.el b/home-manager/programs/emacs/init.el index 8e39bb2..12f43a2 100644 --- a/home-manager/programs/emacs/init.el +++ b/home-manager/programs/emacs/init.el @@ -1,177 +1,107 @@ +(require 'use-package) +(eval-and-compile + (setq use-package-always-ensure t + use-package-expand-minimally t)) -;; Elpaca package manager -(defvar elpaca-installer-version 0.5) -(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory)) -(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory)) -(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory)) -(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git" - :ref nil - :files (:defaults (:exclude "extensions")) - :build (:not elpaca--activate-package))) -(let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory)) - (build (expand-file-name "elpaca/" elpaca-builds-directory)) - (order (cdr elpaca-order)) - (default-directory repo)) - (add-to-list 'load-path (if (file-exists-p build) build repo)) - (unless (file-exists-p repo) - (make-directory repo t) - (when (< emacs-major-version 28) (require 'subr-x)) - (condition-case-unless-debug err - (if-let ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*")) - ((zerop (call-process "git" nil buffer t "clone" - (plist-get order :repo) repo))) - ((zerop (call-process "git" nil buffer t "checkout" - (or (plist-get order :ref) "--")))) - (emacs (concat invocation-directory invocation-name)) - ((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch" - "--eval" "(byte-recompile-directory \".\" 0 'force)"))) - ((require 'elpaca)) - ((elpaca-generate-autoloads "elpaca" repo))) - (progn (message "%s" (buffer-string)) (kill-buffer buffer)) - (error "%s" (with-current-buffer buffer (buffer-string)))) - ((error) (warn "%s" err) (delete-directory repo 'recursive)))) - (unless (require 'elpaca-autoloads nil t) - (require 'elpaca) - (elpaca-generate-autoloads "elpaca" repo) - (load "./elpaca-autoloads"))) -(add-hook 'after-init-hook #'elpaca-process-queues) -(elpaca `(,@elpaca-order)) - -(elpaca elpaca-use-package - (elpaca-use-package-mode) - (setq elpaca-use-package-by-default t)) - -(elpaca-wait) - -;;When installing a package which modifies a form used at the top-level -;;(e.g. a package which adds a use-package key word), -;;use `elpaca-wait' to block until that package has been installed/configured. -;;For example: -;;(elpaca-wait) - -;;Turns off elpaca-use-package-mode current declartion -;;Note this will cause the declaration to be interpreted immediately (not deferred). -;;Useful for configuring built-in emacs features. -(use-package emacs :elpaca nil :config (setq ring-bell-function #'ignore)) - -;; Don't install anything. Defer execution of BODY -;; (elpaca nil (message "deferred")) - -;; Evil -;; (use-package evil -;; :init -;; (setq evil-want-integration t) -;; (setq evil-want-keybinding nil) -;; (setq evil-split-window-below t) -;; (setq evil-vsplit-window-right t) -;; (evil-mode)) -;; (use-package evil-collection -;; :after evil -;; :config -;; (setq evil-collection-mode-list '(dashboard dired ibuffer)) -;; (evil-collection-init)) - -;; Meow (use-package meow :config -(defun meow-setup () - (setq meow-use-clipboard t) - (setq meow-cheatsheet-layout meow-cheatsheet-layout-qwerty) - (meow-motion-overwrite-define-key - '("j" . meow-next) - '("k" . meow-prev) - '("" . ignore)) - (meow-leader-define-key - ;; SPC j/k will run the original command in MOTION state. - '("j" . "H-j") - '("k" . "H-k") - ;; Use SPC (0-9) for digit arguments. - '("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) - '("bk" . kill-this-buffer)) - (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) - '("e" . meow-next-word) - '("E" . meow-next-symbol) - '("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-next) - '("J" . meow-next-expand) - '("k" . meow-prev) - '("K" . meow-prev-expand) - '("l" . meow-right) - '("L" . meow-right-expand) - '("m" . meow-join) - '("n" . meow-search) - '("o" . meow-block) - '("O" . meow-to-block) - '("p" . meow-yank) - '("q" . meow-quit) - '("Q" . meow-goto-line) - '("r" . meow-replace) - '("R" . meow-swap-grab) - '("s" . meow-kill) - '("t" . meow-till) - '("u" . meow-undo) - '("U" . meow-undo-in-selection) - '("v" . meow-visit) - '("w" . meow-mark-word) - '("W" . meow-mark-symbol) - '("x" . meow-line) - '("X" . meow-goto-line) - '("y" . meow-save) - '("Y" . meow-sync-grab) - '("z" . meow-pop-selection) - '("'" . repeat) - '("" . ignore))) -(meow-setup) -(meow-global-mode 1)) - -;; General Keybindings + (defun meow-setup () + (setq meow-cheatsheet-layout meow-cheatsheet-layout-qwerty) + (meow-motion-overwrite-define-key + '("j" . meow-next) + '("k" . meow-prev) + '("" . ignore)) + (meow-leader-define-key + ;; SPC j/k will run the original command in MOTION state. + '("j" . "H-j") + '("k" . "H-k") + ;; Use SPC (0-9) for digit arguments. + '("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) + '("bk" . kill-this-buffer)) + (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) + '("e" . meow-next-word) + '("E" . meow-next-symbol) + '("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-next) + '("J" . meow-next-expand) + '("k" . meow-prev) + '("K" . meow-prev-expand) + '("l" . meow-right) + '("L" . meow-right-expand) + '("m" . meow-join) + '("n" . meow-search) + '("o" . meow-block) + '("O" . meow-to-block) + '("p" . meow-yank) + '("q" . meow-quit) + '("Q" . meow-goto-line) + '("r" . meow-replace) + '("R" . meow-swap-grab) + '("s" . meow-kill) + '("t" . meow-till) + '("u" . meow-undo) + '("U" . meow-undo-in-selection) + '("v" . meow-visit) + '("w" . meow-mark-word) + '("W" . meow-mark-symbol) + '("x" . meow-line) + '("X" . meow-goto-line) + '("y" . meow-save) + '("Y" . meow-sync-grab) + '("z" . meow-pop-selection) + '("'" . repeat) + '("" . ignore))) + (setq meow-use-cursor-position-hack t + meow-use-enhanced-selection-effect t) + (meow-setup) + (meow-global-mode 1)) + (use-package general - :config - + :config ;; SPC as the global leader key (general-create-definer spl3g/leader-keys :prefix "C-c") - + (spl3g/leader-keys ;; Buffers "b" '(:ignore t :wk "Buffer") @@ -184,11 +114,11 @@ "." '(find-file :wk "Find file") ;; Splits "w" '(:ignore t :wk "Evil splits") - "wv" '(evil-window-vsplit :wk "Split vertical") - "ws" '(evil-window-split :wk "Split") - "ww" '(evil-window-next :wk "Cycle throug windows") - "wc" '(evil-window-delete :wk "Close window") - "wd" '(evil-window-delete :wk "Close window") + "wv" '(split-window-right :wk "Split vertical") + "ws" '(split-window-below :wk "Split") + "ww" '(other-window :wk "Cycle throug windows") + "wc" '(delete-window :wk "Close window") + "wd" '(delete-window :wk "Close window") ;; Files "f" '(:ignore t :wk "Files") "fr" '(consult-recent-file :wk "Resent files") @@ -202,74 +132,128 @@ "qe" '(eval-buffer :wk "Eval buffer") "r" '(reload-init-file :wk "Reload config") "l" '(lsp-keymap-prefix :wk "LSP"))) -(elpaca-wait) -;; Which key -(use-package which-key +(set-face-attribute 'default nil + :font "Source Code Pro" + :height 113 + :weight 'medium) +(set-face-attribute 'fixed-pitch nil + :font "Source Code Pro" + :height 113 + :weight 'medium) +(set-face-attribute 'variable-pitch nil + :font "Rubik" + :height 113 + :weight 'medium) +(set-face-attribute 'font-lock-comment-face nil + :slant 'italic) +(set-face-attribute 'font-lock-keyword-face nil + :weight 'bold) + +(global-display-line-numbers-mode 1) +(global-visual-line-mode t) + +(use-package autothemer) +(use-package catppuccin-theme + :ensure t + :config + (load-theme 'catppuccin t) + (setq catppuccin-flavor 'mocha) + (catppuccin-reload)) + +(use-package all-the-icons + :ensure t + :if (display-graphic-p)) + +(use-package mood-line :init - (which-key-mode 1) + (mood-line-mode) :config - (setq which-key-side-window-location 'bottom - which-key-sort-order #'which-key-key-order-alpha - which-key-sort-uppercase-first nil - which-key-add-column-padding 1 - which-key-max-display-columns nil - which-key-side-window-slot -10 - which-key-side-window-max-height 0.25 - which-key-idle-deley 0.8 - which-key-max-description-length 25 - which-key-allow-imprecise-window-fit t - which-key-separator " -> ")) - - - - -;; Vertico -(use-package vertico + (setq mood-line-glyph-alist mood-line-glyphs-unicode)) + +(use-package good-scroll + :init (good-scroll-mode)) + +(use-package dashboard :init - (vertico-mode)) + (dashboard-setup-startup-hook) + :config + (setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*"))) + (setq dashboard-banner-logo-title "Yep, it's emacs, not vim") + (setq dashboard-startup-banner 'logo) + (setq dashboard-center-content t)) -;; For persistent history -(savehist-mode 1) -;; Idk what it means but they said that i need it -(use-package emacs :elpaca nil +(use-package popper + :ensure t ; or :straight t + :bind (("C-`" . popper-toggle-latest) + ("M-`" . popper-cycle) + ("C-M-`" . popper-toggle-type)) + :init + (setq popper-reference-buffers + '("\\*Messages\\*" + "Output\\*$" + "\\*Async Shell Command\\*" + help-mode + "^\\*vterm.*\\*$" vterm-mode + compilation-mode)) + (popper-mode +1) + (popper-echo-mode +1)) + +(add-hook 'org-mode-hook 'org-indent-mode) +(require 'org-tempo) + +(use-package toc-org) +(add-hook 'org-mode-hook 'toc-org-mode) + +(use-package org-bullets) +(add-hook 'org-mode-hook 'org-bullets-mode) + +(use-package org-auto-tangle) +(add-hook 'org-mode-hook 'org-auto-tangle-mode) + +(use-package vertico :init - ;; Add prompt indicator to `completing-read-multiple'. - ;; We display [CRM], e.g., [CRM,] if the separator is a comma. - (defun crm-indicator (args) - (cons (format "[CRM%s] %s" - (replace-regexp-in-string - "\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" "" - crm-separator) - (car args)) - (cdr args))) - (advice-add #'completing-read-multiple :filter-args #'crm-indicator) - - ;; Do not allow the cursor in the minibuffer prompt - (setq minibuffer-prompt-properties - '(read-only t cursor-intangible t face minibuffer-prompt)) - (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) - - ;; Emacs 28: Hide commands in M-x which do not work in the current mode. - ;; Vertico commands are hidden in normal buffers. - ;; (setq read-extended-command-predicate - ;; #'command-completion-default-include-p) - - ;; Enable recursive minibuffers - (setq enable-recursive-minibuffers t)) -;; Orderless + (vertico-mode) + :config + (savehist-mode 1)) +(use-package emacs +:init +;; Add prompt indicator to `completing-read-multiple'. +;; We display [CRM], e.g., [CRM,] if the separator is a comma. +(defun crm-indicator (args) + (cons (format "[CRM%s] %s" + (replace-regexp-in-string + "\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" "" + crm-separator) + (car args)) + (cdr args))) +(advice-add #'completing-read-multiple :filter-args #'crm-indicator) + +;; Do not allow the cursor in the minibuffer prompt +(setq minibuffer-prompt-properties + '(read-only t cursor-intangible t face minibuffer-prompt)) +(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) + +;; Emacs 28: Hide commands in M-x which do not work in the current mode. +;; Vertico commands are hidden in normal buffers. +;; (setq read-extended-command-predicate +;; #'command-completion-default-include-p) + +;; Enable recursive minibuffers +(setq enable-recursive-minibuffers t)) + (use-package orderless :init (setq completion-styles '(orderless basic) - completion-category-defaults nil - completion-category-overrides '((file (styles partial-completion))))) + completion-category-defaults nil + completion-category-overrides '((file (styles partial-completion))))) + (use-package marginalia :bind (:map minibuffer-local-map ("M-A" . marginalia-cycle)) :init (marginalia-mode)) -;; Consult (use-package consult ;; Replace bindings. Lazily loaded due by `use-package'. :bind (;; C-c bindings in `mode-specific-map' @@ -386,13 +370,14 @@ ;; (setq consult-project-function nil) ) -;; Hotfuzz -;; (use-package hotfuzz -;; :config -;; (setq completion-styles '(hotfuzz)) -;; (setq completion-ignore-case t)) +(use-package treemacs + :config + (setq treemacs-no-png-images t)) + +(use-package treemacs-evil) + +(use-package treemacs-all-the-icons) -;; Lsp (use-package lsp-mode :hook (python-mode . lsp) @@ -400,98 +385,10 @@ (lsp-mode . lsp-enable-which-key-integration) (sh-mode . lsp) :commands lsp) -(use-package lsp-pyright - :ensure t) -(use-package lsp-ui - :hook (lsp-mode-hook . lsp-ui-mode) - :custom - (lsp-ui-peek-always-show t) - (lsp-ui-sideline-show-hover t) - (lsp-ui-doc-enable t)) - -(use-package lsp-treemacs) - -;; Flycheck -(use-package flycheck) - -;; Corfu + Cape -(use-package corfu - :custom - (corfu-cycle t) - (corfu-auto t) - (corfu-preselect 'prompt) - :bind - (:map corfu-map - ("TAB" . corfu-next) - ([tab] . corfu-next) - ("S-TAB" . corfu-previous) - ([backtab] . corfu-previous)) - :init - (global-corfu-mode)) - ;;(use-package cape - ;; :bind (("C-c a f" . cape-file)) - ;; :init - ;; (add-to-list 'completion-at-point-functions # 'cape-file))) -(use-package cape - :init - (add-to-list 'completion-at-point-functions #'cape-file)) -(use-package emacs :elpaca nil - :init - (setq completion-cycle-threshold 3) - (setq tab-always-indent 'complete)) - -;; Treemacs -(use-package treemacs - :config - (setq treemacs-no-png-images t)) -(use-package treemacs-evil) -(use-package treemacs-all-the-icons) -;; Resent files -(recentf-mode 1) -(setq recentf-max-menu-items 25) -(setq recentf-max-saved-items 50) - -;; Sudo -(use-package sudo-edit) - -;; (defun sudo-find-file-hook () -;; (when (and (not (file-writable-p buffer-file-name)) -;; (y-or-n-p-with-timeout "File not writable. Open as root?" 2 t)) -;; (let ((obuf (current-buffer))) -;; (sudo-edit) -;; (unless (equal (current-buffer) obuf) -;; (let) - -;; Parinfer -(electric-pair-mode 1) - -;; NixOS -(use-package nix-mode - :mode "(.nix)$") -;; (use-package nix-drv-mode :elpaca nil -;; :ensure nix-mode -;; :mode ".drv") -;; (use-package nix-shell :elpaca nil -;; :ensure nix-mode -;; :commands (nix-shell-unpack nix-shell-configure nix-shell-build)) -;; (use-package nix-repl :elpaca nil -;; :ensure nix-mode -;; :commands (nix-repl)) - -;; Reload config -(defun reload-init-file () (interactive) - (load-file user-init-file) - (load-file user-init-file)) - -;; Magit -(use-package magit) - -;; Fish -(use-package fish-mode - :mode "(.fish)$") +(use-package lsp-pyright +:ensure t) -;; Rust (use-package rustic :ensure :bind (:map rustic-mode-map @@ -512,6 +409,10 @@ ;; comment to disable rustfmt on save (setq rustic-format-on-save t) (add-hook 'rustic-mode-hook 'rk/rustic-mode-hook)) +(use-package flycheck-rust + :config + (with eval-after-load 'rust-mode + (add-hook 'flycheck-mode-hook #'flycheck-rust-setup))) (defun rk/rustic-mode-hook () ;; so that run C-c C-c C-r works without having to confirm, but don't try to @@ -522,118 +423,39 @@ (setq-local buffer-save-without-query t)) (add-hook 'before-save-hook 'lsp-format-buffer nil t)) -;; GUI tweaks -;; Disable bars (no alcohol here.. maybe just a litle bit) -(menu-bar-mode -1) -(tool-bar-mode -1) -(scroll-bar-mode -1) - -;; Display numbers -(global-display-line-numbers-mode 1) -(global-visual-line-mode t) +(use-package fish-mode + :mode "(.fish)$") -;; Theme -(use-package autothemer) -(use-package catppuccin-theme - :ensure t - :config - (load-theme 'catppuccin t) - (setq catppuccin-flavor 'mocha) - (catppuccin-reload)) +(use-package nix-mode + :mode "(.nix)$") -;; Fonts -(set-face-attribute 'default nil - :font "Source Code Pro" - :height 113 - :weight 'medium) -(set-face-attribute 'fixed-pitch nil - :font "Source Code Pro" - :height 113 - :weight 'medium) -(set-face-attribute 'variable-pitch nil - :font "Rubik" - :height 113 - :weight 'medium) -(set-face-attribute 'font-lock-comment-face nil - :slant 'italic) -(set-face-attribute 'font-lock-keyword-face nil - :weight 'bold) +(use-package corfu +:custom +(corfu-cycle t) +(corfu-auto t) +(corfu-preselect 'prompt) +:bind +(:map corfu-map + ("TAB" . corfu-next) + ([tab] . corfu-next) + ("S-TAB" . corfu-previous) + ([backtab] . corfu-previous)) +:init +(global-corfu-mode)) -;; Icons -(use-package all-the-icons - :ensure t - :if (display-graphic-p)) -(use-package all-the-icons-dired - :hook (dired-mode . (lambda () - all-the-icons-dired-mode t))) +(use-package cape + :init + (add-to-list 'completion-at-point-functions #'cape-file)) -;; Modeline -(use-package mood-line +(use-package emacs :init - (mood-line-mode) - :config - (setq mood-line-glyph-alist mood-line-glyphs-unicode)) + (setq completion-cycle-threshold 3) + (setq tab-always-indent 'complete)) -;; Scrolling -(use-package good-scroll - :init (good-scroll-mode)) +(use-package flycheck + :init (global-flycheck-mode)) -;; Dashboard -(use-package dashboard - :init - (dashboard-setup-startup-hook) +(use-package flycheck-inline :config - (setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*"))) - (setq dashboard-banner-logo-title "Yep, it's emacs, not vim") - (setq dashboard-startup-banner 'logo) - (setq dashboard-center-content t)) - -;; Vterm - - -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(package-selected-packages '(nix-mode)) - '(warning-suppress-types - '((comp) - (comp) - (comp) - (comp) - (comp) - (comp) - (comp) - (comp) - (comp) - (comp) - (comp) - (comp) - (comp)))) -(custom-set-faces) - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - + (with-eval-after-load 'flycheck + (add-hook 'flycheck-mode-hook #'flycheck-inline-mode))) diff --git a/home-manager/programs/emacs/init.old.el b/home-manager/programs/emacs/init.old.el new file mode 100644 index 0000000..766d86d --- /dev/null +++ b/home-manager/programs/emacs/init.old.el @@ -0,0 +1,592 @@ +(require 'use-package) + +;; Evil +;; (use-package evil +;; :init +;; (setq evil-want-integration t) +;; (setq evil-want-keybinding nil) +;; (setq evil-split-window-below t) +;; (setq evil-vsplit-window-right t) +;; (evil-mode)) +;; (use-package evil-collection +;; :after evil +;; :config +;; (setq evil-collection-mode-list '(dashboard dired ibuffer)) +;; (evil-collection-init)) + +;; Meow +(use-package meow + :config +(defun meow-setup () + (setq meow-use-clipboard t) + (setq meow-cheatsheet-layout meow-cheatsheet-layout-qwerty) + (meow-motion-overwrite-define-key + '("j" . meow-next) + '("k" . meow-prev) + '("" . ignore)) + (meow-leader-define-key + ;; SPC j/k will run the original command in MOTION state. + '("j" . "H-j") + '("k" . "H-k") + ;; Use SPC (0-9) for digit arguments. + '("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) + '("bk" . kill-this-buffer)) + (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) + '("e" . meow-next-word) + '("E" . meow-next-symbol) + '("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-next) + '("J" . meow-next-expand) + '("k" . meow-prev) + '("K" . meow-prev-expand) + '("l" . meow-right) + '("L" . meow-right-expand) + '("m" . meow-join) + '("n" . meow-search) + '("o" . meow-block) + '("O" . meow-to-block) + '("p" . meow-yank) + '("q" . meow-quit) + '("Q" . meow-goto-line) + '("r" . meow-replace) + '("R" . meow-swap-grab) + '("s" . meow-kill) + '("t" . meow-till) + '("u" . meow-undo) + '("U" . meow-undo-in-selection) + '("v" . meow-visit) + '("w" . meow-mark-word) + '("W" . meow-mark-symbol) + '("x" . meow-line) + '("X" . meow-goto-line) + '("y" . meow-save) + '("Y" . meow-sync-grab) + '("z" . meow-pop-selection) + '("'" . repeat) + '("" . ignore))) +(meow-setup) +(meow-global-mode 1)) + +;; General Keybindings +(use-package general + :config + + ;; SPC as the global leader key + (general-create-definer spl3g/leader-keys + :prefix "C-c") + + (spl3g/leader-keys + ;; Buffers + "b" '(:ignore t :wk "Buffer") + "bi" '(ibuffer :wk "ibuffer") + "bk" '(kill-this-buffer :wk "Kill this buffer") + "bn" '(next-buffer :wk "Next buffer") + "bp" '(previous-buffer :wk "Previous buffer") + "br" '(revert-buffer :wk "Reload buffer") + "," '(consult-buffer :wk "Switch to buffer") + "." '(find-file :wk "Find file") + ;; Splits + "w" '(:ignore t :wk "Evil splits") + "wv" '(evil-window-vsplit :wk "Split vertical") + "ws" '(evil-window-split :wk "Split") + "ww" '(evil-window-next :wk "Cycle throug windows") + "wc" '(evil-window-delete :wk "Close window") + "wd" '(evil-window-delete :wk "Close window") + ;; Files + "f" '(:ignore t :wk "Files") + "fr" '(consult-recent-file :wk "Resent files") + "fc" '((lambda () (interactive) (find-file "~/.config/emacs/init.el")) :wk "Edit emacs config") + "fu" '(sudo-edit-find-file :wk "Sudo find file") + "fU" '(sudo-edit :wk "Sudo edit file") + ;; Quiting + "q" '(:ignore t :wk "Quiting") + "qq" '(:ignore t :wk "Quit TBD") + "qr" '(:ignore t :wk "Restart TBD") + "qe" '(eval-buffer :wk "Eval buffer") + "r" '(reload-init-file :wk "Reload config") + "l" '(lsp-keymap-prefix :wk "LSP"))) + +;; Which key +(use-package which-key + :init + (which-key-mode 1) + :config + (setq which-key-side-window-location 'bottom + which-key-sort-order #'which-key-key-order-alpha + which-key-sort-uppercase-first nil + which-key-add-column-padding 1 + which-key-max-display-columns nil + which-key-side-window-slot -10 + which-key-side-window-max-height 0.25 + which-key-idle-deley 0.8 + which-key-max-description-length 25 + which-key-allow-imprecise-window-fit t + which-key-separator " -> ")) + + + + +;; Vertico +(use-package vertico + :init + (vertico-mode)) + +;; For persistent history +(savehist-mode 1) +;; Idk what it means but they said that i need it +(use-package emacs + :init + ;; Add prompt indicator to `completing-read-multiple'. + ;; We display [CRM], e.g., [CRM,] if the separator is a comma. + (defun crm-indicator (args) + (cons (format "[CRM%s] %s" + (replace-regexp-in-string + "\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" "" + crm-separator) + (car args)) + (cdr args))) + (advice-add #'completing-read-multiple :filter-args #'crm-indicator) + + ;; Do not allow the cursor in the minibuffer prompt + (setq minibuffer-prompt-properties + '(read-only t cursor-intangible t face minibuffer-prompt)) + (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) + + ;; Emacs 28: Hide commands in M-x which do not work in the current mode. + ;; Vertico commands are hidden in normal buffers. + ;; (setq read-extended-command-predicate + ;; #'command-completion-default-include-p) + + ;; Enable recursive minibuffers + (setq enable-recursive-minibuffers t)) +;; Orderless +(use-package orderless + :init + (setq completion-styles '(orderless basic) + completion-category-defaults nil + completion-category-overrides '((file (styles partial-completion))))) +(use-package marginalia + :bind (:map minibuffer-local-map + ("M-A" . marginalia-cycle)) + :init + (marginalia-mode)) + +;; Consult +(use-package consult + ;; Replace bindings. Lazily loaded due by `use-package'. + :bind (;; C-c bindings in `mode-specific-map' + ("C-c M-x" . consult-mode-command) + ("C-c h" . consult-history) + ("C-c k" . consult-kmacro) + ("C-c m" . consult-man) + ("C-c i" . consult-info) + ([remap Info-search] . consult-info) + ;; C-x bindings in `ctl-x-map' + ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command + ("C-x b" . consult-buffer) ;; orig. switch-to-buffer + ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window + ("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame + ("C-x r b" . consult-bookmark) ;; orig. bookmark-jump + ("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer + ;; Custom M-# bindings for fast register access + ("M-#" . consult-register-load) + ("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated) + ("C-M-#" . consult-register) + ;; Other custom bindings + ("M-y" . consult-yank-pop) ;; orig. yank-pop + ;; M-g bindings in `goto-map' + ("M-g e" . consult-compile-error) + ("M-g f" . consult-flymake) ;; Alternative: consult-flycheck + ("M-g g" . consult-goto-line) ;; orig. goto-line + ("M-g M-g" . consult-goto-line) ;; orig. goto-line + ("M-g o" . consult-outline) ;; Alternative: consult-org-heading + ("M-g m" . consult-mark) + ("M-g k" . consult-global-mark) + ("M-g i" . consult-imenu) + ("M-g I" . consult-imenu-multi) + ;; M-s bindings in `search-map' + ("M-s d" . consult-find) + ("M-s D" . consult-locate) + ("M-s g" . consult-grep) + ("M-s G" . consult-git-grep) + ("M-s r" . consult-ripgrep) + ("M-s l" . consult-line) + ("M-s L" . consult-line-multi) + ("M-s k" . consult-keep-lines) + ("M-s u" . consult-focus-lines) + ;; Isearch integration + ("M-s e" . consult-isearch-history) + :map isearch-mode-map + ("M-e" . consult-isearch-history) ;; orig. isearch-edit-string + ("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string + ("M-s l" . consult-line) ;; needed by consult-line to detect isearch + ("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch + ;; Minibuffer history + :map minibuffer-local-map + ("M-s" . consult-history) ;; orig. next-matching-history-element + ("M-r" . consult-history)) ;; orig. previous-matching-history-element + + ;; Enable automatic preview at point in the *Completions* buffer. This is + ;; relevant when you use the default completion UI. + :hook (completion-list-mode . consult-preview-at-point-mode) + + ;; The :init configuration is always executed (Not lazy) + :init + + ;; Optionally configure the register formatting. This improves the register + ;; preview for `consult-register', `consult-register-load', + ;; `consult-register-store' and the Emacs built-ins. + (setq register-preview-delay 0.5 + register-preview-function #'consult-register-format) + + ;; Optionally tweak the register preview window. + ;; This adds thin lines, sorting and hides the mode line of the window. + (advice-add #'register-preview :override #'consult-register-window) + + ;; Use Consult to select xref locations with preview + (setq xref-show-xrefs-function #'consult-xref + xref-show-definitions-function #'consult-xref) + + ;; Configure other variables and modes in the :config section, + ;; after lazily loading the package. + :config + + ;; Optionally configure preview. The default value + ;; is 'any, such that any key triggers the preview. + ;; (setq consult-preview-key 'any) + ;; (setq consult-preview-key "M-.") + ;; (setq consult-preview-key '("S-" "S-")) + ;; For some commands and buffer sources it is useful to configure the + ;; :preview-key on a per-command basis using the `consult-customize' macro. + (consult-customize + consult-ripgrep consult-git-grep consult-grep + consult-bookmark consult-recent-file consult-xref + consult--source-bookmark consult--source-file-register + consult--source-recent-file consult--source-project-recent-file) + ;; :preview-key "M-." + + ;; Optionally configure the narrowing key. + ;; Both < and C-+ work reasonably well. + (setq consult-narrow-key "<") ;; "C-+" + + ;; Optionally make narrowing help available in the minibuffer. + ;; You may want to use `embark-prefix-help-command' or which-key instead. + ;; (define-key consult-narrow-map (vconcat consult-narrow-key "?") #'consult-narrow-help) + + ;; By default `consult-project-function' uses `project-root' from project.el. + ;; Optionally configure a different project root function. + ;;;; 1. project.el (the default) + ;; (setq consult-project-function #'consult--default-project--function) + ;;;; 2. vc.el (vc-root-dir) + ;; (setq consult-project-function (lambda (_) (vc-root-dir))) + ;;;; 3. locate-dominating-file + ;; (setq consult-project-function (lambda (_) (locate-dominating-file "." ".git"))) + ;;;; 4. projectile.el (projectile-project-root) + ;; (autoload 'projectile-project-root "projectile") + ;; (setq consult-project-function (lambda (_) (projectile-project-root))) + ;;;; 5. No project support + ;; (setq consult-project-function nil) +) + +;; Hotfuzz +;; (use-package hotfuzz +;; :config +;; (setq completion-styles '(hotfuzz)) +;; (setq completion-ignore-case t)) + +;; Lsp +(use-package lsp-mode + :hook + (python-mode . lsp) + (rust-mode . lsp) + (lsp-mode . lsp-enable-which-key-integration) + (sh-mode . lsp) + :commands lsp) +(use-package lsp-pyright + :ensure t) +(use-package lsp-ui + :hook (lsp-mode-hook . lsp-ui-mode) + :custom + (lsp-ui-peek-always-show t) + (lsp-ui-sideline-show-hover t) + (lsp-ui-doc-enable t)) + +(use-package lsp-treemacs) + +;; Flycheck +(use-package flycheck) + +;; Corfu + Cape +(use-package corfu + :custom + (corfu-cycle t) + (corfu-auto t) + (corfu-preselect 'prompt) + :bind + (:map corfu-map + ("TAB" . corfu-next) + ([tab] . corfu-next) + ("S-TAB" . corfu-previous) + ([backtab] . corfu-previous)) + :init + (global-corfu-mode)) + ;;(use-package cape + ;; :bind (("C-c a f" . cape-file)) + ;; :init + ;; (add-to-list 'completion-at-point-functions # 'cape-file))) +(use-package cape + :init + (add-to-list 'completion-at-point-functions #'cape-file)) +(use-package emacs + :init + (setq completion-cycle-threshold 3) + (setq tab-always-indent 'complete)) + +;; Treemacs +(use-package treemacs + :config + (setq treemacs-no-png-images t)) +(use-package treemacs-evil) +(use-package treemacs-all-the-icons) + +;; Resent files +(recentf-mode 1) +(setq recentf-max-menu-items 25) +(setq recentf-max-saved-items 50) + +;; Sudo +(use-package sudo-edit) + +;; (defun sudo-find-file-hook () +;; (when (and (not (file-writable-p buffer-file-name)) +;; (y-or-n-p-with-timeout "File not writable. Open as root?" 2 t)) +;; (let ((obuf (current-buffer))) +;; (sudo-edit) +;; (unless (equal (current-buffer) obuf) +;; (let) + +;; Parinfer +(electric-pair-mode 1) + +;; NixOS +(use-package nix-mode + :mode "(.nix)$") +;; (use-package nix-drv-mode :elpaca nil +;; :ensure nix-mode +;; :mode ".drv") +;; (use-package nix-shell :elpaca nil +;; :ensure nix-mode +;; :commands (nix-shell-unpack nix-shell-configure nix-shell-build)) +;; (use-package nix-repl :elpaca nil +;; :ensure nix-mode +;; :commands (nix-repl)) + +;; Reload config +(defun reload-init-file () (interactive) + (load-file user-init-file) + (load-file user-init-file)) + +;; Magit +(use-package magit) + +;; Fish +(use-package fish-mode + :mode "(.fish)$") + +;; Rust +(use-package rustic + :ensure + :bind (:map rustic-mode-map + ("M-j" . lsp-ui-imenu) + ("M-?" . lsp-find-references) + ("C-c C-c l" . flycheck-list-errors) + ("C-c C-c a" . lsp-execute-code-action) + ("C-c C-c r" . lsp-rename) + ("C-c C-c q" . lsp-workspace-restart) + ("C-c C-c Q" . lsp-workspace-shutdown) + ("C-c C-c s" . lsp-rust-analyzer-status)) + :config + ;; uncomment for less flashiness + ;; (setq lsp-eldoc-hook nil) + ;; (setq lsp-enable-symbol-highlighting nil) + ;; (setq lsp-signature-auto-activate nil) + + ;; comment to disable rustfmt on save + (setq rustic-format-on-save t) + (add-hook 'rustic-mode-hook 'rk/rustic-mode-hook)) + +(defun rk/rustic-mode-hook () + ;; so that run C-c C-c C-r works without having to confirm, but don't try to + ;; save rust buffers that are not file visiting. Once + ;; https://github.com/brotzeit/rustic/issues/253 has been resolved this should + ;; no longer be necessary. + (when buffer-file-name + (setq-local buffer-save-without-query t)) + (add-hook 'before-save-hook 'lsp-format-buffer nil t)) + +;; Tree-sitter +(use-package treesit-auto + :config + (global-treesit-auto-mode) + (setq treesit-auto-install t)) + +;; Vterm +(use-package vterm) + +;; Org mode +(use-package toc-org + :hook (org-mode-hook . toc-org-enable)) +(add-hook 'org-mode-hook 'org-indent-mode) +(use-package org-bullets + :hook (org-mode-hook . (lambda () (org-bullets-mode)))) + +;; GUI tweaks +;; Display numbers +(global-display-line-numbers-mode 1) +(global-visual-line-mode t) + +;; Theme +(use-package autothemer) +(use-package catppuccin-theme + :ensure t + :config + (load-theme 'catppuccin t) + (setq catppuccin-flavor 'mocha) + (catppuccin-reload)) + +;; Fonts +(set-face-attribute 'default nil + :font "Source Code Pro" + :height 113 + :weight 'medium) +(set-face-attribute 'fixed-pitch nil + :font "Source Code Pro" + :height 113 + :weight 'medium) +(set-face-attribute 'variable-pitch nil + :font "Rubik" + :height 113 + :weight 'medium) +(set-face-attribute 'font-lock-comment-face nil + :slant 'italic) +(set-face-attribute 'font-lock-keyword-face nil + :weight 'bold) + +;; Icons +(use-package all-the-icons + :ensure t + :if (display-graphic-p)) +(use-package all-the-icons-dired + :hook (dired-mode . (lambda () + all-the-icons-dired-mode t))) + +;; Modeline +(use-package mood-line + :init + (mood-line-mode) + :config + (setq mood-line-glyph-alist mood-line-glyphs-unicode)) + +;; Scrolling +(use-package good-scroll + :init (good-scroll-mode)) + +;; Dashboard +(use-package dashboard + :init + (dashboard-setup-startup-hook) + :config + (setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*"))) + (setq dashboard-banner-logo-title "Yep, it's emacs, not vim") + (setq dashboard-startup-banner 'logo) + (setq dashboard-center-content t)) + +;; Vterm + + +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(package-selected-packages '(nix-mode)) + '(warning-suppress-types + '((comp) + (comp) + (comp) + (comp) + (comp) + (comp) + (comp) + (comp) + (comp) + (comp) + (comp) + (comp) + (comp)))) +(custom-set-faces) + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + diff --git a/home-manager/programs/firefox/default.nix b/home-manager/programs/firefox/default.nix index 58bd4c9..92d8e29 100644 --- a/home-manager/programs/firefox/default.nix +++ b/home-manager/programs/firefox/default.nix @@ -63,6 +63,18 @@ let updateInterval = 24 * 60 * 60 * 1000; definedAliases = [ "!nw" ]; }; + "Kinopoisk" = { + urls = [{ template = "https://www.kinopoisk.ru/index.php?kp_query={searchTerms}"; }]; + iconUpdateURL = "https://www.kinopoisk.ru/favicon.ico"; + updateInterval = 24 * 60 * 60 * 1000; + definedAliases = [ "!ks" ]; + }; + "AnimeGo" = { + urls = [{ template = "https://animego.org/search/all?q={searchTerms}"; }]; + iconUpdateURL = "https://animego.org/favicon-32x32.png"; + updateInterval = 24 * 60 * 60 * 1000; + definedAliases = [ "!as" ]; + }; }; in { diff --git a/home-manager/programs/ranger/default.nix b/home-manager/programs/ranger/default.nix index 8e8ef1d..b77b924 100644 --- a/home-manager/programs/ranger/default.nix +++ b/home-manager/programs/ranger/default.nix @@ -1,16 +1,11 @@ { pkgs, ... }: -let - configFiles = { +{ + home.packages = [ pkgs.ranger ]; + xdg.configFile = { "ranger/rc.conf".text = builtins.readFile ./rc.conf; "ranger/rifle.conf".text = builtins.readFile ./rifle.conf; "ranger/scope.sh".text = builtins.readFile ./scope.sh; "ranger/commands.py".source = ./commands.py; "ranger/plugins".source = ./plugins; }; -in -{ - home.packages = [ pkgs.ranger ]; - xdg.configFile = { - inherit (configFiles); - }; } diff --git a/home-manager/programs/ranger/default.nix~ b/home-manager/programs/ranger/default.nix~ new file mode 100644 index 0000000..ea1b298 --- /dev/null +++ b/home-manager/programs/ranger/default.nix~ @@ -0,0 +1,7 @@ +{ pkgs, ... }: +let + "ranger/rc.conf".text = builtins.readFile ./rc.conf; + "ranger/rifle.conf".text = builtins.readFile ./rifle.conf; + "ranger/scope.sh".text = builtins.readFile ./scope.sh; + "ranger/commands.py".source = ./commands.py; + "ranger/plugins".source = ./plugins; diff --git a/nixos/#hardware-configuration.nix# b/nixos/#hardware-configuration.nix# new file mode 100644 index 0000000..8d69197 --- /dev/null +++ b/nixos/#hardware-configuration.nix# @@ -0,0 +1,90 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ata_piix" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/74a99a85-4705-4108-99ac-7e391f5a45d8"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/92C7-3768"; + fsType = "vfat"; + }; + + fileSystems."/home/jerpo/bigdrive" = + { device = "/dev/disk/by-uuid/15ed0e39-280c-42c7-a886-742f95866ded"; + fsType = "btrfs"; + options = [ + "user" + "auto" + "async" + "nofail" + "rw" + "dev" + "suid" + "exec" + ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/2b0e2731-0821-4795-8f37-c60069c0a9b9"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp3s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + # Nvidia drivers + # Make sure opengl is enabled + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; + + # NVIDIA drivers are unfree. + nixpkgs.config.allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) [ + "nvidia-x11" + ]; + + # Tell Xorg to use the nvidia driver + services.xserver.videoDrivers = ["nvidia"]; + + hardware.nvidia = { + + # Modesetting is needed for most wayland compositors + modesetting.enable = true; + + # Use the open source version of the kernel module + # Only available on driver 515.43.04+ + open = false; + + # Enable the nvidia settings menu + nvidiaSettings = true; + + # Optionally, you may need to select the appropriate driver version for your specific GPU. + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + hardware.opentabletdriver = { + enable = true; + daemon.enable = true; + }; +} diff --git a/nixos/configuration.new.nix~ b/nixos/configuration.new.nix~ new file mode 100644 index 0000000..5b6f6c4 --- /dev/null +++ b/nixos/configuration.new.nix~ @@ -0,0 +1,100 @@ +# This is your system's configuration file. +# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) + +{ inputs, outputs, lib, config, pkgs, ... }: { + # You can import other NixOS modules here + imports = [ + # If you want to use modules your own flake exports (from modules/nixos): + # outputs.nixosModules.example + + # Or modules from other flakes (such as nixos-hardware): + # inputs.hardware.nixosModules.common-cpu-amd + # inputs.hardware.nixosModules.common-ssd + + # You can also split up your configuration and import pieces of it here: + # ./users.nix + + # Import your generated (nixos-generate-config) hardware configuration + ./hardware-configuration.nix + ]; + + nixpkgs = { + # You can add overlays here + overlays = [ + # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages + + # You can also add overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + }; + }; + + nix = { + # This will add each flake input as a registry + # To make nix3 commands consistent with your flake + registry = lib.mapAttrs (_: value: { flake = value; }) inputs; + + # This will additionally add your inputs to the system's legacy channels + # Making legacy nix commands consistent as well, awesome! + nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; + + settings = { + # Enable flakes and new 'nix' command + experimental-features = "nix-command flakes"; + # Deduplicate and optimize nix store + auto-optimise-store = true; + }; + }; + + # FIXME: Add the rest of your current configuration + + # TODO: Set your hostname + networking.hostName = "your-hostname"; + + # TODO: This is just an example, be sure to use whatever bootloader you prefer + boot.loader.systemd-boot.enable = true; + + # TODO: Configure your system-wide user settings (groups, etc), add more users as needed. + users.users = { + # FIXME: Replace with your username + your-username = { + # TODO: You can set an initial password for your user. + # If you do, you can skip setting a root password by passing '--no-root-passwd' to nixos-install. + # Be sure to change it (using passwd) after rebooting! + initialPassword = "correcthorsebatterystaple"; + isNormalUser = true; + openssh.authorizedKeys.keys = [ + # TODO: Add your SSH public key(s) here, if you plan on using SSH to connect + ]; + # TODO: Be sure to add any other groups you need (such as networkmanager, audio, docker, etc) + extraGroups = [ "wheel" ]; + }; + }; + + # This setups a SSH server. Very important if you're setting up a headless system. + # Feel free to remove if you don't need it. + services.openssh = { + enable = true; + # Forbid root login through SSH. + permitRootLogin = "no"; + # Use keys only. Remove if you want to SSH using password (not recommended) + passwordAuthentication = false; + }; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + system.stateVersion = "23.05"; +} \ No newline at end of file diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 38e1cc2..e07e670 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -17,6 +17,7 @@ outputs.overlays.additions outputs.overlays.modifications outputs.overlays.unstable-packages + outputs.overlays.emacs-overlay # You can also add overlays exported from other flakes: # neovim-nightly-overlay.overlays.default @@ -75,7 +76,7 @@ # Layout layout = "us,ru"; - xkbOptions = "grp:win_space_toggle,grp:alt_shift_toggle"; + xkbOptions = "grp:win_space_toggle"; }; # Printing diff --git a/nixos/configuration.old.nix b/nixos/configuration.old.nix new file mode 100644 index 0000000..9f5bdb6 --- /dev/null +++ b/nixos/configuration.old.nix @@ -0,0 +1,181 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, inputs, outputs, ... }: + +{ + imports = + [ + ./hardware-configuration.nix + inputs.home-manager.nixosModules.home-manager + ]; + + home-manager = { + extraSpecialArgs = { inherit inputs outputs; }; + useGlobalPkgs = true; + useUserPackages = true; + users.jerpo = import ../home-manager/home.nix; + }; + + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 1w"; + }; + + nix.settings.auto-optimise-store = true; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "ltrr"; + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + # networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "Asia/Yekaterinburg"; + + # Select internationalisation properties. + i18n.defaultLocale = "ru_RU.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "ru_RU.UTF-8"; + LC_IDENTIFICATION = "ru_RU.UTF-8"; + LC_MEASUREMENT = "ru_RU.UTF-8"; + LC_MONETARY = "ru_RU.UTF-8"; + LC_NAME = "ru_RU.UTF-8"; + LC_NUMERIC = "ru_RU.UTF-8"; + LC_PAPER = "ru_RU.UTF-8"; + LC_TELEPHONE = "ru_RU.UTF-8"; + LC_TIME = "ru_RU.UTF-8"; + }; + + # Enable the X11 windowing system. + services.xserver = { + enable = true; + displayManager.sddm = { + enable = true; + theme = "sugar-dark"; + }; + # displayManager.startx.enable = true; + displayManager.defaultSession = "none+bspwm"; + desktopManager.gnome.enable = true; + windowManager.dwm.enable = true; + windowManager.bspwm.enable = true; + }; + + # Configure keymap in X11 + services.xserver = { + layout = "us,ru"; + xkbOptions = "grp:win_space_toggle,grp:alt_shift_toggle"; + }; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + + # no need to redefine it in your config for now) + #media-session.enable = true; + }; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + programs.fish.enable = true; + users.defaultUserShell = pkgs.fish; + users.users.jerpo = { + isNormalUser = true; + description = "jerpo"; + extraGroups = [ "networkmanager" "wheel" ]; + }; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + vim + wget + git + firefox + neovim + ripgrep + fd + killall + fzf + silver-searcher + tldr + unzip + cmake + python3Full + nodejs_20 + xorg.xinit + gnumake + gcc + btrfs-progs + ntfs3g + libtool + jq + vkd3d + dxvk + wineWowPackages.full + wineWowPackages.fonts + winetricks + nvtop-nvidia + nix-prefetch-scripts + xkb-switch + pamixer + rustup + linuxKernel.packages.linux_6_4.v4l2loopback + v4l-utils + ]; + + services.v2raya.enable = true; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "23.05"; # Did you read the comment? + +} diff --git a/overlays/default.nix b/overlays/default.nix index 9a03471..c97252a 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -13,6 +13,8 @@ # }); }; + emacs-overlay = import inputs.emacs-overlay; + # When applied, the unstable nixpkgs set (declared in the flake inputs) will # be accessible through 'pkgs.unstable' unstable-packages = final: _prev: { diff --git a/pkgs/pokemon-colorscripts/#default.nix# b/pkgs/pokemon-colorscripts/#default.nix# new file mode 100644 index 0000000..4932153 --- /dev/null +++ b/pkgs/pokemon-colorscripts/#default.nix# @@ -0,0 +1,21 @@ +Подготовительный этап : зостерин 30% утром и вечером натощак на 10 дней +Программа на трематод : + +1. Этап дренаж на 14-16 дней , до конца флаконов +Лимфомиозот по 10 капель с водой 3 раза в день +Популюс по 10 капель с водой 3 раза в день +Хелидониум гомакорд по 10 капель с водой 3 раза в день +Можно все по 30 капель в литровую бутылку и пить по глоточку в течение дня + +2. Этап . Детокс с поддержкой органов на 35 дней (5 недель ) начинаем через 7 дней от начала первого этапа +Уколы +Солидаго композитум + Тонзилла композитум в один шприц подкожно - Вторник и Пятница (итого 10 уколов) +Плацента композитум + Пульсатилла композитум в один шприц - понедельник и четверг (итого 10 уколов) + +3. Этап - воздействие на трематоду на 21 день , начинаем через 14 дней от начала уколов +Viola odorata c3 (производитель Гута) 8 горошин утром +Описторхосан по 8 горошин 2 раза в день + +4. Этап - гвоздика по 2 капсуле 3 раза в день , перед едой . На 14 дней . Начинать с 1 капсулы , те может раздражать слизистую +5. Параллельно принимаем базу в виде Аргинина по 1000 мг (1 капсула ) перед едой с утра на 30 дней +6. Хлореллу в течение всего курса по 2 чайной ложке на стакан воды за 20 минут до еды ! \ No newline at end of file diff --git a/result b/result new file mode 120000 index 0000000..fc7ce5e --- /dev/null +++ b/result @@ -0,0 +1 @@ +/nix/store/jfrr436cbyi18zcvz4a6ay982lhypic5-minicava-0.1 \ No newline at end of file -- cgit v1.2.3