From: Preston Pan Date: Tue, 14 Jan 2025 06:11:02 +0000 (-0800) Subject: merge these two repos into one X-Git-Url: https://ret2pop.net/gitweb/monorepo.git?a=commitdiff_plain;h=dd461e48043dabee4694e2b200f4c1d9cfdbc3d9;p=monorepo.git merge these two repos into one --- diff --git a/agenda.org b/agenda.org index 8a95b0c..48ff92b 100644 --- a/agenda.org +++ b/agenda.org @@ -12,31 +12,72 @@ #+html_head: #+html_head: #+html_head: + +This agenda is a public list of things that I need to keep track of. This is public because +I also keep a private version, and if anyone wants to know what I'm up to or the status of a certain +project, it can be referenced here. + * Tasks -These are general life tasks that I need to do, not following a schedule. -** TODO Resume +These are general life tasks that I need to do, which don't depend on a specific time or date. +** TODO [#A] ToughNix +I need to work on my monorepo flake which builds all my systems, and should accommodate future +systems and also should be relatively abstractable (i.e. identifiers tied to me should be easily +removed from the flake). +*** TODO [#A] NixOS Modules +:LOGBOOK: +CLOCK: [2025-01-11 Sat 17:03]--[2025-01-11 Sat 19:35] => 2:32 +:END: +I need to fix my NixOS configuration to not be as monolithic and to be more modular. +*** TODO [#B] VPS +My VPS needs to be a NixOS configuration. +*** TODO [#B] Workstation +My NixOS Monorepo needs to incorporate my workstation, and I need to install this config. +*** TODO [#C] Gammastep +Fix gammastep in my config so that it actually works on my dell machine. +** TODO [#B] Resume I need to update my resume with my work experience. Additionally, I want to re-write my resume in org mode. -** NixOS Configuration -*** TODO Gammastep -Fix gammastep in my config so that it actually works on my dell machine. -*** TODO VPS -My VPS needs to be a NixOS configuration. -** TODO Umami +** TODO [#B] Nullring +Update the nullring to be in org mode, and also include a couple more sites. +** TODO [#B] Umami My client server protocol needs to continue to be written. I also need to make a git repository for it. ** Music and Media -*** TODO Write Another Song +*** TODO [#B] Write Another Song I want to write another song. -** TODO Analogue Computer +*** TODO [#B] Make A YouTube Video +I want to start making YouTube videos. +** TODO [#C] Analogue Computer I want to make an analogue computer. -* Friends -These are tasks related to seeing my friends. -** TODO Travis and Friends Meetup -Eating dinner with them. -SCHEDULED: <2025-01-12 Sun> -* Groceries +** TODO [#A] Dishes +There will be a TODO when I need to do the dishes. +** Groceries There will be a TODO when I need to get groceries. -* TODO Dishes -There will be a TODO when I need to do the dishes. +* Scheduled tasks +These are one-time tasks that are scheduled at a particular date, and that don't require regular +schedules. +** Friends +These are tasks related to seeing my friends. There will be tasks listed here when I schedule +something. +*** TODO Travis and Friends Meetup +SCHEDULED: <2025-01-12 Sun 17:00> +Eating dinner with them. + +* Habits +These are some habits I want to track. They are repeated according to a calendar schedule in +general. +** TODO Stretch +SCHEDULED: <2025-01-12 Sun .+1d> +:PROPERTIES: +:LAST_REPEAT: [2025-01-11 Sat 02:26] +:END: +- State "DONE" from "TODO" [2025-01-11 Sat 02:26] +I want to stretch every day so that I can become more flexible. +** TODO Journal +SCHEDULED: <2025-01-12 Sun .+1d> +:PROPERTIES: +:LAST_REPEAT: [2025-01-11 Sat 02:25] +:END: +- State "DONE" from "TODO" [2025-01-11 Sat 02:25] +I want to journal every day, at least a little bit, about my life and track it with a git repo. diff --git a/config/emacs.el b/config/emacs.el index b242e7d..57dda45 100644 --- a/config/emacs.el +++ b/config/emacs.el @@ -2,129 +2,125 @@ (setq system-username "prestonpan") (setq system-fullname "Preston Pan") -(require 'tex-site) -(pixel-scroll-precision-mode 1) -(setq scroll-conservatively 101) -(display-battery-mode 1) -(setq display-time-24hr-format t) -(display-time-mode 1) -(menu-bar-mode -1) -(scroll-bar-mode -1) -(tool-bar-mode -1) -(load-theme 'catppuccin :no-confirm) -(setq display-line-numbers-type 'relative) -(add-hook 'prog-mode-hook #'display-line-numbers-mode) -(add-hook 'org-mode-hook #'display-line-numbers-mode) -(setq org-confirm-babel-evaluate nil) -(set-face-attribute 'default nil :height 120) -(setq use-short-answers t) -(setq make-backup-files nil) -(setq org-export-with-broken-links t) -(setq org-src-fontify-natively t) -;; (setq org-highlight-latex-and-related '(latex script entities)) -(setq warning-minimum-level :emergency) -(add-hook 'text-mode-hook 'visual-line-mode) -(and window-system (server-start)) -(setq debug-ignored-errors - (cons 'remote-file-error debug-ignored-errors)) -(set-face-attribute 'default nil :font "Iosevka Nerd Font" :height 140) -(setq preview-default-option-list '("displaymath" "textmath" "graphics")) -(setq preview-image-type 'png) -(setq org-latex-pdf-process - '("xelatex -interaction=nonstopmode -output-directory=%o %f")) -(setq org-latex-preview-image-directory (expand-file-name "~/.cache/ltximg/")) -(setq org-preview-latex-image-directory (expand-file-name "~/.cache/ltximg/")) -(setq-default line-spacing 2) -(setq org-startup-with-latex-preview t) -(setq-default org-startup-indented t - org-pretty-entities t - org-use-sub-superscripts "{}" - org-hide-emphasis-markers t - org-startup-with-inline-images t - org-image-actual-width '(300)) - -(setq-default fill-column 100) -(add-hook 'text-mode-hook #'auto-fill-mode) -(add-hook 'prog-mode-hook #'auto-fill-mode) -(add-hook 'org-mode-hook #'auto-fill-mode) - -(setopt display-fill-column-indicator-column 100) -(add-hook 'prog-mode-hook #'display-fill-column-indicator-mode) -(add-hook 'org-mode-hook #'display-fill-column-indicator-mode) -(setq TeX-engine 'xetex) - -(add-hook 'prog-mode-hook - (lambda () - (setq prettify-symbols-alist - '(("lambda" . ?λ) - ("->" . ?→) - ("map" . ?↦) - ("/=" . ?≠) - ("!=" . ?≠) - ("==" . ?≡) - ("<=" . ?≤) - (">=" . ?≥) - ("&&" . ?∧) - ("||" . ?∨) - ("sqrt" . ?√) - ("..." . ?…))) - (prettify-symbols-mode))) - -(add-hook 'org-mode-hook (lambda () - (setq prettify-symbols-alist - '(("#+begin_src" . ?) - ("#+BEGIN_SRC" . ?) - ("#+end_src" . ?) - ("#+END_SRC" . ?) - ("#+begin_example" . ?) - ("#+BEGIN_EXAMPLE" . ?) - ("#+end_example" . ?) - ("#+END_EXAMPLE" . ?) - ("#+header:" . ?) - ("#+HEADER:" . ?) - ("#+name:" . ?﮸) - ("#+NAME:" . ?﮸) - ("#+results:" . ?) - ("#+RESULTS:" . ?) - ("#+call:" . ?) - ("#+CALL:" . ?) - (":PROPERTIES:" . ?) - (":properties:" . ?) - ("lambda" . ?λ) - ("->" . ?→) - ("map" . ?↦) - ("/=" . ?≠) - ("!=" . ?≠) - ("==" . ?≡) - ("<=" . ?≤) - (">=" . ?≥) - ("&&" . ?∧) - ("||" . ?∨) - ("sqrt" . ?√) - ("..." . ?…)))) - (prettify-symbols-mode)) -(global-prettify-symbols-mode 1) - -(use-package unicode-fonts - :init (unicode-fonts-setup)) - -(set-frame-parameter nil 'alpha-background 90) -(add-to-list 'default-frame-alist '(alpha-background . 90)) - -(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) -(setq mouse-wheel-progressive-speed nil) -(setq mouse-wheel-follow-mouse 't) -(setq scroll-step 1) - -(require 'org-habit) -(setq org-agenda-files (list "~/org/agenda.org" - "~/org/notes.org" - "~/org/website/agenda.org")) -(setq org-default-notes-file (concat org-directory "/notes.org")) -(setq org-habit-preceding-days 1) - -(require 'ox-publish) -(setq org-publish-project-alist +(use-package emacs + :custom + (scroll-conservatively 101) + (display-time-24hr-format t) + (display-line-numbers-type 'relative) + (use-short-answers t) + (make-backup-files nil) + (warning-minimum-level :emergency) + (debug-ignored-errors + (cons 'remote-file-error debug-ignored-errors)) + (mouse-wheel-scroll-amount '(1 ((shift) . 1))) + (mouse-wheel-progressive-speed nil) + (mouse-wheel-follow-mouse 't) + (scroll-step 1) + (display-fill-column-indicator-column 100) + :config + (require 'tex-site) + (pixel-scroll-precision-mode 1) + (display-battery-mode 1) + (display-time-mode 1) + (menu-bar-mode -1) + (scroll-bar-mode -1) + (tool-bar-mode -1) + (and window-system (server-start)) + (load-theme 'catppuccin :no-confirm) + (set-face-attribute 'default nil :height 120) + (set-frame-parameter nil 'alpha-background 90) + (add-to-list 'default-frame-alist '(alpha-background . 90)) + (set-face-attribute 'default nil :font "Iosevka Nerd Font" :height 140) + (setq-default line-spacing 2) + (setq-default fill-column 100) + (global-prettify-symbols-mode 1) + + :hook ((text-mode . auto-fill-mode) + (text-mode . visual-line-mode) + (prog-mode . auto-fill-mode) + (prog-mode . display-line-numbers-mode) + (prog-mode . display-fill-column-indicator-mode) + (org-mode . auto-fill-mode) + (org-mode . display-fill-column-indicator-mode) + + (org-mode . (lambda () + (setq prettify-symbols-alist + '(("#+begin_src" . ?) + ("#+BEGIN_SRC" . ?) + ("#+end_src" . ?) + ("#+END_SRC" . ?) + ("#+begin_example" . ?) + ("#+BEGIN_EXAMPLE" . ?) + ("#+end_example" . ?) + ("#+END_EXAMPLE" . ?) + ("#+header:" . ?) + ("#+HEADER:" . ?) + ("#+name:" . ?﮸) + ("#+NAME:" . ?﮸) + ("#+results:" . ?) + ("#+RESULTS:" . ?) + ("#+call:" . ?) + ("#+CALL:" . ?) + (":PROPERTIES:" . ?) + (":properties:" . ?) + ("lambda" . ?λ) + ("->" . ?→) + ("map" . ?↦) + ("/=" . ?≠) + ("!=" . ?≠) + ("==" . ?≡) + ("<=" . ?≤) + (">=" . ?≥) + ("&&" . ?∧) + ("||" . ?∨) + ("sqrt" . ?√) + ("..." . ?…))) + (prettify-symbols-mode))) + (prog-mode . + (lambda () + (setq prettify-symbols-alist + '(("lambda" . ?λ) + ("->" . ?→) + ("map" . ?↦) + ("/=" . ?≠) + ("!=" . ?≠) + ("==" . ?≡) + ("<=" . ?≤) + (">=" . ?≥) + ("&&" . ?∧) + ("||" . ?∨) + ("sqrt" . ?√) + ("..." . ?…))) + (prettify-symbols-mode))))) + +(use-package org + :init + (setq org-confirm-babel-evaluate nil) + (setq org-export-with-broken-links t) + (setq org-src-fontify-natively t) + (setq org-latex-preview-image-directory (expand-file-name "~/.cache/ltximg/")) + (setq org-preview-latex-image-directory (expand-file-name "~/.cache/ltximg/")) + (setq org-latex-pdf-process + '("xelatex -interaction=nonstopmode -output-directory=%o %f")) + (setq preview-default-option-list '("displaymath" "textmath" "graphics")) + (setq preview-image-type 'png) + (setq TeX-engine 'xetex) + (setq TeX-PDF-mode t) + (setq org-format-latex-options (plist-put org-format-latex-options :scale 1.5)) + (setq org-return-follows-link t) + (setq org-startup-with-latex-preview t) + (setq org-habit-preceding-days 1) + (setq-default org-startup-indented t + org-pretty-entities t + org-use-sub-superscripts "{}" + org-hide-emphasis-markers t + org-startup-with-inline-images t + org-image-actual-width '(300)) + (setq org-agenda-files (list "~/org/agenda.org" + "~/org/notes.org" + "~/org/website/agenda.org")) + (setq org-default-notes-file (concat org-directory "/notes.org")) + (setq org-publish-project-alist '(("website-org" :base-directory "~/org/website" :base-extension "org" @@ -141,28 +137,22 @@ :recursive t :publishing-function org-publish-attachment) ("website" :auto-sitemap t :components ("website-org" "website-static")))) -(setq org-html-postamble "Copyright © 2024 Preston Pan") - -(defun electric-pair () - "If at end of line, insert character pair without surrounding spaces. -Otherwise, just insert the typed character." - (interactive) - (if (eolp) (let (parens-require-spaces) (insert-pair)) (self-insert-command 1))) - -(add-hook 'org-mode-hook - (lambda () - (define-key org-mode-map "\"" 'electric-pair) - (define-key org-mode-map "(" 'electric-pair) - (define-key org-mode-map "[" 'electric-pair) - (define-key org-mode-map "{" 'electric-pair))) - -(add-hook 'prog-mode-hook - (lambda () - (define-key prog-mode-map "\"" 'electric-pair) - (define-key prog-mode-map "(" 'electric-pair) - (define-key prog-mode-map "[" 'electric-pair) - (define-key prog-mode-map "{" 'electric-pair))) -(electric-pair-mode) + (setq org-html-postamble "Copyright © 2024 Preston Pan") + :config + (require 'ox-publish) + (require 'org-tempo) + (require 'org-habit) + (org-babel-do-load-languages 'org-babel-load-languages + '((shell . t) + (python . t) + (latex . t)))) + +(use-package unicode-fonts + :init (unicode-fonts-setup)) + +(use-package electric-pair + :hook ((org-mode . electric-pair-mode) + (prog-mode . electric-pair-mode))) (use-package lyrics-fetcher :after (emms) @@ -176,15 +166,16 @@ Otherwise, just insert the typed character." (use-package yasnippet :config (add-to-list 'yas-snippet-dirs "~/org/website/yasnippet/") - (yas-global-mode 1)) -(add-hook 'org-mode-hook - (lambda () (yas-minor-mode) - (yas-activate-extra-mode 'latex-mode))) - -(eval-after-load "company" '(add-to-list 'company-backends - '(company-ispell company-capf company-irony - company-yasnippet company-files))) -(add-hook 'after-init-hook 'global-company-mode) + (yas-global-mode 1) + :hook (org-mode . (lambda () (yas-minor-mode) (yas-activate-extra-mode 'latex-mode)))) + +(use-package company + :config + '(add-to-list 'company-backends + '(company-ispell company-capf company-irony + company-yasnippet company-files)) + :hook ((after-init . global-company-mode))) + (use-package ispell :init (setq ispell-program-name "aspell") @@ -192,18 +183,9 @@ Otherwise, just insert the typed character." (setq ispell-dictionary "en") (setq ispell-alternate-dictionary "~/.local/share/dict")) -(dolist (hook '(text-mode-hook)) - (add-hook hook (lambda () (flyspell-mode 1)))) - -(org-babel-do-load-languages 'org-babel-load-languages - '( - (shell . t) - (python . t) - (latex . t) - ) -) +(use-package flyspell + :hook (text-mode . flyspell-mode)) -(require 'org-tempo) (use-package evil :init (setq evil-want-keybinding nil) @@ -212,6 +194,7 @@ Otherwise, just insert the typed character." (evil-set-undo-system 'undo-redo)) (use-package evil-collection + :after (evil) :init (setq evil-want-keybinding nil) :config @@ -222,11 +205,12 @@ Otherwise, just insert the typed character." (define-key evil-motion-state-map (kbd "TAB") nil)) (use-package evil-commentary + :after (evil) :config (evil-commentary-mode)) (use-package evil-org - :after org + :after (evil org) :hook (org-mode . (lambda () evil-org-mode)) :config (require 'evil-org-agenda) @@ -258,28 +242,24 @@ Otherwise, just insert the typed character." (setq org-journal-file-header 'org-journal-file-header-func) (setq org-journal-file-format "%Y%m%d.org") - (setq org-journal-enable-agenda-integration t) -) + (setq org-journal-enable-agenda-integration t)) (use-package doom-modeline :config (doom-modeline-mode 1)) -(use-package writegood-mode) - -(dolist (hook '(text-mode-hook)) - (add-hook hook (lambda () (writegood-mode)))) +(use-package writegood-mode + :hook (text-mode . writegood-mode)) (use-package org-superstar :after (org) - :config - (add-hook 'org-mode-hook (lambda () (org-superstar-mode 1)))) + :hook (org-mode . (lambda () (org-superstar-mode 1)))) (use-package eglot :config (add-to-list 'eglot-server-programs '(nix-mode . ("nil"))) - (add-hook 'prog-mode-hook 'eglot-ensure) :hook + (prog-mode . eglot-ensure) (nix-mode . eglot-ensure)) (use-package lsp :hook @@ -288,14 +268,14 @@ Otherwise, just insert the typed character." :hook (prog-mode . platformio-conditionally-enable)) (use-package irony-mode - :config - (add-hook 'c++-mode-hook 'irony-mode) - (add-hook 'c-mode-hook 'irony-mode) - (add-hook 'objc-mode-hook 'irony-mode) - (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)) + :hook ( + (c++-mode . irony-mode) + (c-mode . irony-mode) + (objc-mode . irony-mode) + (irony-mode . irony-cdb-autosetup-compile-options))) (use-package irony-eldoc - :config (add-hook 'irony-mode-hook #'irony-eldoc)) + :hook ((irony-mode . irony-eldoc))) (use-package solidity-mode) (use-package company-solidity) @@ -304,7 +284,7 @@ Otherwise, just insert the typed character." (setq solidity-flycheck-solc-checker-active t)) (use-package flycheck - :init (global-flycheck-mode)) + :config (global-flycheck-mode)) (use-package projectile :init @@ -333,55 +313,52 @@ Otherwise, just insert the typed character." :init (setq ivy-use-virtual-buffers t) (setq enable-recursive-minibuffers t) + :bind ;; enable this if you want `swiper' to use it ;; (setq search-default-mode #'char-fold-to-regexp) - (global-set-key "\C-s" 'swiper) - (global-set-key (kbd "C-c C-r") 'ivy-resume) - (global-set-key (kbd "") 'ivy-resume) - (global-set-key (kbd "M-x") 'counsel-M-x) - (global-set-key (kbd "C-x C-f") 'counsel-find-file) - (global-set-key (kbd " f") 'counsel-describe-function) - (global-set-key (kbd " v") 'counsel-describe-variable) - (global-set-key (kbd " o") 'counsel-describe-symbol) - (global-set-key (kbd " l") 'counsel-find-library) - (global-set-key (kbd " i") 'counsel-info-lookup-symbol) - (global-set-key (kbd " u") 'counsel-unicode-char) - (global-set-key (kbd "C-c g") 'counsel-git) - (global-set-key (kbd "C-c j") 'counsel-git-grep) - (global-set-key (kbd "C-c k") 'counsel-ag) - (global-set-key (kbd "C-x l") 'counsel-locate) - (global-set-key (kbd "C-S-o") 'counsel-rhythmbox) + ("C-s" . swiper) + ("C-c C-r" . ivy-resume) + ("M-x" . counsel-M-x) + ("C-x C-f" . counsel-find-file) + (" f" . counsel-describe-function) + (" v" . counsel-describe-variable) + (" o" . counsel-describe-symbol) + (" l" . counsel-find-library) + (" i" . counsel-info-lookup-symbol) + (" u" . counsel-unicode-char) + ("C-c g" . counsel-git) + ("C-c j" . counsel-git-grep) + ("C-c k" . counsel-ag) + ("C-x l" . counsel-locate) :config (ivy-mode)) (define-key ivy-minibuffer-map (kbd "C-j") 'ivy-immediate-done) (use-package magit) -(setq - erc-nick system-username - erc-user-full-name system-fullname) - -(defun prestonpan () - (interactive) - (erc-tls :server "nullring.xyz" - :port "6697")) - -(defun liberachat () - (interactive) - (erc-tls :server "irc.libera.chat" - :port "6697")) - - -(defun efnet () - (interactive) - (erc-tls :server "irc.prison.net" - :port "6697")) - -(defun matrix-org () - (interactive) - (ement-connect :uri-prefix "http://localhost:8009")) +(use-package erc + :init + (setq + erc-nick system-username + erc-user-full-name system-fullname)) (use-package general + :init + (defun prestonpan () + (interactive) + (erc-tls :server "nullring.xyz" + :port "6697")) + (defun liberachat () + (interactive) + (erc-tls :server "irc.libera.chat" + :port "6697")) + (defun efnet () + (interactive) + (erc-tls :server "irc.prison.net" + :port "6697")) + (defun matrix-org () + (interactive) + (ement-connect :uri-prefix "http://localhost:8009")) :config (general-create-definer leader-key :prefix "SPC") @@ -434,8 +411,7 @@ Otherwise, just insert the typed character." "w r" '(writeroom-mode :wk "focus mode for writing") "y n s" '(yas-new-snippet :wk "Create new snippet") "u w" '((lambda () (interactive) (shell-command "rsync -azvP ~/website_html/ root@nullring.xyz:/usr/share/nginx/ret2pop/")) :wk "rsync website update") - "h r r" '(lambda () (interactive) (org-babel-load-file (expand-file-name "~/org/website/config/emacs.org"))) - )) + "h r r" '(lambda () (interactive) (org-babel-load-file (expand-file-name "~/org/website/config/emacs.org"))))) (use-package ellama :init @@ -447,9 +423,10 @@ Otherwise, just insert the typed character." :chat-model "gemma:7b"))) (use-package elfeed + :hook ((elfeed-search-mode . elfeed-update)) :init - (add-hook 'elfeed-search-mode-hook #'elfeed-update) (setq elfeed-search-filter "@1-month-ago +unread")) + (use-package elfeed-org :init (setq rmh-elfeed-org-files '("~/org/website/config/elfeed.org")) @@ -487,21 +464,21 @@ Otherwise, just insert the typed character." (use-package treemacs-magit :after (treemacs magit)) -(setq search-engines - '( - (("google" "g") "https://google.com/search?q=%s") - (("duckduckgo" "d" "ddg") "https://duckduckgo.com/?q=%s") - (("rfc" "r") "https://www.rfc-editor.org/rfc/rfc%s.txt") - (("rfc-kw" "rk") "https://www.rfc-editor.org/search/rfc_search_detail.php?title=%s"))) +(use-package eww + :init + (setq search-engines + '((("google" "g") "https://google.com/search?q=%s") + (("duckduckgo" "d" "ddg") "https://duckduckgo.com/?q=%s") + (("rfc" "r") "https://www.rfc-editor.org/rfc/rfc%s.txt") + (("rfc-kw" "rk") "https://www.rfc-editor.org/search/rfc_search_detail.php?title=%s"))) -(setq search-engine-default "google") -(setq eww-search-prefix "https://google.com/search?q=") -(setq browse-url-secondary-browser-function 'browse-url-generic browse-url-generic-program "firefox") -;; (setq browse-url-browser-function "firefox") -(add-hook 'eww-mode-hook - (lambda () (local-set-key (kbd "y Y") #'eww-copy-page-url))) + (setq search-engine-default "google") + (setq eww-search-prefix "https://google.com/search?q=") + (setq browse-url-secondary-browser-function 'browse-url-generic browse-url-generic-program "firefox") + :hook ((eww-mode . (lambda () (local-set-key (kbd "y Y") #'eww-copy-page-url))))) (use-package org-roam + :after (org) :init (setq org-roam-db-update-on-save t) (setq org-roam-graph-viewer "chromium") @@ -526,24 +503,23 @@ Otherwise, just insert the typed character." :init (setq epa-pinentry-mode `loopback) :config (pinentry-start)) -(setq TeX-PDF-mode t) -(setq org-format-latex-options (plist-put org-format-latex-options :scale 1.5)) -(setq org-return-follows-link t) ;; (use-package latex-preview-pane ;; :config ;; (latex-preview-pane-enable)) ;; SMTP settings: -(setq user-mail-address system-email) -(setq user-full-name system-fullname) -(setq sendmail-program "msmtp" +(use-package smtpmail + :config + (setq user-mail-address system-email) + (setq user-full-name system-fullname) + (setq sendmail-program "msmtp" send-mail-function 'smtpmail-send-it message-sendmail-f-is-evil t message-sendmail-extra-arguments '("--read-envelope-from") - message-send-mail-function 'message-send-mail-with-sendmail) + message-send-mail-function 'message-send-mail-with-sendmail)) -(require 'smtpmail) (use-package mu4e + :after smtpmail :init (setq mu4e-drafts-folder "/Drafts") (setq mu4e-sent-folder "/Sent") @@ -577,7 +553,4 @@ Otherwise, just insert the typed character." (setq emms-player-list '(emms-player-mpd)) (add-to-list 'emms-info-functions 'emms-info-mpd) (add-to-list 'emms-player-list 'emms-player-mpd) -:config - (emms-player-mpd-connect)) - -(server-start) +:config (emms-player-mpd-connect)) diff --git a/config/emacs.org b/config/emacs.org index 2010d2c..71c56ef 100644 --- a/config/emacs.org +++ b/config/emacs.org @@ -15,190 +15,167 @@ Change these variables: (setq system-username "prestonpan") (setq system-fullname "Preston Pan") #+end_src -** UI Elements -This section contains important UI elements and starting customization variables to make -emacs work in a semi-sane way and make it not look ugly: -#+begin_src emacs-lisp - (require 'tex-site) - (pixel-scroll-precision-mode 1) - (setq scroll-conservatively 101) - (display-battery-mode 1) - (setq display-time-24hr-format t) - (display-time-mode 1) - (menu-bar-mode -1) - (scroll-bar-mode -1) - (tool-bar-mode -1) - (load-theme 'catppuccin :no-confirm) - (setq display-line-numbers-type 'relative) - (add-hook 'prog-mode-hook #'display-line-numbers-mode) - (add-hook 'org-mode-hook #'display-line-numbers-mode) - (setq org-confirm-babel-evaluate nil) - (set-face-attribute 'default nil :height 120) - (setq use-short-answers t) - (setq make-backup-files nil) - (setq org-export-with-broken-links t) - (setq org-src-fontify-natively t) - ;; (setq org-highlight-latex-and-related '(latex script entities)) - (setq warning-minimum-level :emergency) - (add-hook 'text-mode-hook 'visual-line-mode) - (and window-system (server-start)) - (setq debug-ignored-errors - (cons 'remote-file-error debug-ignored-errors)) - (set-face-attribute 'default nil :font "Iosevka Nerd Font" :height 140) - (setq preview-default-option-list '("displaymath" "textmath" "graphics")) - (setq preview-image-type 'png) - (setq org-latex-pdf-process - '("xelatex -interaction=nonstopmode -output-directory=%o %f")) - (setq org-latex-preview-image-directory (expand-file-name "~/.cache/ltximg/")) - (setq org-preview-latex-image-directory (expand-file-name "~/.cache/ltximg/")) - (setq-default line-spacing 2) - (setq org-startup-with-latex-preview t) - (setq-default org-startup-indented t - org-pretty-entities t - org-use-sub-superscripts "{}" - org-hide-emphasis-markers t - org-startup-with-inline-images t - org-image-actual-width '(300)) - - (setq-default fill-column 100) - (add-hook 'text-mode-hook #'auto-fill-mode) - (add-hook 'prog-mode-hook #'auto-fill-mode) - (add-hook 'org-mode-hook #'auto-fill-mode) - - (setopt display-fill-column-indicator-column 100) - (add-hook 'prog-mode-hook #'display-fill-column-indicator-mode) - (add-hook 'org-mode-hook #'display-fill-column-indicator-mode) - (setq TeX-engine 'xetex) +** Emacs +#+begin_src emacs-lisp + (use-package emacs + :custom + (scroll-conservatively 101) + (display-time-24hr-format t) + (display-line-numbers-type 'relative) + (use-short-answers t) + (make-backup-files nil) + (warning-minimum-level :emergency) + (debug-ignored-errors + (cons 'remote-file-error debug-ignored-errors)) + (mouse-wheel-scroll-amount '(1 ((shift) . 1))) + (mouse-wheel-progressive-speed nil) + (mouse-wheel-follow-mouse 't) + (scroll-step 1) + (display-fill-column-indicator-column 100) + :config + (require 'tex-site) + (pixel-scroll-precision-mode 1) + (display-battery-mode 1) + (display-time-mode 1) + (menu-bar-mode -1) + (scroll-bar-mode -1) + (tool-bar-mode -1) + (and window-system (server-start)) + (load-theme 'catppuccin :no-confirm) + (set-face-attribute 'default nil :height 120) + (set-frame-parameter nil 'alpha-background 90) + (add-to-list 'default-frame-alist '(alpha-background . 90)) + (set-face-attribute 'default nil :font "Iosevka Nerd Font" :height 140) + (setq-default line-spacing 2) + (setq-default fill-column 100) + (global-prettify-symbols-mode 1) - (add-hook 'prog-mode-hook - (lambda () - (setq prettify-symbols-alist - '(("lambda" . ?λ) - ("->" . ?→) - ("map" . ?↦) - ("/=" . ?≠) - ("!=" . ?≠) - ("==" . ?≡) - ("<=" . ?≤) - (">=" . ?≥) - ("&&" . ?∧) - ("||" . ?∨) - ("sqrt" . ?√) - ("..." . ?…))) - (prettify-symbols-mode))) + :hook ((text-mode . auto-fill-mode) + (text-mode . visual-line-mode) + (prog-mode . auto-fill-mode) + (prog-mode . display-line-numbers-mode) + (prog-mode . display-fill-column-indicator-mode) + (org-mode . auto-fill-mode) + (org-mode . display-fill-column-indicator-mode) - (add-hook 'org-mode-hook (lambda () - (setq prettify-symbols-alist - '(("#+begin_src" . ?) - ("#+BEGIN_SRC" . ?) - ("#+end_src" . ?) - ("#+END_SRC" . ?) - ("#+begin_example" . ?) - ("#+BEGIN_EXAMPLE" . ?) - ("#+end_example" . ?) - ("#+END_EXAMPLE" . ?) - ("#+header:" . ?) - ("#+HEADER:" . ?) - ("#+name:" . ?﮸) - ("#+NAME:" . ?﮸) - ("#+results:" . ?) - ("#+RESULTS:" . ?) - ("#+call:" . ?) - ("#+CALL:" . ?) - (":PROPERTIES:" . ?) - (":properties:" . ?) - ("lambda" . ?λ) - ("->" . ?→) - ("map" . ?↦) - ("/=" . ?≠) - ("!=" . ?≠) - ("==" . ?≡) - ("<=" . ?≤) - (">=" . ?≥) - ("&&" . ?∧) - ("||" . ?∨) - ("sqrt" . ?√) - ("..." . ?…)))) - (prettify-symbols-mode)) - (global-prettify-symbols-mode 1) + (org-mode . (lambda () + (setq prettify-symbols-alist + '(("#+begin_src" . ?) + ("#+BEGIN_SRC" . ?) + ("#+end_src" . ?) + ("#+END_SRC" . ?) + ("#+begin_example" . ?) + ("#+BEGIN_EXAMPLE" . ?) + ("#+end_example" . ?) + ("#+END_EXAMPLE" . ?) + ("#+header:" . ?) + ("#+HEADER:" . ?) + ("#+name:" . ?﮸) + ("#+NAME:" . ?﮸) + ("#+results:" . ?) + ("#+RESULTS:" . ?) + ("#+call:" . ?) + ("#+CALL:" . ?) + (":PROPERTIES:" . ?) + (":properties:" . ?) + ("lambda" . ?λ) + ("->" . ?→) + ("map" . ?↦) + ("/=" . ?≠) + ("!=" . ?≠) + ("==" . ?≡) + ("<=" . ?≤) + (">=" . ?≥) + ("&&" . ?∧) + ("||" . ?∨) + ("sqrt" . ?√) + ("..." . ?…))) + (prettify-symbols-mode))) + (prog-mode . + (lambda () + (setq prettify-symbols-alist + '(("lambda" . ?λ) + ("->" . ?→) + ("map" . ?↦) + ("/=" . ?≠) + ("!=" . ?≠) + ("==" . ?≡) + ("<=" . ?≤) + (">=" . ?≥) + ("&&" . ?∧) + ("||" . ?∨) + ("sqrt" . ?√) + ("..." . ?…))) + (prettify-symbols-mode))))) +#+end_src +** Org Mode +#+begin_src emacs-lisp + (use-package org + :init + (setq org-confirm-babel-evaluate nil) + (setq org-export-with-broken-links t) + (setq org-src-fontify-natively t) + (setq org-latex-preview-image-directory (expand-file-name "~/.cache/ltximg/")) + (setq org-preview-latex-image-directory (expand-file-name "~/.cache/ltximg/")) + (setq org-latex-pdf-process + '("xelatex -interaction=nonstopmode -output-directory=%o %f")) + (setq preview-default-option-list '("displaymath" "textmath" "graphics")) + (setq preview-image-type 'png) + (setq TeX-engine 'xetex) + (setq TeX-PDF-mode t) + (setq org-format-latex-options (plist-put org-format-latex-options :scale 1.5)) + (setq org-return-follows-link t) + (setq org-startup-with-latex-preview t) + (setq org-habit-preceding-days 1) + (setq-default org-startup-indented t + org-pretty-entities t + org-use-sub-superscripts "{}" + org-hide-emphasis-markers t + org-startup-with-inline-images t + org-image-actual-width '(300)) + (setq org-agenda-files (list "~/org/agenda.org" + "~/org/notes.org" + "~/org/website/agenda.org")) + (setq org-default-notes-file (concat org-directory "/notes.org")) + (setq org-publish-project-alist + '(("website-org" + :base-directory "~/org/website" + :base-extension "org" + :publishing-directory "~/website_html" + :recursive t + :publishing-function org-html-publish-to-html + :headline-levels 4 + :html-preamble t + :html-preamble-format (("en" "

home | section main page


"))) + ("website-static" + :base-directory "~/org/website" + :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|ico\\|asc\\|pub\\|webmanifest\\|xml" + :publishing-directory "~/website_html/" + :recursive t + :publishing-function org-publish-attachment) + ("website" :auto-sitemap t :components ("website-org" "website-static")))) + (setq org-html-postamble "Copyright © 2024 Preston Pan") + :config + (require 'ox-publish) + (require 'org-tempo) + (require 'org-habit) + (org-babel-do-load-languages 'org-babel-load-languages + '((shell . t) + (python . t) + (latex . t)))) #+end_src * Unicode #+begin_src emacs-lisp (use-package unicode-fonts :init (unicode-fonts-setup)) #+end_src - -* Transparency -My NixOS configuration uses Hyprland to make things transparent: -#+begin_src emacs-lisp - (set-frame-parameter nil 'alpha-background 90) - (add-to-list 'default-frame-alist '(alpha-background . 90)) -#+end_src -* Scrolling -Make emacs scroll in a sane way: -#+begin_src emacs-lisp - (setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) - (setq mouse-wheel-progressive-speed nil) - (setq mouse-wheel-follow-mouse 't) - (setq scroll-step 1) -#+end_src -* Agenda -Configure org agenda variables: -#+begin_src emacs-lisp - (require 'org-habit) - (setq org-agenda-files (list "~/org/agenda.org" - "~/org/notes.org" - "~/org/website/agenda.org")) - (setq org-default-notes-file (concat org-directory "/notes.org")) - (setq org-habit-preceding-days 1) -#+end_src -* Publishing -This is the configuration required to publish my website: -#+begin_src emacs-lisp - (require 'ox-publish) - (setq org-publish-project-alist - '(("website-org" - :base-directory "~/org/website" - :base-extension "org" - :publishing-directory "~/website_html" - :recursive t - :publishing-function org-html-publish-to-html - :headline-levels 4 - :html-preamble t - :html-preamble-format (("en" "

home | section main page


"))) - ("website-static" - :base-directory "~/org/website" - :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|ico\\|asc\\|pub\\|webmanifest\\|xml" - :publishing-directory "~/website_html/" - :recursive t - :publishing-function org-publish-attachment) - ("website" :auto-sitemap t :components ("website-org" "website-static")))) - (setq org-html-postamble "Copyright © 2024 Preston Pan") -#+end_src * Autopair Use electric-pair to automatically complete pairs of things. We need to change what electric-pair does based on the mode. #+begin_src emacs-lisp - (defun electric-pair () - "If at end of line, insert character pair without surrounding spaces. - Otherwise, just insert the typed character." - (interactive) - (if (eolp) (let (parens-require-spaces) (insert-pair)) (self-insert-command 1))) - - (add-hook 'org-mode-hook - (lambda () - (define-key org-mode-map "\"" 'electric-pair) - (define-key org-mode-map "(" 'electric-pair) - (define-key org-mode-map "[" 'electric-pair) - (define-key org-mode-map "{" 'electric-pair))) - - (add-hook 'prog-mode-hook - (lambda () - (define-key prog-mode-map "\"" 'electric-pair) - (define-key prog-mode-map "(" 'electric-pair) - (define-key prog-mode-map "[" 'electric-pair) - (define-key prog-mode-map "{" 'electric-pair))) - (electric-pair-mode) + (use-package electric-pair + :hook ((org-mode . electric-pair-mode) + (prog-mode . electric-pair-mode))) #+end_src * Lyrics #+begin_src emacs-lisp @@ -218,45 +195,34 @@ what electric-pair does based on the mode. (use-package yasnippet :config (add-to-list 'yas-snippet-dirs "~/org/website/yasnippet/") - (yas-global-mode 1)) - (add-hook 'org-mode-hook - (lambda () (yas-minor-mode) - (yas-activate-extra-mode 'latex-mode))) + (yas-global-mode 1) + :hook (org-mode . (lambda () (yas-minor-mode) (yas-activate-extra-mode 'latex-mode)))) #+end_src * Completion Company-mode! We need this to do autocomplete stuff. #+begin_src emacs-lisp - (eval-after-load "company" '(add-to-list 'company-backends - '(company-ispell company-capf company-irony - company-yasnippet company-files))) - (add-hook 'after-init-hook 'global-company-mode) + (use-package company + :config + '(add-to-list 'company-backends + '(company-ispell company-capf company-irony + company-yasnippet company-files)) + :hook ((after-init . global-company-mode))) +#+end_src +* Spelling +#+begin_src emacs-lisp (use-package ispell :init (setq ispell-program-name "aspell") (setq ispell-silently-savep t) (setq ispell-dictionary "en") (setq ispell-alternate-dictionary "~/.local/share/dict")) -#+end_src -* Spelling -#+begin_src emacs-lisp -(dolist (hook '(text-mode-hook)) - (add-hook hook (lambda () (flyspell-mode 1)))) -#+end_src -* Org Babel -For some reason, org-babel doesn't load these languages by default: -#+begin_src emacs-lisp - (org-babel-do-load-languages 'org-babel-load-languages - '( - (shell . t) - (python . t) - (latex . t) - ) - ) + + (use-package flyspell + :hook (text-mode . flyspell-mode)) #+end_src * Packages First, some small configurations and some evil-mode initilaization because I like vim keybindings: #+begin_src emacs-lisp - (require 'org-tempo) (use-package evil :init (setq evil-want-keybinding nil) @@ -265,6 +231,7 @@ First, some small configurations and some evil-mode initilaization because I lik (evil-set-undo-system 'undo-redo)) (use-package evil-collection + :after (evil) :init (setq evil-want-keybinding nil) :config @@ -275,11 +242,12 @@ First, some small configurations and some evil-mode initilaization because I lik (define-key evil-motion-state-map (kbd "TAB") nil)) (use-package evil-commentary + :after (evil) :config (evil-commentary-mode)) (use-package evil-org - :after org + :after (evil org) :hook (org-mode . (lambda () evil-org-mode)) :config (require 'evil-org-agenda) @@ -314,8 +282,7 @@ I use org-journal to journal about my life, and it's a part of my website: (setq org-journal-file-header 'org-journal-file-header-func) (setq org-journal-file-format "%Y%m%d.org") - (setq org-journal-enable-agenda-integration t) - ) + (setq org-journal-enable-agenda-integration t)) #+end_src ** Doom Modeline The default modeline is ugly. @@ -327,18 +294,15 @@ The default modeline is ugly. ** Grammar I want to write good! #+begin_src emacs-lisp - (use-package writegood-mode) - -(dolist (hook '(text-mode-hook)) - (add-hook hook (lambda () (writegood-mode)))) +(use-package writegood-mode + :hook (text-mode . writegood-mode)) #+end_src ** Make Org Look Better Org superstar adds those nice looking utf-8 bullets: #+begin_src emacs-lisp (use-package org-superstar :after (org) - :config - (add-hook 'org-mode-hook (lambda () (org-superstar-mode 1)))) + :hook (org-mode . (lambda () (org-superstar-mode 1)))) #+end_src ** LSP We set up eglot, the LSP manager for emacs, now built in: @@ -346,8 +310,8 @@ We set up eglot, the LSP manager for emacs, now built in: (use-package eglot :config (add-to-list 'eglot-server-programs '(nix-mode . ("nil"))) - (add-hook 'prog-mode-hook 'eglot-ensure) :hook + (prog-mode . eglot-ensure) (nix-mode . eglot-ensure)) (use-package lsp :hook @@ -357,15 +321,15 @@ We set up eglot, the LSP manager for emacs, now built in: #+end_src *** C/C++ #+begin_src emacs-lisp - (use-package irony-mode - :config - (add-hook 'c++-mode-hook 'irony-mode) - (add-hook 'c-mode-hook 'irony-mode) - (add-hook 'objc-mode-hook 'irony-mode) - (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)) + (use-package irony-mode + :hook ( + (c++-mode . irony-mode) + (c-mode . irony-mode) + (objc-mode . irony-mode) + (irony-mode . irony-cdb-autosetup-compile-options))) - (use-package irony-eldoc - :config (add-hook 'irony-mode-hook #'irony-eldoc)) + (use-package irony-eldoc + :hook ((irony-mode . irony-eldoc))) #+end_src *** Solidity For writing solidity: @@ -377,9 +341,8 @@ For writing solidity: (setq solidity-flycheck-solc-checker-active t)) (use-package flycheck - :init (global-flycheck-mode)) + :config (global-flycheck-mode)) #+end_src - ** Projectile Manages projects and shit. #+begin_src emacs-lisp @@ -411,32 +374,31 @@ We want our emacs initialization to be pretty and display useful things. ** Ivy Ivy is a pretty cool general program for displaying stuff: #+begin_src emacs-lisp - (use-package counsel) - (use-package ivy - :init - (setq ivy-use-virtual-buffers t) - (setq enable-recursive-minibuffers t) - ;; enable this if you want `swiper' to use it - ;; (setq search-default-mode #'char-fold-to-regexp) - (global-set-key "\C-s" 'swiper) - (global-set-key (kbd "C-c C-r") 'ivy-resume) - (global-set-key (kbd "") 'ivy-resume) - (global-set-key (kbd "M-x") 'counsel-M-x) - (global-set-key (kbd "C-x C-f") 'counsel-find-file) - (global-set-key (kbd " f") 'counsel-describe-function) - (global-set-key (kbd " v") 'counsel-describe-variable) - (global-set-key (kbd " o") 'counsel-describe-symbol) - (global-set-key (kbd " l") 'counsel-find-library) - (global-set-key (kbd " i") 'counsel-info-lookup-symbol) - (global-set-key (kbd " u") 'counsel-unicode-char) - (global-set-key (kbd "C-c g") 'counsel-git) - (global-set-key (kbd "C-c j") 'counsel-git-grep) - (global-set-key (kbd "C-c k") 'counsel-ag) - (global-set-key (kbd "C-x l") 'counsel-locate) - (global-set-key (kbd "C-S-o") 'counsel-rhythmbox) - :config - (ivy-mode)) - (define-key ivy-minibuffer-map (kbd "C-j") 'ivy-immediate-done) + (use-package counsel) + (use-package ivy + :init + (setq ivy-use-virtual-buffers t) + (setq enable-recursive-minibuffers t) + :bind + ;; enable this if you want `swiper' to use it + ;; (setq search-default-mode #'char-fold-to-regexp) + ("C-s" . swiper) + ("C-c C-r" . ivy-resume) + ("M-x" . counsel-M-x) + ("C-x C-f" . counsel-find-file) + (" f" . counsel-describe-function) + (" v" . counsel-describe-variable) + (" o" . counsel-describe-symbol) + (" l" . counsel-find-library) + (" i" . counsel-info-lookup-symbol) + (" u" . counsel-unicode-char) + ("C-c g" . counsel-git) + ("C-c j" . counsel-git-grep) + ("C-c k" . counsel-ag) + ("C-x l" . counsel-locate) + :config + (ivy-mode)) + (define-key ivy-minibuffer-map (kbd "C-j") 'ivy-immediate-done) #+end_src ** Magit #+begin_src emacs-lisp @@ -444,35 +406,31 @@ Ivy is a pretty cool general program for displaying stuff: #+end_src ** IRC #+begin_src emacs-lisp - (setq - erc-nick system-username - erc-user-full-name system-fullname) - - (defun prestonpan () - (interactive) - (erc-tls :server "nullring.xyz" - :port "6697")) - - (defun liberachat () - (interactive) - (erc-tls :server "irc.libera.chat" - :port "6697")) - - - (defun efnet () - (interactive) - (erc-tls :server "irc.prison.net" - :port "6697")) -#+end_src -** Matrix -#+begin_src emacs-lisp - (defun matrix-org () - (interactive) - (ement-connect :uri-prefix "http://localhost:8009")) + (use-package erc + :init + (setq + erc-nick system-username + erc-user-full-name system-fullname)) #+end_src ** Keybindings #+begin_src emacs-lisp (use-package general + :init + (defun prestonpan () + (interactive) + (erc-tls :server "nullring.xyz" + :port "6697")) + (defun liberachat () + (interactive) + (erc-tls :server "irc.libera.chat" + :port "6697")) + (defun efnet () + (interactive) + (erc-tls :server "irc.prison.net" + :port "6697")) + (defun matrix-org () + (interactive) + (ement-connect :uri-prefix "http://localhost:8009")) :config (general-create-definer leader-key :prefix "SPC") @@ -525,8 +483,7 @@ Ivy is a pretty cool general program for displaying stuff: "w r" '(writeroom-mode :wk "focus mode for writing") "y n s" '(yas-new-snippet :wk "Create new snippet") "u w" '((lambda () (interactive) (shell-command "rsync -azvP ~/website_html/ root@nullring.xyz:/usr/share/nginx/ret2pop/")) :wk "rsync website update") - "h r r" '(lambda () (interactive) (org-babel-load-file (expand-file-name "~/org/website/config/emacs.org"))) - )) + "h r r" '(lambda () (interactive) (org-babel-load-file (expand-file-name "~/org/website/config/emacs.org"))))) #+end_src ** LLM I use LLMs in order to help me come up with ideas. I use a local LLM so that I can have a @@ -546,9 +503,10 @@ I use really simple syndication (RSS) in order to read news. As a result, I use elfeed to fetch feeds found on my website: #+begin_src emacs-lisp (use-package elfeed + :hook ((elfeed-search-mode . elfeed-update)) :init - (add-hook 'elfeed-search-mode-hook #'elfeed-update) (setq elfeed-search-filter "@1-month-ago +unread")) + (use-package elfeed-org :init (setq rmh-elfeed-org-files '("~/org/website/config/elfeed.org")) @@ -595,32 +553,32 @@ interface and can control it from emacs): Used only for the purpose of viewing RSS feed items in emacs if I can, only resorting to Chromium if I have to: #+begin_src emacs-lisp -(setq search-engines - '( - (("google" "g") "https://google.com/search?q=%s") - (("duckduckgo" "d" "ddg") "https://duckduckgo.com/?q=%s") - (("rfc" "r") "https://www.rfc-editor.org/rfc/rfc%s.txt") - (("rfc-kw" "rk") "https://www.rfc-editor.org/search/rfc_search_detail.php?title=%s"))) + (use-package eww + :init + (setq search-engines + '((("google" "g") "https://google.com/search?q=%s") + (("duckduckgo" "d" "ddg") "https://duckduckgo.com/?q=%s") + (("rfc" "r") "https://www.rfc-editor.org/rfc/rfc%s.txt") + (("rfc-kw" "rk") "https://www.rfc-editor.org/search/rfc_search_detail.php?title=%s"))) -(setq search-engine-default "google") -(setq eww-search-prefix "https://google.com/search?q=") -(setq browse-url-secondary-browser-function 'browse-url-generic browse-url-generic-program "firefox") -;; (setq browse-url-browser-function "firefox") -(add-hook 'eww-mode-hook - (lambda () (local-set-key (kbd "y Y") #'eww-copy-page-url))) + (setq search-engine-default "google") + (setq eww-search-prefix "https://google.com/search?q=") + (setq browse-url-secondary-browser-function 'browse-url-generic browse-url-generic-program "firefox") + :hook ((eww-mode . (lambda () (local-set-key (kbd "y Y") #'eww-copy-page-url))))) #+end_src ** Org Roam For all my mathematics and programming notes: #+begin_src emacs-lisp (use-package org-roam + :after (org) :init (setq org-roam-db-update-on-save t) (setq org-roam-graph-viewer "chromium") (setq org-roam-directory (file-truename "~/org/website/mindmap")) (setq org-roam-capture-templates '(("d" "default" plain "%?" :target (file+head "${title}.org" - "#+title: ${title}\n#+author: Preston Pan\n#+html_head: \n#+html_head: \n#+html_head: \n#+options: broken-links:t") - :unnarrowed t))) + "#+title: ${title}\n#+author: Preston Pan\n#+html_head: \n#+html_head: \n#+html_head: \n#+options: broken-links:t") + :unnarrowed t))) :config (org-roam-db-autosync-mode)) @@ -629,9 +587,9 @@ For all my mathematics and programming notes: :hook (after-init . org-roam-ui-mode) :config (setq org-roam-ui-sync-theme t - org-roam-ui-follow t - org-roam-ui-update-on-save t - org-roam-ui-open-on-start t)) + org-roam-ui-follow t + org-roam-ui-update-on-save t + org-roam-ui-open-on-start t)) #+end_src ** Pinentry @@ -644,9 +602,6 @@ Set up pinentry so that I can use emacs as my pinentry frontend: ** LaTeX Make LaTeX a litle better: #+begin_src emacs-lisp - (setq TeX-PDF-mode t) - (setq org-format-latex-options (plist-put org-format-latex-options :scale 1.5)) - (setq org-return-follows-link t) ;; (use-package latex-preview-pane ;; :config ;; (latex-preview-pane-enable)) @@ -655,16 +610,18 @@ Make LaTeX a litle better: Email in emacs can be done with Mu4e. #+begin_src emacs-lisp ;; SMTP settings: - (setq user-mail-address system-email) - (setq user-full-name system-fullname) - (setq sendmail-program "msmtp" + (use-package smtpmail + :config + (setq user-mail-address system-email) + (setq user-full-name system-fullname) + (setq sendmail-program "msmtp" send-mail-function 'smtpmail-send-it message-sendmail-f-is-evil t message-sendmail-extra-arguments '("--read-envelope-from") - message-send-mail-function 'message-send-mail-with-sendmail) + message-send-mail-function 'message-send-mail-with-sendmail)) - (require 'smtpmail) (use-package mu4e + :after smtpmail :init (setq mu4e-drafts-folder "/Drafts") (setq mu4e-sent-folder "/Sent") @@ -704,11 +661,5 @@ Set up emms in order to play music from my music directory: (setq emms-player-list '(emms-player-mpd)) (add-to-list 'emms-info-functions 'emms-info-mpd) (add-to-list 'emms-player-list 'emms-player-mpd) - :config - (emms-player-mpd-connect)) -#+end_src -** Server -So that emacsclient can connect. -#+begin_src emacs-lisp -(server-start) + :config (emms-player-mpd-connect)) #+end_src diff --git a/journal/20250111.org b/journal/20250111.org new file mode 100644 index 0000000..c50aeb9 --- /dev/null +++ b/journal/20250111.org @@ -0,0 +1,16 @@ +#+TITLE: Daily Journal +#+STARTUP: showeverything +#+DESCRIPTION: My daily journal entry +#+AUTHOR: Preston Pan +#+HTML_HEAD: +#+html_head: +#+html_head: +#+options: broken-links:t +* Saturday, 11 January 2025 +** 02:21 +I'm currently working more on my agenda, and I've just realized how big of a task splitting +up my giant configuration into modules really is. I also have to learn about the module format +and how to exactly get the equivalent functionality (as my NixOS configuration on my laptops +are becoming stable). +** 19:36 +Ainslie is now here, and I will work more on my NixOS configuration. diff --git a/journal/20250112.org b/journal/20250112.org new file mode 100644 index 0000000..8ea1936 --- /dev/null +++ b/journal/20250112.org @@ -0,0 +1,12 @@ +#+TITLE: Daily Journal +#+STARTUP: showeverything +#+DESCRIPTION: My daily journal entry +#+AUTHOR: Preston Pan +#+HTML_HEAD: +#+html_head: +#+html_head: +#+options: broken-links:t +* Sunday, 12 January 2025 +** 21:36 +I am journaling with Erfan right now. Also, I'm showing off the capabilities of my website. +I know I post this kind of thing a lot, but I just did it again. diff --git a/journal/index.org b/journal/index.org index 7b4baa5..ef9a27f 100644 --- a/journal/index.org +++ b/journal/index.org @@ -34,6 +34,20 @@ done #+end_src #+RESULTS: +- [[file:20250112.org][20250112.org]] +- [[file:20250111.org][20250111.org]] +- [[file:20250108.org][20250108.org]] +- [[file:20250106.org][20250106.org]] +- [[file:20250103.org][20250103.org]] +- [[file:20250102.org][20250102.org]] +- [[file:20241230.org][20241230.org]] +- [[file:20240924.org][20240924.org]] +- [[file:20240610.org][20240610.org]] +- [[file:20240605.org][20240605.org]] +- [[file:20240602.org][20240602.org]] +- [[file:20240601.org][20240601.org]] +- [[file:20240531.org][20240531.org]] +- [[file:20240530.org][20240530.org]] - [[file:20240524.org][20240524.org]] - [[file:20240519.org][20240519.org]] - [[file:20240512.org][20240512.org]] diff --git a/mindmap/lrc_circuit.png b/mindmap/lrc_circuit.png index e677564..c9c4d30 100644 Binary files a/mindmap/lrc_circuit.png and b/mindmap/lrc_circuit.png differ diff --git a/nix/.sops.yaml b/nix/.sops.yaml new file mode 100644 index 0000000..9c91d66 --- /dev/null +++ b/nix/.sops.yaml @@ -0,0 +1,7 @@ +keys: + - &primary age165ul43e8rc0qwzz2f2q9cw02psm2mkudsrwavq2e0pxs280p64yqy2z0dr +creation_rules: + - path_regex: secrets/secrets.yaml$ + key_groups: + - age: + - *primary diff --git a/nix/flake.lock b/nix/flake.lock new file mode 100644 index 0000000..1bfaf27 --- /dev/null +++ b/nix/flake.lock @@ -0,0 +1,425 @@ +{ + "nodes": { + "crane": { + "inputs": { + "nixpkgs": [ + "lanzaboote", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1717535930, + "narHash": "sha256-1hZ/txnbd/RmiBPNUs7i8UQw2N89uAK3UzrGAWdnFfU=", + "owner": "ipetkov", + "repo": "crane", + "rev": "55e7754ec31dac78980c8be45f8a28e80e370946", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1736437680, + "narHash": "sha256-9Sy17XguKdEU9M5peTrkWSlI/O5IAqjHzdzxbXnc30g=", + "owner": "nix-community", + "repo": "disko", + "rev": "4d5d07d37ff773338e40a92088f45f4f88e509c8", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "lanzaboote", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1717285511, + "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "nur", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733312601, + "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "lanzaboote", + "pre-commit-hooks-nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1736373539, + "narHash": "sha256-dinzAqCjenWDxuy+MqUQq0I4zUSfaCvN9rzuCmgMZJY=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "bd65bc3cde04c16755955630b344bc9e35272c56", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-24.11", + "repo": "home-manager", + "type": "github" + } + }, + "lanzaboote": { + "inputs": { + "crane": "crane", + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ], + "pre-commit-hooks-nix": "pre-commit-hooks-nix", + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1718178907, + "narHash": "sha256-eSZyrQ9uoPB9iPQ8Y5H7gAmAgAvCw3InStmU3oEjqsE=", + "owner": "nix-community", + "repo": "lanzaboote", + "rev": "b627ccd97d0159214cee5c7db1412b75e4be6086", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "v0.4.1", + "repo": "lanzaboote", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1736200483, + "narHash": "sha256-JO+lFN2HsCwSLMUWXHeOad6QUxOuwe9UOAF/iSl1J4I=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "3f0a8ac25fb674611b98089ca3a5dd6480175751", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1710695816, + "narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "614b4613980a522ba49f0d194531beddbb7220d3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1736344531, + "narHash": "sha256-8YVQ9ZbSfuUk2bUf2KRj60NRraLPKPS0Q4QFTbc+c2c=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "bffc22eb12172e6db3c5dde9e3e5628f8e3e7912", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1731763621, + "narHash": "sha256-ddcX4lQL0X05AYkrkV2LMFgGdRvgap7Ho8kgon3iWZk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c69a9bffbecde46b4b939465422ddc59493d3e4d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nur": { + "inputs": { + "flake-parts": "flake-parts_2", + "nixpkgs": "nixpkgs_2", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1736483761, + "narHash": "sha256-4ebVuPVQ1J2NxDDzDjSAeu44B8qv8163l2K63cFYpS4=", + "owner": "nix-community", + "repo": "NUR", + "rev": "4f54273e0e23db6d8c65150de4b29bffa9b1b518", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "NUR", + "type": "github" + } + }, + "pre-commit-hooks-nix": { + "inputs": { + "flake-compat": [ + "lanzaboote", + "flake-compat" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "lanzaboote", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1717664902, + "narHash": "sha256-7XfBuLULizXjXfBYy/VV+SpYMHreNRHk9nKMsm1bgb4=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "cc4d466cb1254af050ff7bdf47f6d404a7c646d1", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "disko": "disko", + "home-manager": "home-manager", + "lanzaboote": "lanzaboote", + "nixpkgs": "nixpkgs", + "nur": "nur", + "scripts": "scripts", + "sops-nix": "sops-nix", + "wallpapers": "wallpapers" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": [ + "lanzaboote", + "flake-utils" + ], + "nixpkgs": [ + "lanzaboote", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1717813066, + "narHash": "sha256-wqbRwq3i7g5EHIui0bIi84mdqZ/It1AXBSLJ5tafD28=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "6dc3e45fe4aee36efeed24d64fc68b1f989d5465", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "scripts": { + "locked": { + "lastModified": 1709958643, + "narHash": "sha256-+NHuHYUTUkjIOaCZlH7gICDwRu2dMgJ6smmU9DvgLT0=", + "owner": "ret2pop", + "repo": "scripts", + "rev": "8e230dcb118d5a25629c1980a4764ae071bfb2bf", + "type": "github" + }, + "original": { + "owner": "ret2pop", + "repo": "scripts", + "type": "github" + } + }, + "sops-nix": { + "inputs": { + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1736203741, + "narHash": "sha256-eSjkBwBdQk+TZWFlLbclF2rAh4JxbGg8az4w/Lfe7f4=", + "owner": "Mic92", + "repo": "sops-nix", + "rev": "c9c88f08e3ee495e888b8d7c8624a0b2519cb773", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "sops-nix", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nur", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733222881, + "narHash": "sha256-JIPcz1PrpXUCbaccEnrcUS8jjEb/1vJbZz5KkobyFdM=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "49717b5af6f80172275d47a418c9719a31a78b53", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "wallpapers": { + "locked": { + "lastModified": 1710138216, + "narHash": "sha256-LcgB1Fkb9PZLF9BiV310mSWe3emK1+aJ2gxkeSsuOQ4=", + "owner": "ret2pop", + "repo": "wallpapers", + "rev": "18edf36b53936ee2eda766b7b29ee91b21e2d5cd", + "type": "github" + }, + "original": { + "owner": "ret2pop", + "repo": "wallpapers", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/nix/flake.nix b/nix/flake.nix new file mode 100644 index 0000000..555a8c1 --- /dev/null +++ b/nix/flake.nix @@ -0,0 +1,74 @@ +{ + description = "Emacs centric configurations for a complete networked system"; + + inputs = { + nixpkgs = { + url = "github:nixos/nixpkgs/nixos-24.11"; + }; + + home-manager = { + url = "github:nix-community/home-manager/release-24.11"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + disko = { + url = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + lanzaboote = { + url = "github:nix-community/lanzaboote/v0.4.1"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + nur.url = "github:nix-community/NUR"; + sops-nix.url = "github:Mic92/sops-nix"; + scripts.url = "github:ret2pop/scripts"; + wallpapers.url = "github:ret2pop/wallpapers"; + }; + + outputs = { nixpkgs, home-manager, nur, disko, lanzaboote, sops-nix, ... }@attrs: { + nixosConfigurations = { + installer = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ( + { pkgs, modulesPath, ... }: + { + imports = [ (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix") ]; + } + ) + ./systems/installer/iso.nix + ]; + }; + + continuity = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = attrs; + modules = [ + { nixpkgs.overlays = [ nur.overlays.default ]; } + { home-manager.extraSpecialArgs = attrs; } + lanzaboote.nixosModules.lanzaboote + disko.nixosModules.disko + home-manager.nixosModules.home-manager + sops-nix.nixosModules.sops + ./systems/desktop/configuration.nix + ./systems/desktop/sda-simple.nix + ./systems/desktop/home.nix + ]; + }; + + spontaneity = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = attrs; + modules = []; + }; + + affinity = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = attrs; + modules = []; + }; + }; + }; +} diff --git a/nix/modules/default.nix b/nix/modules/default.nix new file mode 100644 index 0000000..b03d632 --- /dev/null +++ b/nix/modules/default.nix @@ -0,0 +1,6 @@ +{ lib, config, pkgs, ... }: +{ + imports = [ + ./home/secrets.nix + ]; +} diff --git a/nix/modules/home/secrets.nix b/nix/modules/home/secrets.nix new file mode 100644 index 0000000..64eab73 --- /dev/null +++ b/nix/modules/home/secrets.nix @@ -0,0 +1,19 @@ +{ lib, config, pkgs, inputs, ... }: +{ + imports = [ + ../vars.nix + ]; + + options = { + secrets.enable = lib.mkEnableOption "enables encrypted secrets on system"; + }; + + config = lib.mkIf config.secrets.enable { + home-manager = { + sharedModules = [ + inputs.sops-nix.homeManagerModules.sops + ]; + users."${user.user}" = {}; + }; + }; +} diff --git a/nix/modules/secure-boot.nix b/nix/modules/secure-boot.nix new file mode 100644 index 0000000..0785835 --- /dev/null +++ b/nix/modules/secure-boot.nix @@ -0,0 +1,20 @@ +{ pkgs, lib, config, inputs, ... }: +{ + imports = [ + inputs.lanzaboote.nixosModules.lanzaboote + ]; + + options = { + secure-boot.enable = lib.mkEnableOption "Enables secure boot on system"; + }; + + config = lib.mkIf config.secure-boot.enable { + boot = { + loader.systemd-boot.enable = lib.mkForce false; + lanzaboote = { + enable = true; + pkiBundle = "/etc/secureboot"; + }; + }; + }; +} diff --git a/nix/modules/vars.nix b/nix/modules/vars.nix new file mode 100644 index 0000000..43e45ad --- /dev/null +++ b/nix/modules/vars.nix @@ -0,0 +1,48 @@ +# Change the following variables +{}: +{ + options = { + # set your host name. + hostName = "continuity"; + + user = { + userName = "preston"; + fullName = "Preston Pan"; + gpgKey = "AEC273BF75B6F54D81343A1AC1FE6CED393AE6C1"; + }; + + servers = { + # email used for `From` and also as your login email. + email = "ret2pop@gmail.com"; + # IMAPS server. Must be encrypted. + imapsServer = "imap.gmail.com"; + # SMTPS server. Must be encrypted. + smtpsServer = "smtp.gmail.com"; + + # Used for referencing the remote host in config. This mostly shouldn't matter if you are not + # using my website. + remoteHost = "nullring.xyz"; + }; + + # Change to your timezone + timeZone = "America/Vancouver"; + + # After rebooting, use the command `hyprctl monitors` in order to check which monitor + # you are using. This is so that waybar knows which monitors to appear in. + monitors = [ + "HDMI-A-1" + "eDP-1" + "DP-2" + "DP-3" + "LVDS-1" + ]; + + # enable video drivers based on your system. + # Example: + # videoDrivers = [ + # "nvidia" + # "amdgpu" + # ] + videoDrivers = []; + }; +} diff --git a/nix/secrets/secrets.yaml b/nix/secrets/secrets.yaml new file mode 100644 index 0000000..735ceed --- /dev/null +++ b/nix/secrets/secrets.yaml @@ -0,0 +1,23 @@ +hello: ENC[AES256_GCM,data:SyGz4JsQGWYBSsn59/iy2jtF5LxcLqvuYlJa9Ng30TYHZLjGHLFnFLCN8H1JLg==,iv:DAtgeXT/nnNDGfayt7GrzDI527CawbF7sLAbw6A5bYs=,tag:zQyCdvFekQW3fhsqzV51Fw==,type:str] +mail: ENC[AES256_GCM,data:IFJnuVbshByUh5S3HoSnX5AyOg==,iv:gF0JlnBGAMLduMIG/hZtssdkHVL9/RDmDwBw/WoMDwQ=,tag:adDgcz/VrAN6/kfYTKa5XA==,type:str] +digikey: ENC[AES256_GCM,data:U1c2HYB/YjwlyHvD3XVTqWJdb9/8BeS6,iv:DNsBoaqgUPdfO9knQLCMeJVO8kctQ9XNvcY2xcpI0NM=,tag:kuJ9BYqVx0GeTBSW5EsItg==,type:str] +sops: + kms: [] + gcp_kms: [] + azure_kv: [] + hc_vault: [] + age: + - recipient: age165ul43e8rc0qwzz2f2q9cw02psm2mkudsrwavq2e0pxs280p64yqy2z0dr + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBlNHJDMllEZkJYQitsTlls + WTRkQUdJOWZxRDR1WkFXdWRDUllFVmFGUFZnCmh3Mi9KMGM2aTFxQksxT1cyVDJ1 + bytaVGVIVnlyY1hacS9BVG1aSVVCOTQKLS0tIGdLTEFORTZsYmFkMGZHUWJ5akFQ + OFFNeEtOTk5FSm9RaDFad0UyeWZ2WDgKIwGoB4a5WAIkE93gzqdUzNlo5vgQ1zLy + yhEFrE1NbhyItnZIg/yRhqFG0dv7D3pEP3pq2Seew6pKJg/s9UTJ8Q== + -----END AGE ENCRYPTED FILE----- + lastmodified: "2025-01-11T05:57:15Z" + mac: ENC[AES256_GCM,data:/2PFJp4LHH8CJu1VCt0kN6N0ntxCsJ9J5fGVUBRE43Y7tseNtI/ItGa9vGuMLR64Y2lysUShtdx+6E68W7L5NOqMHecomqdj1oT21k2DSVysAmJ7xc43uMw9Ck8flDssFu2CQx4uVk7bNdLfj6zfEJXiv3vi8UErqr5beMdcfA4=,iv:iIb9vNaiCyuQpusN0WlVEbDlVeE/eJ8T6Fx+NJTIXfs=,tag:BSjTynwKJpamVDw6gRahQQ==,type:str] + pgp: [] + unencrypted_suffix: _unencrypted + version: 3.9.2 diff --git a/nix/systems/desktop/configuration.nix b/nix/systems/desktop/configuration.nix new file mode 100644 index 0000000..8359d25 --- /dev/null +++ b/nix/systems/desktop/configuration.nix @@ -0,0 +1,399 @@ +{ pkgs, lib, ... }: +let + vars = import ./vars.nix; +in +{ + imports = []; + + hardware.enableAllFirmware = true; + + documentation = { + enable = true; + man.enable = true; + dev.enable = true; + }; + + environment = { + etc = { + securetty.text = '' + # /etc/securetty: list of terminals on which root is allowed to login. + # See securetty(5) and login(1). + ''; + }; + }; + + systemd = { + coredump.enable = false; + network.config.networkConfig.IPv6PrivacyExtensions = "kernel"; + tmpfiles.settings = { + "restricthome"."/home/*".Z.mode = "~0700"; + + "restrictetcnixos"."/etc/nixos/*".Z = { + mode = "0000"; + user = "root"; + group = "root"; + }; + }; + }; + + + boot = { + extraModulePackages = [ ]; + + initrd = { + availableKernelModules = [ + "xhci_pci" + "ahci" + "usb_storage" + "sd_mod" + "nvme" + "sd_mod" + "ehci_pci" + "rtsx_pci_sdmmc" + "usbhid" + ]; + + kernelModules = [ ]; + }; + + lanzaboote = { + enable = vars.secureBoot; + pkiBundle = "/etc/secureboot"; + }; + + loader = { + systemd-boot.enable = lib.mkForce (! vars.secureBoot); + efi.canTouchEfiVariables = true; + }; + + kernelModules = [ + "snd-seq" + "snd-rawmidi" + "xhci_hcd" + "kvm_intel" + ]; + + kernelParams = [ + "debugfs=off" + "page_alloc.shuffle=1" + "slab_nomerge" + "page_poison=1" + + # madaidan + "pti=on" + "randomize_kstack_offset=on" + "vsyscall=none" + "module.sig_enforce=1" + "lockdown=confidentiality" + + # cpu + "spectre_v2=on" + "spec_store_bypass_disable=on" + "tsx=off" + "tsx_async_abort=full,nosmt" + "mds=full,nosmt" + "l1tf=full,force" + "nosmt=force" + "kvm.nx_huge_pages=force" + + # hardened + "extra_latent_entropy" + + # mineral + "init_on_alloc=1" + "random.trust_cpu=off" + "random.trust_bootloader=off" + "intel_iommu=on" + "amd_iommu=force_isolation" + "iommu=force" + "iommu.strict=1" + "init_on_free=1" + "quiet" + "loglevel=0" + ]; + + blacklistedKernelModules = [ + "netrom" + "rose" + + "adfs" + "affs" + "bfs" + "befs" + "cramfs" + "efs" + "erofs" + "exofs" + "freevxfs" + "f2fs" + "hfs" + "hpfs" + "jfs" + "minix" + "nilfs2" + "ntfs" + "omfs" + "qnx4" + "qnx6" + "sysv" + "ufs" + ]; + + kernel.sysctl = { + "kernel.ftrace_enabled" = false; + "net.core.bpf_jit_enable" = false; + "kernel.kptr_restrict" = 2; + + # madaidan + "vm.swappiness" = 1; + "vm.unprivileged_userfaultfd" = 0; + "dev.tty.ldisc_autoload" = 0; + "kernel.kexec_load_disabled" = 1; + "kernel.sysrq" = 4; + "kernel.perf_event_paranoid" = 3; + + # net + "net.ipv4.icmp_echo_ignore_broadcasts" = true; + + "net.ipv4.conf.all.accept_redirects" = false; + "net.ipv4.conf.all.secure_redirects" = false; + "net.ipv4.conf.default.accept_redirects" = false; + "net.ipv4.conf.default.secure_redirects" = false; + "net.ipv6.conf.all.accept_redirects" = false; + "net.ipv6.conf.default.accept_redirects" = false; + }; + }; + + networking = { + useDHCP = lib.mkDefault true; + hostName = vars.hostName; + networkmanager = { + enable = true; + # wifi.macAddress = ""; + }; + firewall = { + allowedTCPPorts = [ ]; + allowedUDPPorts = [ ]; + }; + }; + + hardware = { + cpu.intel.updateMicrocode = true; + bluetooth = { + enable = true; + powerOnBoot = true; + }; + + graphics = { + enable = true; + }; + + pulseaudio.enable = false; + }; + + services = { + chrony = { + enable = true; + enableNTS = true; + servers = [ "time.cloudflare.com" "ptbtime1.ptb.de" "ptbtime2.ptb.de" ]; + }; + + jitterentropy-rngd.enable = true; + resolved.dnssec = true; + # usbguard.enable = true; + usbguard.enable = false; + dbus = { + apparmor = "enabled"; + }; + + tor = { + enable = true; + openFirewall = true; + client = { + enable = true; + socksListenAddress = { + IsolateDestAddr = true; + addr = "127.0.0.1"; + port = 9050; + }; + dns.enable = true; + }; + torsocks = { + enable = true; + server = "127.0.0.1:9050"; + }; + }; + + xserver = { + displayManager = { + startx.enable = true; + }; + + windowManager = { + i3 = { + enable = true; + package = pkgs.i3-gaps; + }; + }; + + desktopManager = { + runXdgAutostartIfNone = true; + }; + + xkb = { + layout = "us"; + variant = ""; + options = "caps:escape"; + }; + + videoDrivers = vars.videoDrivers; + enable = true; + }; + + pipewire = { + enable = true; + alsa = { + enable = true; + support32Bit = true; + }; + pulse.enable = true; + jack.enable = true; + wireplumber.enable = true; + extraConfig.pipewire-pulse."92-low-latency" = { + "context.properties" = [ + { + name = "libpipewire-module-protocol-pulse"; + args = { }; + } + ]; + "pulse.properties" = { + "pulse.min.req" = "32/48000"; + "pulse.default.req" = "32/48000"; + "pulse.max.req" = "32/48000"; + "pulse.min.quantum" = "32/48000"; + "pulse.max.quantum" = "32/48000"; + }; + "stream.properties" = { + "node.latency" = "32/48000"; + "resample.quality" = 1; + }; + }; + }; + + kanata = { + enable = true; + }; + + openssh = { + enable = true; + settings = { + PasswordAuthentication = true; + AllowUsers = [ vars.userName ]; + PermitRootLogin = "no"; + KbdInteractiveAuthentication = false; + }; + }; + + # Misc. + udev = { + extraRules = ''''; + packages = with pkgs; [ + platformio-core + platformio-core.udev + openocd + ]; + }; + + printing.enable = true; + udisks2.enable = true; + }; + + programs = { + nix-ld.enable = true; + zsh.enable = true; + light.enable = true; + ssh.enableAskPassword = false; + }; + + nixpkgs = { + hostPlatform = lib.mkDefault "x86_64-linux"; + config = { + allowUnfree = true; + cudaSupport = false; + }; + }; + + security = { + apparmor = { + enable = true; + killUnconfinedConfinables = true; + }; + + pam.loginLimits = [ + { domain = "*"; item = "nofile"; type = "-"; value = "32768"; } + { domain = "*"; item = "memlock"; type = "-"; value = "32768"; } + ]; + rtkit.enable = true; + + lockKernelModules = true; + protectKernelImage = true; + allowSimultaneousMultithreading = false; + forcePageTableIsolation = true; + + tpm2 = { + enable = true; + pkcs11.enable = true; + tctiEnvironment.enable = true; + }; + + auditd.enable = true; + audit.enable = true; + chromiumSuidSandbox.enable = true; + sudo.enable = true; + }; + + xdg.portal = { + enable = true; + wlr.enable = true; + extraPortals = with pkgs; [ xdg-desktop-portal-gtk xdg-desktop-portal xdg-desktop-portal-hyprland ]; + config.common.default = "*"; + }; + + environment.systemPackages = with pkgs; [ + cryptsetup + restic + sbctl + linux-manual + man-pages + man-pages-posix + tree + ]; + + + users.users = { + root.openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINSshvS1N/42pH9Unp3Zj4gjqs9BXoin99oaFWYHXZDJ preston@preston-arch" + ]; + + "${vars.userName}" = { + initialPassword = "${vars.userName}"; + isNormalUser = true; + description = vars.fullName; + extraGroups = [ "networkmanager" "wheel" "video" "docker" "jackaudio" "tss" "dialout" ]; + shell = pkgs.zsh; + packages = []; + }; + }; + + + nix.settings.experimental-features = "nix-command flakes"; + time.timeZone = vars.timeZone; + i18n.defaultLocale = "en_CA.UTF-8"; + + system = { + stateVersion = "24.11"; + nixos = { + tags = [ "continuity-2.0" ]; + }; + }; +} diff --git a/nix/systems/desktop/home.nix b/nix/systems/desktop/home.nix new file mode 100644 index 0000000..166bd16 --- /dev/null +++ b/nix/systems/desktop/home.nix @@ -0,0 +1,14 @@ +{ sops-nix, ... }: +let + vars = import ./vars.nix; +in +{ + home-manager = { + sharedModules = [ + sops-nix.homeManagerModules.sops + ]; + useGlobalPkgs = true; + useUserPackages = true; + users."${vars.userName}" = ./user.nix; + }; +} diff --git a/nix/systems/desktop/sda-simple.nix b/nix/systems/desktop/sda-simple.nix new file mode 100644 index 0000000..86263dd --- /dev/null +++ b/nix/systems/desktop/sda-simple.nix @@ -0,0 +1,39 @@ +# This will install a simple system with a root and boot partition. +# Make sure to change the entry device entry to the one that you +# are installing the configuration to. +{ + disko.devices = { + disk = { + my-disk = { + # change this entry + device = "/dev/sda"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + ESP = { + type = "EF00"; + size = "500M"; + priority = 1; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + }; + }; + root = { + size = "100%"; + priority = 2; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/nix/systems/desktop/user.nix b/nix/systems/desktop/user.nix new file mode 100644 index 0000000..85dcd20 --- /dev/null +++ b/nix/systems/desktop/user.nix @@ -0,0 +1,1395 @@ +{ lib, config, pkgs, wallpapers, scripts, ... }: +let + vars = import ./vars.nix; +in +{ + sops = { + defaultSopsFile = ../../secrets/secrets.yaml; + age = { + keyFile = "/home/${vars.userName}/.ssh/keys.txt"; + }; + secrets.mail = { + format = "yaml"; + path = "${config.sops.defaultSymlinkPath}/mail"; + }; + secrets.digikey = { + format = "yaml"; + path = "${config.sops.defaultSymlinkPath}/digikey"; + }; + + defaultSymlinkPath = "/run/user/1000/secrets"; + defaultSecretsMountPoint = "/run/user/1000/secrets.d"; + }; + + home = { + activation.startup-files = lib.hm.dag.entryAfter [ "installPackages" ] '' + if [ ! -d "/home/${vars.userName}/org/website/" ]; then + mkdir -p /home/${vars.userName}/org/website/ + ${pkgs.git}/bin/git clone https://git.${vars.remoteHost}/ret2pop-website.git /home/${vars.userName}/org/website/ + fi + + if [ ! -d "/home/${vars.userName}/src/publish-org-roam-ui" ]; then + mkdir -p /home/${vars.userName}/src + ${pkgs.git}/bin/git clone https://git.${vars.remoteHost}/publish-org-roam-ui.git /home/${vars.userName}/src/publish-org-roam-ui + fi + + if [ ! -d "/home/${vars.userName}/.password-store" ]; then + ${pkgs.git}/bin/git clone https://git.${vars.remoteHost}/passwords.git /home/${vars.userName}/.password-store + fi + + if [ ! -d "/home/${vars.userName}/email/ret2pop/" ]; then + mkdir -p /home/${vars.userName}/email/ret2pop/ + fi + + if [ ! -d "/home/${vars.userName}/music" ]; then + mkdir -p /home/${vars.userName}/music + fi + + if [ ! -d "/home/${vars.userName}/sounds" ]; then + mkdir -p /home/${vars.userName}/sounds + fi + touch /home/${vars.userName}/org/agenda.org + touch /home/${vars.userName}/org/notes.org + + if [ ! -f "/home/${vars.userName}/.toughnix" ]; then + echo "Don't delete this file. Autogen by home manager" > "/home/${vars.userName}/.toughnix" + fi + ''; + + enableNixpkgsReleaseCheck = false; + username = vars.userName; + homeDirectory = "/home/${vars.userName}"; + stateVersion = "24.11"; + + packages = with pkgs; [ + # kicad + age + acpilight + alsa-utils + autobuild + bash-language-server + bear + bitcoin + bun + cargo + clang + clang-tools + curl + electrum + ffmpeg + fira-code + font-awesome_6 + fswebcam + gdb + ghostscript + git + gnumake + gnupg + graphviz + grim + gum + (writeShellScriptBin "post-install" '' +cd $HOME +ping -q -c1 google.com &>/dev/null && echo "online! Proceeding with the post-install..." || nmtui +sudo chown -R "$(whoami)":users toughnix + +sudo nixos-rebuild switch --flake ./toughnix#continuity +echo "Post install done! Now install your ssh and gpg keys. Log in again." +sleep 3 +exit +'') + helvum + imagemagick + inkscape + jq + krita + libnotify + miniserve + monero-cli + monero-gui + mpc-cli + mu + nil + nixd + nixfmt-rfc-style + nodejs + noto-fonts + noto-fonts-cjk-sans + noto-fonts-emoji + octaveFull + openscad + openscad-lsp + pandoc + passExtensions.pass-otp + pavucontrol + pfetch + pinentry + poetry + python3 + python312Packages.jedi + rsync + rust-analyzer + rustfmt + solc + sops + sox + swww + texliveFull + tor-browser + torsocks + typescript + vesktop + vim + vscode-langservers-extracted + x11_ssh_askpass + xdg-utils + yarn + (aspellWithDicts + (dicts: with dicts; [ en en-computers en-science ])) + (nerdfonts.override { fonts = [ "Iosevka" ]; }) + (pass.withExtensions (ext: with ext; [ + pass-otp + pass-import + pass-genphrase + pass-update + pass-tomb + ])) + ]; + }; + + services = { + mako = { + enable = true; + backgroundColor = "#11111bf8"; + textColor = "#cdd6f4"; + borderColor = "#89b4faff"; + borderRadius = 1; + font = "Fira Code 10"; + defaultTimeout = 3000; + extraConfig = '' +on-notify=exec mpv /home/${vars.userName}/sounds/notification.wav --no-config --no-video +''; + }; + + gpg-agent = { + pinentryPackage = pkgs.pinentry-emacs; + enable = true; + extraConfig = '' + allow-emacs-pinentry + allow-loopback-pinentry + ''; + }; + + gammastep = { + enable = true; + provider = "manual"; + latitude = 49.282730; + longitude = -123.120735; + + temperature = { + day = 5000; + night = 3000; + }; + + settings = { + general = { + adjustment-method = "wayland"; + }; + }; + }; + + mpd = { + enable = true; + dbFile = "/home/${vars.userName}/.config/mpd/db"; + dataDir = "/home/${vars.userName}/.config/mpd/"; + network.port = 6600; + musicDirectory = "/home/${vars.userName}/music"; + playlistDirectory = "/home/${vars.userName}/.config/mpd/playlists"; + network.listenAddress = "0.0.0.0"; + extraConfig = '' + audio_output { + type "pipewire" + name "pipewire output" + } + audio_output { + type "httpd" + name "My HTTP Stream" + encoder "opus" # optional + port "8000" + # quality "5.0" # do not define if bitrate is defined + bitrate "128000" # do not define if quality is defined + format "48000:16:1" + always_on "yes" # prevent MPD from disconnecting all listeners when playback is stopped. + tags "yes" # httpd supports sending tags to listening streams. + } + ''; + }; + }; + + programs = { + chromium = { + package = pkgs.chromium; + enable = true; + extensions = [ + "ddkjiahejlhfcafbddmgiahcphecmpfh" # ublock-origin lite + "dbepggeogbaibhgnhhndojpepiihcmeb" # vimium + "eimadpbcbfnmbkopoojfekhnkhdbieeh" # dark reader + "oicakdoenlelpjnkoljnaakdofplkgnd" # tree style tabs + "nkbihfbeogaeaoehlefnkodbefgpgknn" # metamask + ]; + }; + + mpv = { + enable = true; + config = { + profile = "gpu-hq"; + force-window = true; + ytdl-format = "bestvideo+bestaudio"; + cache-default = 4000000; + }; + }; + + yt-dlp = { + enable = true; + settings = { + embed-thumbnail = true; + embed-subs = true; + sub-langs = "all"; + downloader = "aria2c"; + downloader-args = "aria2c:'-c -x8 -s8 -k1M'"; + }; + }; + + wofi = { + enable = true; + settings = { + location = "bottom-right"; + allow_markup = true; + show = "drun"; + width = 750; + height = 400; + always_parse_args = true; + show_all = false; + term = "kitty"; + hide_scroll = true; + print_command = true; + insensitive = true; + prompt = "Run what, Commander?"; + columns = 2; + }; + + style = '' + @define-color rosewater #f5e0dc; + @define-color rosewater-rgb rgb(245, 224, 220); + @define-color flamingo #f2cdcd; + @define-color flamingo-rgb rgb(242, 205, 205); + @define-color pink #f5c2e7; + @define-color pink-rgb rgb(245, 194, 231); + @define-color mauve #cba6f7; + @define-color mauve-rgb rgb(203, 166, 247); + @define-color red #f38ba8; + @define-color red-rgb rgb(243, 139, 168); + @define-color maroon #eba0ac; + @define-color maroon-rgb rgb(235, 160, 172); + @define-color peach #fab387; + @define-color peach-rgb rgb(250, 179, 135); + @define-color yellow #f9e2af; + @define-color yellow-rgb rgb(249, 226, 175); + @define-color green #a6e3a1; + @define-color green-rgb rgb(166, 227, 161); + @define-color teal #94e2d5; + @define-color teal-rgb rgb(148, 226, 213); + @define-color sky #89dceb; + @define-color sky-rgb rgb(137, 220, 235); + @define-color sapphire #74c7ec; + @define-color sapphire-rgb rgb(116, 199, 236); + @define-color blue #89b4fa; + @define-color blue-rgb rgb(137, 180, 250); + @define-color lavender #b4befe; + @define-color lavender-rgb rgb(180, 190, 254); + @define-color text #cdd6f4; + @define-color text-rgb rgb(205, 214, 244); + @define-color subtext1 #bac2de; + @define-color subtext1-rgb rgb(186, 194, 222); + @define-color subtext0 #a6adc8; + @define-color subtext0-rgb rgb(166, 173, 200); + @define-color overlay2 #9399b2; + @define-color overlay2-rgb rgb(147, 153, 178); + @define-color overlay1 #7f849c; + @define-color overlay1-rgb rgb(127, 132, 156); + @define-color overlay0 #6c7086; + @define-color overlay0-rgb rgb(108, 112, 134); + @define-color surface2 #585b70; + @define-color surface2-rgb rgb(88, 91, 112); + @define-color surface1 #45475a; + @define-color surface1-rgb rgb(69, 71, 90); + @define-color surface0 #313244; + @define-color surface0-rgb rgb(49, 50, 68); + @define-color base #1e1e2e; + @define-color base-rgb rgb(30, 30, 46); + @define-color mantle #181825; + @define-color mantle-rgb rgb(24, 24, 37); + @define-color crust #11111b; + @define-color crust-rgb rgb(17, 17, 27); + + * { + font-family: 'Iosevka Nerd Font', monospace; + font-size: 14px; + } + + /* Window */ + window { + margin: 0px; + padding: 10px; + border: 0.16em solid @lavender; + border-radius: 0.1em; + background-color: @base; + animation: slideIn 0.5s ease-in-out both; + } + + /* Slide In */ + @keyframes slideIn { + 0% { + opacity: 0; + } + + 100% { + opacity: 1; + } + } + + /* Inner Box */ + #inner-box { + margin: 5px; + padding: 10px; + border: none; + background-color: @base; + animation: fadeIn 0.5s ease-in-out both; + } + + /* Fade In */ + @keyframes fadeIn { + 0% { + opacity: 0; + } + + 100% { + opacity: 1; + } + } + + /* Outer Box */ + #outer-box { + margin: 5px; + padding: 10px; + border: none; + background-color: @base; + } + + /* Scroll */ + #scroll { + margin: 0px; + padding: 10px; + border: none; + background-color: @base; + } + + /* Input */ + #input { + margin: 5px 20px; + padding: 10px; + border: none; + border-radius: 0.1em; + color: @text; + background-color: @base; + animation: fadeIn 0.5s ease-in-out both; + } + + #input image { + border: none; + color: @red; + } + + #input * { + outline: 4px solid @red!important; + } + + /* Text */ + #text { + margin: 5px; + border: none; + color: @text; + animation: fadeIn 0.5s ease-in-out both; + } + + #entry { + background-color: @base; + } + + #entry arrow { + border: none; + color: @lavender; + } + + /* Selected Entry */ + #entry:selected { + border: 0.11em solid @lavender; + } + + #entry:selected #text { + color: @mauve; + } + + #entry:drop(active) { + background-color: @lavender!important; + } + ''; + }; + + kitty = { + enable = true; + settings = { + enable_audio_bell = false; + font_family = "Iosevka Nerd Font"; + font_size = 14; + confirm_os_window_close = 0; + background_opacity = "0.9"; + # Catppuccin theme + foreground = "#cdd6f4"; + background = "#1e1e2e"; + selection_foreground = "#1e1e2e"; + selection_background = "#f5e0dc"; + cursor = "#f5e0dc"; + cursor_text_color = "#1e1e2e"; + url_color = "#f5e0dc"; + active_border_color = "#B4BEFE"; + inactive_border_color = "#6C7086"; + bell_border_color = "#F9E2AF"; + wayland_titlebar_color = "#1E1E2E"; + macos_titlebar_color = "#1E1E2E"; + active_tab_foreground = "#11111B"; + active_tab_background = "#CBA6F7"; + inactive_tab_foreground = "#CDD6F4"; + inactive_tab_background = "#181825"; + tab_bar_background = "#11111B"; + mark1_foreground = "#1E1E2E"; + mark1_background = "#B4BEFE"; + mark2_foreground = "#1E1E2E"; + mark2_background = "#CBA6F7"; + mark3_foreground = "#1E1E2E"; + mark3_background = "#74C7EC"; + color0 = "#45475A"; + color8 = "#585B70"; + color1 = "#F38BA8"; + color9 = "#F38BA8"; + color2 = "#A6E3A1"; + color10 = "#A6E3A1"; + color3 = "#F9E2AF"; + color11 = "#F9E2AF"; + color4 = "#89B4FA"; + color12 = "#89B4FA"; + color5 = "#F5C2E7"; + color13 = "#F5C2E7"; + color6 = "#94E2D5"; + color14 = "#94E2D5"; + color7 = "#BAC2DE"; + color15 = "#A6ADC8"; + }; + }; + + firefox = { + policies = { + EnableTrackingProtection = true; + OfferToSaveLogins = false; + }; + + package = pkgs.firefox-wayland; + enable = true; + + profiles = { + default = { + id = 0; + name = "default"; + isDefault = true; + + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + ublock-origin + tree-style-tab + firefox-color + vimium + metamask + ]; + + settings = { + media = { + memory_cache_max_size = 65536; + cache_readahead_limit = 7200; + cache_resume_threshold = 3600; + peerconnection.ice = { + proxy_only_if_behind_proxy = true; + default_address_only = true; + }; + }; + + gfx = { + content.skia-font-cache-size = 20; + canvas.accelerated = { + cache-items = 4096; + cache-size = 512; + }; + }; + + network = { + http = { + max-connections = 1800; + max-persistent-connections-per-server = 10; + max-urgent-start-excessive-connections-per-host = 5; + referer.XOriginTrimmingPolicy = 2; + }; + + buffer.cache = { + size = 262144; + count = 128; + }; + + dns = { + max_high_priority_threads = 8; + disablePrefetch = true; + }; + + pacing.requests.enabled = false; + dnsCacheExpiration = 3600; + ssl_tokens_cache_capacity = 10240; + prefetch-next = false; + predictor.enabled = false; + cookie.sameSite.noneRequiresSecure = true; + IDN_show_punycode = true; + auth.subresource-http-auth-allow = 1; + captive-portal-service.enabled = false; + connectivity-service.enabled = false; + }; + + browser = { + download = { + always_ask_before_handling_new_types = true; + manager.addToRecentDocs = false; + open_pdf_attachments_inline = true; + start_downloads_in_tmp_dir = true; + }; + + urlbar = { + suggest.quicksuggest.sponsored = false; + suggest.quicksuggest.nonsponsored = false; + suggest.calculator = true; + update2.engineAliasRefresh = true; + unitConversion.enabled = true; + trending.featureGate = false; + }; + + search = { + separatePrivateDefault.ui.enabled = true; + suggest.enabled = false; + }; + + newtabpage.activity-stream = { + feeds = { + topsites = false; + section.topstories = false; + telemetry = false; + }; + asrouter.userprefs.cfr = { + addons = false; + features = false; + }; + telemetry = false; + }; + + privatebrowsing = { + vpnpromourl = ""; + forceMediaMemoryCache = true; + }; + + display = { + focus_ring_on_anything = true; + focus_ring_style = 0; + focus_ring_width = 0; + }; + + cache.jsbc_compression_level = 3; + helperApps.deleteTempFileOnExit = true; + uitour.enabled = false; + sessionstore.interval = 60000; + formfill.enable = false; + xul.error_pages.expert_bad_cert = true; + contentblocking.category = "strict"; + ping-centre.telemetry = false; + discovery.enabled = false; + shell.checkDefaultBrowser = false; + preferences.moreFromMozilla = false; + tabs.tabmanager.enabled = false; + aboutConfig.showWarning = false; + aboutwelcome.enabled = false; + bookmarks.openInTabClosesMenu = false; + menu.showViewImageInfo = true; + compactmode.show = true; + safebrowsing.downloads.remote.enabled = false; + tabs.crashReporting.sendReport = false; + crashReports.unsubmittedCheck.autoSubmit2 = false; + privateWindowSeparation.enabled = false; + }; + + security = { + mixed_content = { + block_display_content = true; + upgrade_display_content = true; + }; + insecure_connection_text = { + enabled = true; + pbmode.enabled = true; + }; + OCSP.enabled = 0; + remote_settings.crlite_filters.enabled = true; + pki.crlite_mode = 2; + ssl.treat_unsafe_negotiation_as_broken = true; + tls.enable_0rtt_data = false; + }; + + toolkit = { + telemetry = { + unified = false; + enabled = false; + server = "data:,"; + archive.enabled = false; + newProfilePing.enabled = false; + shutdownPingSender.enabled = false; + updatePing.enabled = false; + bhrPing.enabled = false; + firstShutdownPing.enabled = false; + coverage.opt-out = true; + }; + coverage = { + opt-out = true; + endpoint.base = ""; + }; + legacyUserProfileCustomizations.stylesheets = true; + }; + + dom = { + security = { + https_first = true; + https_first_schemeless = true; + sanitizer.enabled = true; + }; + enable_web_task_scheduling = true; + }; + + layout = { + css = { + grid-template-masonry-value.enabled = true; + has-selector.enabled = true; + prefers-color-scheme.content-override = 2; + }; + word_select.eat_space_to_next_word = false; + }; + + urlclassifier = { + trackingSkipURLs = "*.reddit.com, *.twitter.com, *.twimg.com, *.tiktok.com"; + features.socialtracking.skipURLs = "*.instagram.com, *.twitter.com, *.twimg.com"; + }; + + privacy = { + globalprivacycontrol.enabled = true; + history.custom = true; + userContext.ui.enabled = true; + }; + + full-screen-api = { + transition-duration = { + enter = "0 0"; + leave = "0 0"; + }; + warning = { + delay = -1; + timeout = 0; + }; + }; + + permissions.default = { + desktop-notification = 2; + geo = 2; + }; + + signon = { + formlessCapture.enabled = false; + privateBrowsingCapture.enabled = false; + }; + + datareporting = { + policy.dataSubmissionEnabled = false; + healthreport.uploadEnabled = false; + }; + + extensions = { + pocket.enabled = false; + getAddons.showPane = false; + htmlaboutaddons.recommendations.enabled = false; + postDownloadThirdPartyPrompt = false; + }; + + app = { + shield.optoutstudies.enabled = false; + normandy.enabled = false; + normandy.api_url = ""; + }; + + image.mem.decode_bytes_at_a_time = 32768; + editor.truncate_user_pastes = false; + pdfjs.enableScripting = false; + geo.provider.network.url = "https://location.services.mozilla.com/v1/geolocate?key=%MOZILLA_API_KEY%"; + permissions.manager.defaultsUrl = ""; + webchannel.allowObject.urlWhitelist = ""; + breakpad.reportURL = ""; + captivedetect.canonicalURL = ""; + cookiebanners.service.mode = 1; + findbar.highlightAll = true; + content.notify.interval = 100000; + }; + }; + }; + }; + + waybar = { + enable = true; + style = '' + * { + border: none; + border-radius: 0px; + font-family: Iosevka Nerd Font, FontAwesome, Noto Sans CJK; + font-size: 14px; + font-style: normal; + min-height: 0; + } + + window#waybar { + background: rgba(30, 30, 46, 0.5); + border-bottom: 1px solid #45475a; + color: #cdd6f4; + } + + #workspaces { + background: #45475a; + margin: 5px 5px 5px 5px; + padding: 0px 5px 0px 5px; + border-radius: 16px; + border: solid 0px #f4d9e1; + font-weight: normal; + font-style: normal; + } + #workspaces button { + padding: 0px 5px; + border-radius: 16px; + color: #a6adc8; + } + + #workspaces button.active { + color: #f4d9e1; + background-color: transparent; + border-radius: 16px; + } + + #workspaces button:hover { + background-color: #cdd6f4; + color: black; + border-radius: 16px; + } + + #custom-date, #clock, #battery, #pulseaudio, #network, #custom-randwall, #custom-launcher { + background: transparent; + padding: 5px 5px 5px 5px; + margin: 5px 5px 5px 5px; + border-radius: 8px; + border: solid 0px #f4d9e1; + } + + #custom-date { + color: #D3869B; + } + + #custom-power { + color: #24283b; + background-color: #db4b4b; + border-radius: 5px; + margin-right: 10px; + margin-top: 5px; + margin-bottom: 5px; + margin-left: 0px; + padding: 5px 10px; + } + + #tray { + background: #45475a; + margin: 5px 5px 5px 5px; + border-radius: 16px; + padding: 0px 5px; + /*border-right: solid 1px #282738;*/ + } + + #clock { + color: #cdd6f4; + background-color: #45475a; + border-radius: 0px 0px 0px 24px; + padding-left: 13px; + padding-right: 15px; + margin-right: 0px; + margin-left: 10px; + margin-top: 0px; + margin-bottom: 0px; + font-weight: bold; + /*border-left: solid 1px #282738;*/ + } + + #battery { + color: #89b4fa; + } + + #battery.charging { + color: #a6e3a1; + } + + #battery.warning:not(.charging) { + background-color: #f7768e; + color: #f38ba8; + border-radius: 5px 5px 5px 5px; + } + + #backlight { + background-color: #24283b; + color: #db4b4b; + border-radius: 0px 0px 0px 0px; + margin: 5px; + margin-left: 0px; + margin-right: 0px; + padding: 0px 0px; + } + + #network { + color: #f4d9e1; + border-radius: 8px; + margin-right: 5px; + } + + #pulseaudio { + color: #f4d9e1; + border-radius: 8px; + margin-left: 0px; + } + + #pulseaudio.muted { + background: transparent; + color: #928374; + border-radius: 8px; + margin-left: 0px; + } + + #custom-randwall { + color: #f4d9e1; + border-radius: 8px; + margin-right: 0px; + } + + #custom-launcher { + color: #e5809e; + background-color: #45475a; + border-radius: 0px 24px 0px 0px; + margin: 0px 0px 0px 0px; + padding: 0 20px 0 13px; + /*border-right: solid 1px #282738;*/ + font-size: 20px; + } + + #custom-launcher button:hover { + background-color: #FB4934; + color: transparent; + border-radius: 8px; + margin-right: -5px; + margin-left: 10px; + } + + #custom-playerctl { + background: #45475a; + padding-left: 15px; + padding-right: 14px; + border-radius: 16px; + /*border-left: solid 1px #282738;*/ + /*border-right: solid 1px #282738;*/ + margin-top: 5px; + margin-bottom: 5px; + margin-left: 0px; + font-weight: normal; + font-style: normal; + font-size: 16px; + } + + #custom-playerlabel { + background: transparent; + padding-left: 10px; + padding-right: 15px; + border-radius: 16px; + /*border-left: solid 1px #282738;*/ + /*border-right: solid 1px #282738;*/ + margin-top: 5px; + margin-bottom: 5px; + font-weight: normal; + font-style: normal; + } + + #window { + background: #45475a; + padding-left: 15px; + padding-right: 15px; + border-radius: 16px; + /*border-left: solid 1px #282738;*/ + /*border-right: solid 1px #282738;*/ + margin-top: 5px; + margin-bottom: 5px; + font-weight: normal; + font-style: normal; + } + + #custom-wf-recorder { + padding: 0 20px; + color: #e5809e; + background-color: #1E1E2E; + } + + #cpu { + background-color: #45475a; + /*color: #FABD2D;*/ + border-radius: 16px; + margin: 5px; + margin-left: 5px; + margin-right: 5px; + padding: 0px 10px 0px 10px; + font-weight: bold; + } + + #memory { + background-color: #45475a; + /*color: #83A598;*/ + border-radius: 16px; + margin: 5px; + margin-left: 5px; + margin-right: 5px; + padding: 0px 10px 0px 10px; + font-weight: bold; + } + + #disk { + background-color: #45475a; + /*color: #8EC07C;*/ + border-radius: 16px; + margin: 5px; + margin-left: 5px; + margin-right: 5px; + padding: 0px 10px 0px 10px; + font-weight: bold; + } + + #custom-hyprpicker { + background-color: #45475a; + /*color: #8EC07C;*/ + border-radius: 16px; + margin: 5px; + margin-left: 5px; + margin-right: 5px; + padding: 0px 11px 0px 9px; + font-weight: bold; + } + ''; + settings = { + mainBar = { + layer = "top"; + position = "top"; + height = 50; + + output = vars.monitors; + + modules-left = [ "hyprland/workspaces" ]; + modules-center = [ "hyprland/window" ]; + modules-right = [ "battery" "clock" ]; + + battery = { + format = "{icon} {capacity}%"; + format-icons = ["" "" "" "" "" ]; + }; + + clock = { + format = "⏰ {:%a %d, %b %H:%M}"; + }; + }; + }; + }; + + zsh = { + enable = true; + initExtra = '' + umask 0077 + export EXTRA_CCFLAGS="-I/usr/include" + source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh + export QT_QPA_PLATFORM="wayland" + ''; + + localVariables = { + EDITOR = "emacsclient --create-frame --alternate-editor=vim"; + INPUT_METHOD = "fcitx"; + QT_IM_MODULE = "fcitx"; + GTK_IM_MODULE = "fcitx"; + XMODIFIERS = "@im=fcitx"; + XIM_SERVERS = "fcitx"; + WXSUPPRESS_SIZER_FLAGS_CHECK = "1"; + }; + + shellAliases = { + c = "clear"; + g = "git"; + v = "vim"; + py = "python3"; + rb = "sudo nixos-rebuild switch --flake .#continuity"; + nfu = "cd ~/toughnix && git add . && git commit -m \"new flake lock\" && nix flake update"; + usite + = "cd ~/src/publish-org-roam-ui && bash local.sh && rm -rf ~/website_html/graph_view; cp -r ~/src/publish-org-roam-ui/out ~/website_html/graph_view && rsync -azvP --chmod=\"Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r\" ~/website_html/ root@${vars.remoteHost}:/usr/share/nginx/ret2pop/"; + sai = "eval \"$(ssh-agent -s)\" && ssh-add ~/.ssh/id_ed25519 && ssh-add -l"; + i3 = "exec ${pkgs.i3-gaps}/bin/i3"; + }; + loginExtra = '' + if [[ "$(tty)" = "/dev/tty1" && -f "$HOME/.toughnix" ]]; then + exec Hyprland + fi + + if [[ ! -f "$HOME/.toughnix" ]]; then + post-install + fi + ''; + }; + + emacs = { + enable = true; + package = pkgs.emacs29-pgtk; + extraConfig = '' + (setq debug-on-error t) + (org-babel-load-file + (expand-file-name "~/org/website/config/emacs.org"))''; + extraPackages = epkgs: [ + epkgs.all-the-icons + epkgs.auctex + epkgs.catppuccin-theme + epkgs.chatgpt-shell + epkgs.company + epkgs.company-solidity + epkgs.counsel + epkgs.dashboard + epkgs.doom-modeline + epkgs.elfeed + epkgs.elfeed-org + epkgs.elfeed-tube + epkgs.elfeed-tube-mpv + epkgs.ellama + epkgs.elpher + epkgs.ement + epkgs.emmet-mode + epkgs.emms + epkgs.enwc + epkgs.evil + epkgs.evil-collection + epkgs.evil-commentary + epkgs.evil-org + epkgs.f + epkgs.flycheck + epkgs.general + epkgs.gptel + epkgs.gruvbox-theme + epkgs.htmlize + epkgs.irony-eldoc + epkgs.ivy + epkgs.ivy-pass + epkgs.latex-preview-pane + epkgs.lsp-ivy + epkgs.lsp-mode + epkgs.lyrics-fetcher + epkgs.magit + epkgs.magit-delta + epkgs.mu4e + epkgs.nix-mode + epkgs.org-fragtog + epkgs.org-journal + epkgs.org-roam + epkgs.org-roam-ui + epkgs.org-superstar + epkgs.page-break-lines + epkgs.password-store + epkgs.pdf-tools + epkgs.pinentry + epkgs.platformio-mode + epkgs.projectile + epkgs.rustic + epkgs.scad-mode + epkgs.simple-httpd + epkgs.solidity-flycheck + epkgs.solidity-mode + epkgs.sudo-edit + epkgs.treemacs + epkgs.treemacs-evil + epkgs.treemacs-magit + epkgs.treemacs-projectile + epkgs.treesit-auto + epkgs.typescript-mode + epkgs.unicode-fonts + epkgs.use-package + epkgs.vterm + epkgs.web-mode + epkgs.websocket + epkgs.which-key + epkgs.writegood-mode + epkgs.writeroom-mode + epkgs.yaml-mode + epkgs.yasnippet + epkgs.yasnippet-snippets + ]; + }; + + mbsync = { + enable = true; + extraConfig = '' + IMAPAccount ret2pop + Host ${vars.imapsServer} + User ${vars.email} + PassCmd "cat ${config.sops.secrets.mail.path}" + Port 993 + TLSType IMAPS + AuthMechs * + CertificateFile /etc/ssl/certs/ca-certificates.crt + + IMAPStore ret2pop-remote + Account ret2pop + + MaildirStore ret2pop-local + Path ~/email/ret2pop/ + Inbox ~/email/ret2pop/INBOX + SubFolders Verbatim + + Channel ret2pop + Far :ret2pop-remote: + Near :ret2pop-local: + Patterns * + Create Near + Sync All + Expunge None + SyncState * + ''; + }; + + msmtp = { + enable = true; + extraConfig = '' + # Set default values for all following accounts. + defaults + auth on + tls on + tls_trust_file /etc/ssl/certs/ca-certificates.crt + tls_certcheck off + logfile ~/.msmtp.log + + # Gmail + account ${vars.userName} + host ${vars.smtpsServer} + port 587 + from ${vars.email} + user ${vars.email} + passwordeval "cat ${config.sops.secrets.mail.path}" + + + # Set a default account + account default : ${vars.userName} + ''; + }; + + bash = { + enable = true; + }; + + git = { + enable = true; + userName = vars.fullName; + userEmail = vars.email; + signing = { + key = vars.gpgKey; + signByDefault = true; + }; + + extraConfig = { + init.defaultBranch = "main"; + }; + + aliases = { + co = "checkout"; + c = "commit"; + a = "add"; + s = "switch"; + b = "branch"; + }; + }; + home-manager.enable = true; + }; + + wayland.windowManager.hyprland = { + enable = true; + package = pkgs.hyprland; + xwayland.enable = true; + systemd.enable = true; + settings = { + "$mod" = "SUPER"; + exec-once = [ + "waybar" + "swww-daemon --format xrgb" + "swww img ${wallpapers}/imagination.png" + "fcitx5-remote -r" + "fcitx5 -d --replace" + "fcitx5-remote -r" + "emacs" + "firefox" + ]; + env = [ + "LIBVA_DRIVER_NAME,nvidia" + "XDG_SESSION_TYPE,wayland" + "GBM_BACKEND,nvidia-drm" + "__GLX_VENDOR_LIBRARY_NAME,nvidia" + "ELECTRON_OZONE_PLATFORM_HINT,auto" + ]; + blurls = [ + "waybar" + ]; + monitor = [ + "Unknown-1,disable" + ]; + windowrule = [ + "workspace 1, ^(.*emacs.*)$" + "workspace 2, ^(.*firefox.*)$" + "workspace 2, ^(.*Tor Browser.*)$" + "workspace 2, ^(.*Chromium-browser.*)$" + "workspace 2, ^(.*chromium.*)$" + "workspace 3, ^(.*discord.*)$" + "workspace 3, ^(.*vesktop.*)$" + "workspace 3, ^(.*fluffychat.*)$" + "workspace 3, ^(.*element-desktop.*)$" + "workspace 4, ^(.*qpwgraph.*)$" + "workspace 4, ^(.*mpv.*)$" + "workspace 5, ^(.*Monero.*)$" + "workspace 5, ^(.*org\.bitcoin\..*)$" + "workspace 5, ^(.*Bitcoin Core - preston.*)$" + "workspace 5, ^(.*org\.getmonero\..*)$" + "workspace 5, ^(.*Monero - preston.*)$" + "workspace 5, ^(.*electrum.*)$" + "pseudo,fcitx" + ]; + bind = [ + "$mod, F, exec, firefox" + "$mod, T, exec, tor-browser" + "$mod, Return, exec, kitty" + "$mod, E, exec, emacs" + "$mod, B, exec, bitcoin-qt" + "$mod, M, exec, monero-wallet-gui" + "$mod, V, exec, vesktop" + "$mod, D, exec, wofi --show run" + "$mod, P, exec, bash ${scripts}/powermenu.sh" + "$mod, Q, killactive" + "$mod SHIFT, H, movewindow, l" + "$mod SHIFT, L, movewindow, r" + "$mod SHIFT, K, movewindow, u" + "$mod SHIFT, J, movewindow, d" + "$mod, H, movefocus, l" + "$mod, L, movefocus, r" + "$mod, K, movefocus, u" + "$mod, J, movefocus, d" + ", XF86AudioPlay, exec, mpc toggle" + ", Print, exec, grim" + ] + ++ ( + builtins.concatLists (builtins.genList + ( + x: + let + ws = + let + c = (x + 1) / 10; + in + builtins.toString (x + 1 - (c * 10)); + in + [ + "$mod, ${ws}, workspace, ${toString (x + 1)}" + "$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" + ] + ) + 10) + ); + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + "$mod ALT, mouse:272, resizewindow" + ]; + binde = [ + ", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+" + ", XF86AudioLowerVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%-" + ", XF86AudioNext, exec, mpc next" + ", XF86AudioPrev, exec, mpc prev" + ", XF86MonBrightnessUp , exec, xbacklight -inc 10" + ", XF86MonBrightnessDown, exec, xbacklight -dec 10" + ]; + decoration = { + blur = { + enabled = true; + size = 5; + passes = 2; + }; + rounding = 5; + }; + input = { + kb_options = "caps:swapescape"; + repeat_delay = 300; + repeat_rate = 50; + natural_scroll = true; + touchpad = { + natural_scroll = true; + disable_while_typing = true; + tap-to-click = true; + }; + }; + cursor = { + no_hardware_cursors = true; + }; + misc = { + force_default_wallpaper = 0; + disable_hyprland_logo = true; + }; + }; + }; + + gtk = { + enable = true; + theme = null; + iconTheme = null; + }; + + i18n.inputMethod = { + enabled = "fcitx5"; + fcitx5.addons = with pkgs; [ + fcitx5-gtk + fcitx5-chinese-addons + fcitx5-configtool + fcitx5-mozc + fcitx5-rime + ]; + }; + + fonts.fontconfig.enable = true; + nixpkgs.config.cudaSupport = false; +} diff --git a/nix/systems/desktop/vars.nix b/nix/systems/desktop/vars.nix new file mode 100644 index 0000000..eb0b305 --- /dev/null +++ b/nix/systems/desktop/vars.nix @@ -0,0 +1,54 @@ +# Change the following variables +{ + # set your host name. + hostName = "continuity"; + + # username used for unix username as well as msmtp configuration name. + userName = "preston"; + + # your full name + fullName = "Preston Pan"; + + # Create a new gpg key for this system or import your keys from another system + gpgKey = "AEC273BF75B6F54D81343A1AC1FE6CED393AE6C1"; + + # Used for referencing the remote host in config. This mostly shouldn't matter if you are not + # using my website. + remoteHost = "nullring.xyz"; + + # email used for `From` and also as your login email. + email = "ret2pop@gmail.com"; + + # IMAPS server. Must be encrypted. + imapsServer = "imap.gmail.com"; + + # SMTPS server. Must be encrypted. + smtpsServer = "smtp.gmail.com"; + + # Change to your timezone + timeZone = "America/Vancouver"; + + # After rebooting, use the command `hyprctl monitors` in order to check which monitor + # you are using. This is so that waybar knows which monitors to appear in. + monitors = [ + "HDMI-A-1" + "eDP-1" + "DP-2" + "DP-3" + "LVDS-1" + ]; + + # enable video drivers based on your system. + # Example: + # videoDrivers = [ + # "nvidia" + # "amdgpu" + # ] + videoDrivers = [ + ]; + + # use false if this is your first install of continuity. + # See https://github.com/nix-community/lanzaboote/blob/master/docs/QUICK_START.md + # for more information. + secureBoot = false; +} diff --git a/nix/systems/installer/commits.nix b/nix/systems/installer/commits.nix new file mode 100644 index 0000000..f652035 --- /dev/null +++ b/nix/systems/installer/commits.nix @@ -0,0 +1,4 @@ +{ + diskoCommitHash = "latest"; + toughnixCommitHash = "HEAD"; +} diff --git a/nix/systems/installer/iso.nix b/nix/systems/installer/iso.nix new file mode 100644 index 0000000..2fcc08f --- /dev/null +++ b/nix/systems/installer/iso.nix @@ -0,0 +1,181 @@ +{ pkgs, lib, ... }: +let + commits = ./commits.nix; +in +{ + documentation = { + enable = true; + man.enable = true; + dev.enable = true; + }; + + environment = { + etc = { + securetty.text = '' + # /etc/securetty: list of terminals on which root is allowed to login. + # See securetty(5) and login(1). + ''; + }; + }; + + networking = { + hostName = "iso"; + wireless.enable = lib.mkForce false; + networkmanager = { + enable = true; + # wifi.macAddress = ""; + }; + firewall = { + allowedTCPPorts = [ ]; + allowedUDPPorts = [ ]; + }; + }; + + hardware = { + cpu.intel.updateMicrocode = true; + graphics = { + enable = true; + }; + pulseaudio.enable = false; + }; + + services = { + qemuGuest.enable = true; + chrony = { + enable = true; + enableNTS = true; + servers = [ "time.cloudflare.com" "ptbtime1.ptb.de" "ptbtime2.ptb.de" ]; + }; + + jitterentropy-rngd.enable = true; + resolved.dnssec = true; + dbus = { + apparmor = "enabled"; + }; + + pipewire = { + enable = true; + alsa = { + enable = true; + support32Bit = true; + }; + pulse.enable = true; + jack.enable = true; + wireplumber.enable = true; + extraConfig.pipewire-pulse."92-low-latency" = { + "context.properties" = [ + { + name = "libpipewire-module-protocol-pulse"; + args = { }; + } + ]; + "pulse.properties" = { + "pulse.min.req" = "32/48000"; + "pulse.default.req" = "32/48000"; + "pulse.max.req" = "32/48000"; + "pulse.min.quantum" = "32/48000"; + "pulse.max.quantum" = "32/48000"; + }; + "stream.properties" = { + "node.latency" = "32/48000"; + "resample.quality" = 1; + }; + }; + }; + + openssh = { + enable = true; + settings = { + PasswordAuthentication = true; + AllowUsers = [ "nixos" ]; + PermitRootLogin = "yes"; + KbdInteractiveAuthentication = false; + }; + }; + }; + + programs = { + zsh.enable = true; + ssh.enableAskPassword = false; + }; + + nixpkgs.config = { + allowUnfree = true; + cudaSupport = false; + }; + + environment.systemPackages = with pkgs; [ + cryptsetup + restic + sbctl + linux-manual + man-pages + man-pages-posix + ]; + + users.extraUsers.root.password = "nixos"; + users.extraUsers.nixos.password = "nixos"; + users.users = { + nixos = { + isNormalUser = true; + description = "NixOS"; + extraGroups = [ "networkmanager" "wheel" "video" "docker" "jackaudio" "tss" "dialout" ]; + shell = pkgs.zsh; + packages = with pkgs; [ + git + curl + gum + (writeShellScriptBin "nix_installer" + '' +#!/usr/bin/env bash +set -euo pipefail + +if [ "$(id -u)" -eq 0 ]; then + echo "ERROR! $(basename "$0") should be run as a regular user" + exit 1 +fi + +ping -q -c1 google.com &>/dev/null && echo "online! Proceeding with the installation..." || nmtui + +if [ ! -d "$HOME/toughnix/" ]; then + cd $HOME + git clone https://git.nullring.xyz/toughnix.git + cd toughnix + git checkout "${commits.toughnixCommitHash}" + cd $HOME +fi + +vim "$HOME/toughnix/systems/desktop/vars.nix" +vim "$HOME/toughnix/systems/desktop/sda-simple.nix" +sudo nix --experimental-features "nix-command flakes" run "github:nix-community/disko/${commits.diskoCommitHash}" -- --mode destroy,format,mount "$HOME/toughnix/systems/desktop/sda-simple.nix" +cd /mnt + +sudo nixos-install --flake $HOME/toughnix#continuity +sudo cp $HOME/toughnix "/mnt/home/$(ls /mnt/home/)/" +echo "Installation complete! Rebooting..." +sleep 3 +reboot +'') + ]; + }; + }; + + + nix.settings.experimental-features = "nix-command flakes"; + time.timeZone = "America/Vancouver"; + i18n.defaultLocale = "en_CA.UTF-8"; + + systemd = { + services.sshd.wantedBy = pkgs.lib.mkForce ["multi-user.target"]; + targets = { + sleep.enable = false; + suspend.enable = false; + hibernate.enable = false; + hybrid-sleep.enable = false; + }; + }; + + system = { + stateVersion = "24.11"; + }; +}