+++ /dev/null
-[submodule "publish-org-roam-ui"]
- path = publish-org-roam-ui
- url = https://git.nullring.xyz/publish-org-roam-ui.git
* What is this?
It's ret2pop! My website for all things math. Wait, no. Computer science.
-Music. Okay, let me try that again.
+Music. Okay, let me try that again. Is this even a website?
-It's ret2pop! My website for all things.
-** Sounds awesome! But why is it written in org instead of html?
-Because I have converted to the church of emacs. Remember:
-anything and everything that can be rewritten in org should be rewritten in org.
-*** so how did you actually do that?
+It's ret2pop, a wholistic experience powered by NixOS and Emacs.
+** so how did you actually do that?
By using the ~org-publish~ function, ~org-roam~, and ~org-journal~,
as well as writing a lot of things with a literate config. To see more, see my
-[[file:config/emacs.org][emacs configuration]] and my [[https://git.nullring.xyz/toughnix.git/tree/][NixOS configuration]].
+[[file:config/emacs.org][emacs configuration]] and my [[file:nix.org][NixOS configuration]].
** So, where is this website of yours located?
https://ret2pop.nullring.xyz, it is the road to enlightenment.
* Wait, so where are your dotfiles?
-To use my dotfiles, clone this repository:
+To use my dotfiles, download the ISO image for the installer, log in, and run:
#+begin_src bash
-git clone https://github.com/ret2pop/ret2pop-website.git ~/org/website
+ nmtui
+ git clone https://git.nullring.xyz/monorepo.git
+ # use vim to change whatever nix files you want
+ nix_installer
#+end_src
-and install my [[https://git.nullring.xyz/toughnix.git/][NixOS configuration]]. The org files /are/ the dotfiles, or
-at least in the case of emacs.
-
-To use my full system, you also need to have a ~password-store~ from the ~pass~
-password manager in its standard location with an entry called ~Mail~, and you should
-otherwise follow the instructions listed on the hyprnixmacs repository.
-
+That's it! If you want to install with all the default settings (look at them first), just run:
+#+begin_src bash
+ nix_installer
+#+end_src
+and it will work for you.
* License
See the [[file:LICENSE.org][license]]. The style.css has its own license.
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
+*** DONE [#A] NixOS Modules
:LOGBOOK:
CLOCK: [2025-01-11 Sat 17:03]--[2025-01-11 Sat 19:35] => 2:32
:END:
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
+*** DONE [#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
I want to make an analogue computer.
** TODO [#A] Dishes
There will be a TODO when I need to do the dishes.
-** Groceries
+** TODO Groceries
There will be a TODO when I need to get groceries.
* Scheduled tasks
** Friends
These are tasks related to seeing my friends. There will be tasks listed here when I schedule
something.
-*** TODO Travis and Friends Meetup
+*** DONE Travis and Friends Meetup
SCHEDULED: <2025-01-12 Sun 17:00>
Eating dinner with them.
- 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>
+SCHEDULED: <2025-01-20 Mon .+1d>
:PROPERTIES:
-:LAST_REPEAT: [2025-01-11 Sat 02:25]
+:LAST_REPEAT: [2025-01-19 Sun 11:53]
:END:
+- State "DONE" from "TODO" [2025-01-19 Sun 11:53]
+- State "DONE" from "TODO" [2025-01-16 Thu 19:19]
- 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.
--- /dev/null
+#+title: Reconstructing Postmodernism
+#+author: Preston Pan
+#+description:
+#+html_head: <link rel="stylesheet" type="text/css" href="../style.css" />
+#+html_head: <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
+#+html_head: <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
+#+html_head: <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
+#+html_head: <link rel="manifest" href="/site.webmanifest">
+#+html_head: <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
+#+html_head: <meta name="msapplication-TileColor" content="#da532c">
+#+html_head: <meta name="theme-color" content="#ffffff">
+#+html_head: <meta name="viewport" content="width=1000; user-scalable=0;" />
+#+language: en
+#+OPTIONS: broken-links:t
+
+* Introduction
+In the collective subconscious there is this idea of the "norm" -- a
+set of expected cultural attitudes and beliefs that other people hold
+in any given society. This idea is used to analyze hierarchical
+structures found in society, manifest in concepts like the patriarchy,
+queer rights, black liberation, and others. There are many frameworks
+that include all of the above as subframeworks and synthesize them in
+some way, but often they have a couple ideas in common: that the
+concepts that implicitly infect our society in some way via some
+hierarchical order are often unjustified and could be dissolved
+without much loss. I propose the following: that the conclusions
+presented (that often social hierarchies are unjustified) are true
+/in some sense/, but that the real story is more complicated. I posit
+that our inability to solve the problem of society and our treatment
+of minorities isn't a /problem of society/, but rather a framing problem.
+
+* The Bleak Culture
+Our current society is broken. This is a view shared by a vast
+majority of people, but many people hold this exact view for a
+multitude of reasons. I hold this view because I believe that no
+current cultural narrative solves the problem of our "current
+generation". The progressive narrative posits that our problems in
+society are highly linked with our inability to cope with social
+inequalities, often treating minorities and, often times, regular
+people poorly in favor of those with high status. The conservative
+answer to culture is that we must turn back, back to something that
+has been shown to work in the past.
+
argue that it has game theoretic foundations that make it superior to other kinds of voting systems.
** The Model
-Let us assume that there is a small probability that you can swing the election $$ \rho $$, and a cost to voting; that
-is to say, it takes some amount of time, which has opportunity cost associated with it to vote, which we
-will call $$ \alpha $$. Let us assume that there is a high /reward/ in swinging the vote; that is to say, if you were
-the one that swings the vote, your vote is worth some high monetary value. Let $$ \beta $$ be the median price of swinging.
-Let $$ n $$ be the number of people voting, and let the weight of each vote be equal between all participants.
-Let the choice of candidate between all voters be binary; voting for one candidate mutually excludes you from
-voting for another, and there are two candidates (this is to simply the model; you will see that this does not
-lose generality). Then, let us model the expected value of voting for singular individuals.
-
-For a given person, the probability that your vote swings (or at least ties) depends on the probability that
-$$ x = \frac{n - 1}{2} $$, where $ x $$ is the number of people that vote for your candidate. The probability
-density function for the probability that $$ m $$ people vote for your candidate we'll call $$ f $$. We will assume
-it is binomial, and you might expect it to be closer to 50/50 most of the time, but that is pretty hard to model.
-We will therefore compensate by modeling it more accurately afterwards. For now, we assume all participants have
-a 50% chance to pick either candidate.
-\begin{align*}
-\end{align*}
+Let us assume there is a small probability of swinging the
+election $$ \rho $$, and a large reward for winning the election $$ W $$.
+Let us assume that there are two candidates, and the probability of
+voting for a single candidate is 50%. Therefore, the final probability
+distribution for the number of votes each candidate gets is binomial,
+centered around the mean outcome (which is the outcome where there are
+an equal amount of votes on each side, and we can count the number of
+/red/ votes only; let's let $$ k $$ represent the number of red votes).
+Let's remind ourselves of the binomial distribution:
+\begin{align}
+ P(X = k) = { n \choose k } p^{k}(1 - p)^{n - k}
+\end{align}
+where $$ n $$ is the number of samples, and $$ k $$ is the observed
+number. Now, we can calculate the probability
(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)
+ ;; Startup errors
+ (warning-minimum-level :emergency "Supress emacs warnings")
+ (debug-ignored-errors (cons 'remote-file-error debug-ignored-errors) "Remove annoying error from debug errors")
+
+ ;; Mouse wheel
+ (mouse-wheel-scroll-amount '(1 ((shift) . 1)) "Nicer scrolling")
+ (mouse-wheel-progressive-speed nil "Make scrolling non laggy")
+ (mouse-wheel-follow-mouse 't "Scroll correct window")
+ (scroll-conservatively 101 "Sort of smooth scrolling")
+ (scroll-step 1 "Scroll one line at a time")
+ (display-time-24hr-format t "Use 24 hour format to read the time")
+ (display-line-numbers-type 'relative "Relative line numbers for easy vim jumping")
+ (use-short-answers t "Use y instead of yes")
+ (make-backup-files nil "Don't make backups")
+ (display-fill-column-indicator-column 100 "Draw a line at 100 characters")
+ (line-spacing 2 "Default line spacing")
+
+ ;; Editor comments
+ (c-doc-comment-style '((c-mode . doxygen)
+ (c++-mode . doxygen)))
+ :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 . display-line-numbers-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))))
:config
(require 'tex-site)
+ (server-start)
+
+ ;; start wiith sane defaults
(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, fonts, and transparency. Prettify symbols.
+ (global-prettify-symbols-mode 1)
(load-theme 'catppuccin :no-confirm)
- (set-face-attribute 'default nil :height 120)
+ (set-face-attribute 'default nil :font "Iosevka Nerd Font" :height 130)
(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)))))
+ (add-to-list 'default-frame-alist '(alpha-background . 90)))
(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 "~/monorepo/agenda.org"
- "~/org/notes.org"
- "~/org/agenda.org"))
- (setq org-default-notes-file (concat org-directory "/notes.org"))
- (setq org-publish-project-alist
+ :custom
+ (org-confirm-babel-evaluate nil "Don't ask to evaluate code block")
+ (org-export-with-broken-links t "publish website even with broken links")
+ (org-src-fontify-natively t "Colors!")
+ (org-latex-preview-image-directory (expand-file-name "~/.cache/ltximg/") "don't use weird cache location")
+ (org-preview-latex-image-directory (expand-file-name "~/.cache/ltximg/") "don't use weird cache location")
+ (TeX-PDF-mode t)
+ (org-latex-pdf-process '("xelatex -interaction=nonstopmode -output-directory=%o %f") "set xelatex as default")
+ (TeX-engine 'xetex "set xelatex as default engine")
+ (preview-default-option-list '("displaymath" "textmath" "graphics") "preview latex")
+ (preview-image-type 'png "Use PNGs")
+ (org-format-latex-options (plist-put org-format-latex-options :scale 1.5) "space latex better")
+ (org-return-follows-link t "be able to follow links without mouse")
+ (org-habit-preceding-days 1 "See org habit entries")
+ (org-startup-indented t "Indent the headings")
+ (org-image-actual-width '(300) "Cap width")
+ (org-startup-with-latex-preview t "see latex previews on opening file")
+ (org-startup-with-inline-images t "See images on opening file")
+ (org-hide-emphasis-markers t "prettify org mode")
+ (org-use-sub-superscripts "{}" "Only display superscripts and subscripts when enclosed in {}")
+ (org-pretty-entities t "prettify org mode")
+ (org-agenda-files (list "~/monorepo/agenda.org" "~/org/notes.org" "~/org/agenda.org") "set default org files")
+ (org-default-notes-file (concat org-directory "/notes.org") "Notes file")
+ (org-publish-project-alist
'(("website-org"
:base-directory "~/monorepo"
:base-extension "org"
: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")
+ ("website" :auto-sitemap t :components ("website-org" "website-static"))) "functions to publish website")
+ (org-html-postamble "Copyright © 2024 Preston Pan" "set copyright notice on bottom of site")
:config
(require 'ox-publish)
(require 'org-tempo)
:init (unicode-fonts-setup))
(use-package electric-pair
- :hook ((org-mode . electric-pair-mode)
- (prog-mode . electric-pair-mode)))
+ :hook ((prog-mode . electric-pair-mode)))
(use-package lyrics-fetcher
:after (emms)
+ :custom
+ (lyrics-fetcher-genius-access-token (password-store-get "genius_api") "Use genius for backend")
:config
- (setq lyrics-fetcher-genius-access-token
- (password-store-get "genius_api"))
(lyrics-fetcher-use-backend 'genius))
(use-package org-fragtog :hook (org-mode . org-fragtog-mode))
(use-package company
:config
- '(add-to-list 'company-backends
- '(company-ispell company-capf company-irony
- company-yasnippet company-files))
+ '(add-to-list 'company-backends '(company-ispell company-capf company-yasnippet company-files))
:hook ((after-init . global-company-mode)))
(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"))
+ :custom
+ (ispell-program-name "aspell" "use aspell")
+ (ispell-silently-savep t "Save changes to dict without confirmation")
+ (ispell-dictionary "en" "Use english dictionary")
+ (ispell-alternate-dictionary "~/.local/share/dict" "dict location"))
(use-package flyspell
:hook (text-mode . flyspell-mode))
(use-package evil
- :init
- (setq evil-want-keybinding nil)
+ :custom
+ (evil-want-keybinding nil "Don't load a whole bunch of default keybindings")
:config
(evil-mode 1)
- (evil-set-undo-system 'undo-redo))
+ (evil-set-undo-system 'undo-redo)
+ (evil-set-initial-state 'pdf-view-mode 'normal))
(use-package evil-collection
:after (evil)
- :init
- (setq evil-want-keybinding nil)
:config
+ (with-eval-after-load 'evil-maps
+ (define-key evil-motion-state-map (kbd "SPC") nil)
+ (define-key evil-motion-state-map (kbd "RET") nil)
+ (define-key evil-motion-state-map (kbd "TAB") nil))
(evil-collection-init))
-(with-eval-after-load 'evil-maps
-(define-key evil-motion-state-map (kbd "SPC") nil)
-(define-key evil-motion-state-map (kbd "RET") nil)
-(define-key evil-motion-state-map (kbd "TAB") nil))
+
(use-package evil-commentary
:after (evil)
(evil-commentary-mode))
(use-package evil-org
- :after (evil org)
+ :after (evil org)
:hook (org-mode . (lambda () evil-org-mode))
:config
(require 'evil-org-agenda)
(use-package page-break-lines
:init
(page-break-lines-mode))
-(evil-set-initial-state 'pdf-view-mode 'normal)
(use-package org-journal
:after (org)
+ :custom
+ (org-journal-dir "~/monorepo/journal/" "Set journal directory")
+ (org-journal-date-format "%A, %d %B %Y" "Date format")
+ (org-journal-file-format "%Y%m%d.org" "Automatic file creation format based on date")
+ (org-journal-enable-agenda-integration t "All org-journal entries are org-agenda entries")
:init
- (setq org-journal-dir "~/monorepo/journal/")
- (setq org-journal-date-format "%A, %d %B %Y")
-
- (defun org-journal-file-header-func (time)
+ (defun org-journal-file-header-func (time)
"Custom function to create journal header."
(concat
- (pcase org-journal-file-type
- (`daily "#+TITLE: Daily Journal\n#+STARTUP: showeverything\n#+DESCRIPTION: My daily journal entry\n#+AUTHOR: Preston Pan\n#+HTML_HEAD: <link rel=\"stylesheet\" type=\"text/css\" href=\"../style.css\" />\n#+html_head: <script src=\"https://polyfill.io/v3/polyfill.min.js?features=es6\"></script>\n#+html_head: <script id=\"MathJax-script\" async src=\"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js\"></script>\n#+options: broken-links:t")
- (`weekly "#+TITLE: Weekly Journal\n#+STARTUP: folded")
- (`monthly "#+TITLE: Monthly Journal\n#+STARTUP: folded")
- (`yearly "#+TITLE: Yearly Journal\n#+STARTUP: folded"))))
-
- (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))
+ (pcase org-journal-file-type
+ (`daily "#+TITLE: Daily Journal\n#+STARTUP: showeverything\n#+DESCRIPTION: My daily journal entry\n#+AUTHOR: Preston Pan\n#+HTML_HEAD: <link rel=\"stylesheet\" type=\"text/css\" href=\"../style.css\" />\n#+html_head: <script src=\"https://polyfill.io/v3/polyfill.min.js?features=es6\"></script>\n#+html_head: <script id=\"MathJax-script\" async src=\"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js\"></script>\n#+options: broken-links:t")
+ (`weekly "#+TITLE: Weekly Journal\n#+STARTUP: folded")
+ (`monthly "#+TITLE: Monthly Journal\n#+STARTUP: folded")
+ (`yearly "#+TITLE: Yearly Journal\n#+STARTUP: folded"))))
+ (setq org-journal-file-header 'org-journal-file-header-func))
(use-package doom-modeline
:config
:hook (org-mode . (lambda () (org-superstar-mode 1))))
(use-package eglot
- :config
- (add-to-list 'eglot-server-programs '(nix-mode . ("nil")))
:hook
(prog-mode . eglot-ensure)
- (nix-mode . eglot-ensure))
+ (nix-mode . eglot-ensure)
+ :config
+ (add-to-list 'eglot-server-programs '(nix-mode . ("nil"))))
+
(use-package lsp
:hook
(prog-mode . lsp))
+
+(use-package flycheck
+ :config (global-flycheck-mode))
+
(use-package platformio-mode
:hook (prog-mode . platformio-conditionally-enable))
(use-package solidity-mode)
(use-package company-solidity)
(use-package solidity-flycheck
- :init
- (setq solidity-flycheck-solc-checker-active t))
-
-(use-package flycheck
- :config (global-flycheck-mode))
+ :custom
+ (solidity-flycheck-solc-checker-active t))
(use-package projectile
- :init
- (setq projectile-project-search-path '("~/org" "~/src"))
+ :custom
+ (projectile-project-search-path '("~/org" "~/src" "~/monorepo" "~/projects") "search path for projects")
:config
(projectile-mode +1))
(use-package dashboard
:after (projectile)
- :init
- (setq dashboard-banner-logo-title "Welcome, Commander!")
- (setq dashboard-icon-type 'nerd-icons)
- (setq dashboard-vertically-center-content t)
- (setq dashboard-set-init-info t)
- (setq dashboard-week-agenda t)
- (setq dashboard-items '((recents . 5)
+ :custom
+ (dashboard-banner-logo-title "Welcome, Commander!" "Set title for dashboard")
+ (dashboard-icon-type 'nerd-icons "Use nerd icons")
+ (dashboard-vertically-center-content t "Center content")
+ (dashboard-set-init-info t)
+ (dashboard-week-agenda t "Agenda in dashboard")
+ (dashboard-items '((recents . 5)
(bookmarks . 5)
(projects . 5)
(agenda . 5)
- (registers . 5)))
+ (registers . 5)) "Look at some items")
:config
(dashboard-setup-startup-hook))
(use-package counsel)
(use-package ivy
- :init
- (setq ivy-use-virtual-buffers t)
- (setq enable-recursive-minibuffers t)
+ :custom
+ (ivy-use-virtual-buffers t "Make searching more efficient")
+ (enable-recursive-minibuffers t "Don't get soft locked when in a minibuffer")
: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)
(use-package magit)
(use-package erc
- :init
- (setq
- erc-nick system-username
- erc-user-full-name system-fullname))
+ :custom
+ (erc-nick system-username "Set erc nick to username")
+ (erc-user-full-name system-fullname "Use real name for full name"))
(use-package general
:init
(interactive)
(ement-connect :uri-prefix "http://localhost:8009"))
:config
- (general-create-definer leader-key
- :prefix "SPC")
+ (general-create-definer leader-key :prefix "SPC")
(leader-key 'normal
"o a" '(org-agenda :wk "Open agenda")
"o c" '(org-capture :wk "Capture")
+ "n" '(:ignore t :wk "Org mode plugins")
"n j j" '(org-journal-new-entry :wk "Make new journal entry")
"n r f" '(org-roam-node-find :wk "Find roam node")
"n r i" '(org-roam-node-insert :wk "Insert roam node")
"n r g" '(org-roam-graph :wk "Graph roam database")
"r s s" '(elfeed :wk "rss feed")
"." '(counsel-find-file :wk "find file")
+ "g" '(:ignore t :wk "Magit")
"g /" '(magit-dispatch :wk "git commands")
"g P" '(magit-push :wk "git push")
"g c" '(magit-commit :wk "git commit")
"g p" '(magit-pull :wk "Pull from git")
"g s" '(magit-status :wk "Change status of files")
+ "o" '(:ignore t :wk "Open application")
"o t" '(vterm :wk "Terminal")
"o e" '(eshell :wk "Elisp Interpreter")
"o m" '(mu4e :wk "Email")
+
"e w w" '(eww :wk "web browser")
"e c c" '(ellama-chat :wk "Chat with Ollama")
"e a b" '(ellama-ask-about :wk "Ask Ollama")
"e c e" '(ellama-code-edit :wk "Edit code with Ollama")
"e w i" '(ellama-improve-wording :wk "Improve wording with Ollama")
"e g i" '(ellama-improve-grammar :wk "Improve grammar with Ollama")
+
+ "c" '(:ignore t :wk "Counsel commands")
+ "c g" '(counsel-git :wk "Search file in git project")
+ "c f" '(counsel-git-grep :wk "Find string in git project")
+
"g s" '(gptel-send :wk "Send to Ollama")
"g e" '(gptel :wk "Ollama interface")
- "p w" '(ivy-pass :wk "Password manager interface")
"m P p" '(org-publish :wk "Publish website components")
"s e" '(sudo-edit :wk "Edit file with sudo")
"m m" '(emms :wk "Music player")
"i p c" '(prestonpan :wk "Connect to my IRC server")
"i l c" '(liberachat :wk "Connect to libera chat server")
"i e c" '(efnet :wk "Connect to efnet chat server")
+ "h" '(:ignore t :wk "Documentation")
+ "h v" '(counsel-describe-variable :wk "Describe variable")
+ "h f" '(counsel-describe-function :wk "Describe function")
+ "h h" '(help :wk "Help")
"h m" '(woman :wk "Manual")
"h i" '(info :wk "Info")
"s m" '(proced :wk "System Manager")
"h r r" '(lambda () (interactive) (org-babel-load-file (expand-file-name "~/monorepo/config/emacs.org")))))
(use-package ellama
+ :custom
+ (ellama-sessions-directory "~/org/ellama/" "Set org directory")
:init
- (setopt ellama-sessions-directory "~/org/ellama/")
(require 'llm-ollama)
- (with-eval-after-load 'llm-ollama)
(setopt ellama-provider (make-llm-ollama
:host "localhost"
:chat-model "gemma:7b")))
(use-package elfeed
- :hook ((elfeed-search-mode . elfeed-update))
- :init
- (setq elfeed-search-filter "@1-month-ago +unread"))
+ :custom
+ (elfeed-search-filter "@1-month-ago +unread" "Only display unread articles from a month ago")
+ :hook ((elfeed-search-mode . elfeed-update)))
(use-package elfeed-org
- :init
- (setq rmh-elfeed-org-files '("~/monorepo/config/elfeed.org"))
+ :custom
+ (rmh-elfeed-org-files '("~/monorepo/config/elfeed.org") "Use elfeed config in repo as default")
:config
(elfeed-org))
:after elfeed
:demand t
:config
- ;; (setq elfeed-tube-auto-save-p nil) ; default value
- ;; (setq elfeed-tube-auto-fetch-p t) ; default value
(elfeed-tube-setup)
-
:bind (:map elfeed-show-mode-map
("F" . elfeed-tube-fetch)
([remap save-buffer] . elfeed-tube-save)
:after (treemacs magit))
(use-package eww
- :init
- (setq search-engines
+ :custom
+ (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")))
+ (("rfc-kw" "rk") "https://www.rfc-editor.org/search/rfc_search_detail.php?title=%s"))
+ "use this set of search engines")
- (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")
+ (search-engine-default "google" "Use google as default")
+ (eww-search-prefix "https://google.com/search?q=" "Google prefix")
+ (browse-url-secondary-browser-function 'browse-url-generic browse-url-generic-program "firefox" "Use firefox as secondary browser")
: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")
- (setq org-roam-directory (file-truename "~/monorepo/mindmap"))
- (setq org-roam-capture-templates '(("d" "default" plain "%?"
- :target (file+head "${title}.org"
- "#+title: ${title}\n#+author: Preston Pan\n#+html_head: <link rel=\"stylesheet\" type=\"text/css\" href=\"../style.css\" />\n#+html_head: <script src=\"https://polyfill.io/v3/polyfill.min.js?features=es6\"></script>\n#+html_head: <script id=\"MathJax-script\" async src=\"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js\"></script>\n#+options: broken-links:t")
- :unnarrowed t)))
- :config
- (org-roam-db-autosync-mode))
+ :after (org)
+ :custom
+ (org-roam-db-update-on-save t "Update org-roam db")
+ (org-roam-graph-viewer "firefox" "Use firefox to view org-roam graph")
+ (org-roam-directory (file-truename "~/monorepo/mindmap") "Set org-roam directory inside monorepo")
+ (org-roam-capture-templates '(("d" "default" plain "%?"
+ :target (file+head "${title}.org"
+ "#+title: ${title}\n#+author: Preston Pan\n#+html_head: <link rel=\"stylesheet\" type=\"text/css\" href=\"../style.css\" />\n#+html_head: <script src=\"https://polyfill.io/v3/polyfill.min.js?features=es6\"></script>\n#+html_head: <script id=\"MathJax-script\" async src=\"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js\"></script>\n#+options: broken-links:t")
+ :unnarrowed t)) "org-roam files start with this snippet by default")
+ :config
+ (org-roam-db-autosync-mode)
+ ;; Otherwise links are broken when publishing
+ (org-roam-update-org-id-locations))
(use-package org-roam-ui
- :after org-roam
- :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))
+ :after org-roam
+ :hook (after-init . org-roam-ui-mode)
+ :custom
+ (org-roam-ui-sync-theme t "Use emacs theme for org-roam-ui")
+ (org-roam-ui-follow t "Have cool visual while editing org-roam")
+ (org-roam-ui-update-on-save t "This option is obvious")
+ (org-roam-ui-open-on-start t "Have cool visual open in firefox when emacs loads"))
(use-package pinentry
- :init (setq epa-pinentry-mode `loopback)
+ :custom (epa-pinentry-mode `loopback "Set this option to match gpg-agent.conf")
:config (pinentry-start))
-;; (use-package latex-preview-pane
-;; :config
-;; (latex-preview-pane-enable))
-
-;; SMTP settings:
(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))
+ :custom
+ (user-mail-address system-email "Use our email")
+ (user-full-name system-fullname "Use our full name")
+ (sendmail-program "msmtp" "Use msmtp in order to send emails")
+ (send-mail-function 'smtpmail-send-it "This is required for this to work")
+ (message-sendmail-f-is-evil t "Use evil-mode for sendmail")
+ (message-sendmail-extra-arguments '("--read-envelope-from") "idk what this does")
+ (message-send-mail-function 'message-send-mail-with-sendmail "Use sendmail"))
(use-package mu4e
:after smtpmail
- :init
- (setq mu4e-drafts-folder "/Drafts")
- (setq mu4e-sent-folder "/Sent")
- (setq mu4e-trash-folder "/Trash")
- (setq mu4e-attachment-dir "~/Downloads")
- (setq mu4e-view-show-addresses 't)
- (setq mu4e-confirm-quit nil)
-
-
- (setq message-kill-buffer-on-exit t)
- (setq mu4e-compose-dont-reply-to-self t)
- (setq mu4e-change-filenames-when-moving t)
- (setq mu4e-get-mail-command "mbsync ret2pop")
- (setq mu4e-compose-reply-ignore-address (list "no-?reply" system-email))
- (setq mu4e-html2text-command "w3m -T text/html" ; how to hanfle html-formatted emails
- mu4e-update-interval 300 ; seconds between each mail retrieval
- mu4e-headers-auto-update t ; avoid to type `g' to update
- mu4e-view-show-images t ; show images in the view buffer
- mu4e-compose-signature-auto-include nil ; I don't want a message signature
- mu4e-use-fancy-chars t))
-
-(use-package ivy-pass)
+ :custom
+ (mu4e-drafts-folder "/Drafts" "Set drafts folder mu db")
+ (mu4e-sent-folder "/Sent" "Set sent folder in mu db")
+ (mu4e-trash-folder "/Trash" "Set trash folder in mu db")
+ (mu4e-attachment-dir "~/Downloads" "Set downloads folder for attachments")
+ (mu4e-view-show-addresses 't "Show email addresses in main view")
+ (mu4e-confirm-quit nil "Don't ask to quit")
+ (message-kill-buffer-on-exit t "Kill buffer when I exit mu4e")
+ (mu4e-compose-dont-reply-to-self t "Don't include self in replies")
+ (mu4e-change-filenames-when-moving t)
+ (mu4e-get-mail-command "mbsync ret2pop" "Use mbsync for imap")
+ (mu4e-compose-reply-ignore-address (list "no-?reply" system-email) "ignore my own address and noreply")
+ (mu4e-html2text-command "w3m -T text/html" "Use w3m to convert html to text")
+ (mu4e-update-interval 300 "Update duration")
+ (mu4e-headers-auto-update t "Auto-updates feed")
+ (mu4e-view-show-images t "Shows images")
+ (mu4e-compose-signature-auto-include nil)
+ (mu4e-use-fancy-chars t "Random option to make mu4e look nicer"))
(use-package emms
+ :custom
+ (emms-source-file-default-directory (expand-file-name "~/music/") "Use directory specified in Nix")
+ (emms-player-mpd-music-directory (expand-file-name "~/music/") "Use directory specified in Nix")
+ (emms-player-mpd-server-name "localhost" "Connect to localhost")
+ (emms-player-mpd-server-port "6600" "Connect to port 6600")
+ (emms-player-list '(emms-player-mpd) "Use mpd")
:init
(emms-all)
- (setq emms-source-file-default-directory (expand-file-name "~/music/"))
- (setq emms-player-mpd-music-directory (expand-file-name "~/music/"))
- (setq emms-player-mpd-server-name "localhost")
- (setq emms-player-mpd-server-port "6600")
- (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))
+ :config (emms-player-mpd-connect))
(setq system-fullname "Preston Pan")
#+end_src
** 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)
+These are all the options that need to be set at the start of the program. Because use-package
+is largely declarative, the order of many of these options should not matter. However, there
+is some imperative programming that must be done. Hooks are also largely declarative in this
+configuration as they are also defined using the use-package macros. Some of these options will
+have documentation strings attached, so it is easy to follow what the individual options do.
+Emacs is self documenting, after all!
+#+begin_src emacs-lisp
+ (use-package emacs
+ :custom
+ ;; Startup errors
+ (warning-minimum-level :emergency "Supress emacs warnings")
+ (debug-ignored-errors (cons 'remote-file-error debug-ignored-errors) "Remove annoying error from debug errors")
- :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)
+ ;; Mouse wheel
+ (mouse-wheel-scroll-amount '(1 ((shift) . 1)) "Nicer scrolling")
+ (mouse-wheel-progressive-speed nil "Make scrolling non laggy")
+ (mouse-wheel-follow-mouse 't "Scroll correct window")
+ (scroll-conservatively 101 "Sort of smooth scrolling")
+ (scroll-step 1 "Scroll one line at a time")
+ (display-time-24hr-format t "Use 24 hour format to read the time")
+ (display-line-numbers-type 'relative "Relative line numbers for easy vim jumping")
+ (use-short-answers t "Use y instead of yes")
+ (make-backup-files nil "Don't make backups")
+ (display-fill-column-indicator-column 100 "Draw a line at 100 characters")
+ (line-spacing 2 "Default line spacing")
- (org-mode . (lambda ()
+ ;; Editor comments
+ (c-doc-comment-style '((c-mode . doxygen)
+ (c++-mode . doxygen)))
+ :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 . display-line-numbers-mode)
+ (org-mode . (lambda ()
(setq prettify-symbols-alist
'(("#+begin_src" . ?)
("#+BEGIN_SRC" . ?)
("||" . ?∨)
("sqrt" . ?√)
("..." . ?…)))
- (prettify-symbols-mode)))
- (prog-mode .
+ (prettify-symbols-mode)))
+ (prog-mode .
(lambda ()
(setq prettify-symbols-alist
'(("lambda" . ?λ)
("||" . ?∨)
("sqrt" . ?√)
("..." . ?…)))
- (prettify-symbols-mode)))))
-#+end_src
+ (prettify-symbols-mode))))
+ :config
+ (require 'tex-site)
+ (server-start)
+
+ ;; start wiith sane defaults
+ (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)
+
+ ;; load theme, fonts, and transparency. Prettify symbols.
+ (global-prettify-symbols-mode 1)
+ (load-theme 'catppuccin :no-confirm)
+ (set-face-attribute 'default nil :font "Iosevka Nerd Font" :height 130)
+ (set-frame-parameter nil 'alpha-background 90)
+ (add-to-list 'default-frame-alist '(alpha-background . 90)))
+#+end_src
+As you can see, the config (and sometimes the init section) of most of these use-package blocks
+contain most of the imperative commands. In fact, most of the configurations are completely
+declarative without any imperative programming at all (i.e. hooks and custom options). Note
+that Emacs lambdas contain imperative state, unlike in [[file:nix.org][NixOS]] where lambdas can contain function
+applications but they themselves are mainly declarative. Usually, however, the lambdas or
+functions do little to nothing and are mainly wrappers for executing two commands or for giving
+a variable an option. Often you will see a config section of a use-package declaration have
+only one or two entries, which is intentional, as I've designed this configuration to put as
+little in config as possible. I hardly consider most of this configuration to be imperative, but
+of course Emacs was not designed to be fully imperative.
** Org Mode
+This is my org mode configuration, which also configures latex.
#+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 "~/monorepo/agenda.org"
- "~/org/notes.org"
- "~/org/agenda.org"))
- (setq org-default-notes-file (concat org-directory "/notes.org"))
- (setq org-publish-project-alist
+ :custom
+ (org-confirm-babel-evaluate nil "Don't ask to evaluate code block")
+ (org-export-with-broken-links t "publish website even with broken links")
+ (org-src-fontify-natively t "Colors!")
+ (org-latex-preview-image-directory (expand-file-name "~/.cache/ltximg/") "don't use weird cache location")
+ (org-preview-latex-image-directory (expand-file-name "~/.cache/ltximg/") "don't use weird cache location")
+ (TeX-PDF-mode t)
+ (org-latex-pdf-process '("xelatex -interaction=nonstopmode -output-directory=%o %f") "set xelatex as default")
+ (TeX-engine 'xetex "set xelatex as default engine")
+ (preview-default-option-list '("displaymath" "textmath" "graphics") "preview latex")
+ (preview-image-type 'png "Use PNGs")
+ (org-format-latex-options (plist-put org-format-latex-options :scale 1.5) "space latex better")
+ (org-return-follows-link t "be able to follow links without mouse")
+ (org-habit-preceding-days 1 "See org habit entries")
+ (org-startup-indented t "Indent the headings")
+ (org-image-actual-width '(300) "Cap width")
+ (org-startup-with-latex-preview t "see latex previews on opening file")
+ (org-startup-with-inline-images t "See images on opening file")
+ (org-hide-emphasis-markers t "prettify org mode")
+ (org-use-sub-superscripts "{}" "Only display superscripts and subscripts when enclosed in {}")
+ (org-pretty-entities t "prettify org mode")
+ (org-agenda-files (list "~/monorepo/agenda.org" "~/org/notes.org" "~/org/agenda.org") "set default org files")
+ (org-default-notes-file (concat org-directory "/notes.org") "Notes file")
+ (org-publish-project-alist
'(("website-org"
:base-directory "~/monorepo"
:base-extension "org"
: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")
+ ("website" :auto-sitemap t :components ("website-org" "website-static"))) "functions to publish website")
+ (org-html-postamble "Copyright © 2024 Preston Pan" "set copyright notice on bottom of site")
:config
(require 'ox-publish)
(require 'org-tempo)
(python . t)
(latex . t))))
#+end_src
+As you can see, I only have one real entry in config here (I don't count requires even though
+they have to be on the top)
* Unicode
+I want emacs to have unicode fonts.
#+begin_src emacs-lisp
(use-package unicode-fonts
:init (unicode-fonts-setup))
what electric-pair does based on the mode.
#+begin_src emacs-lisp
(use-package electric-pair
- :hook ((org-mode . electric-pair-mode)
- (prog-mode . electric-pair-mode)))
+ :hook ((prog-mode . electric-pair-mode)))
#+end_src
* Lyrics
+This currently doesn't work I'm pretty sure, but it's supposed to fetch lyrics from mpd.
#+begin_src emacs-lisp
(use-package lyrics-fetcher
:after (emms)
+ :custom
+ (lyrics-fetcher-genius-access-token (password-store-get "genius_api") "Use genius for backend")
:config
- (setq lyrics-fetcher-genius-access-token
- (password-store-get "genius_api"))
(lyrics-fetcher-use-backend 'genius))
#+end_src
* Fragtog
+This package is used to generate previews automatically when your cursor hovers over a latex
+snippet.
#+begin_src emacs-lisp
(use-package org-fragtog :hook (org-mode . org-fragtog-mode))
#+end_src
* Snippets
+Yasnippets are useful for macros that automatically complete to an arbitrary form.
#+begin_src emacs-lisp
(use-package yasnippet
:config
#+begin_src emacs-lisp
(use-package company
:config
- '(add-to-list 'company-backends
- '(company-ispell company-capf company-irony
- company-yasnippet company-files))
+ '(add-to-list 'company-backends '(company-ispell company-capf company-yasnippet company-files))
:hook ((after-init . global-company-mode)))
#+end_src
* Spelling
+This loads a dictionary so that I can save certain words to be not misspelled and also have
+this spellcheck during org mode.
#+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"))
+ :custom
+ (ispell-program-name "aspell" "use aspell")
+ (ispell-silently-savep t "Save changes to dict without confirmation")
+ (ispell-dictionary "en" "Use english dictionary")
+ (ispell-alternate-dictionary "~/.local/share/dict" "dict location"))
(use-package flyspell
:hook (text-mode . flyspell-mode))
First, some small configurations and some evil-mode initilaization because I like vim keybindings:
#+begin_src emacs-lisp
(use-package evil
- :init
- (setq evil-want-keybinding nil)
+ :custom
+ (evil-want-keybinding nil "Don't load a whole bunch of default keybindings")
:config
(evil-mode 1)
- (evil-set-undo-system 'undo-redo))
+ (evil-set-undo-system 'undo-redo)
+ (evil-set-initial-state 'pdf-view-mode 'normal))
(use-package evil-collection
:after (evil)
- :init
- (setq evil-want-keybinding nil)
:config
+ (with-eval-after-load 'evil-maps
+ (define-key evil-motion-state-map (kbd "SPC") nil)
+ (define-key evil-motion-state-map (kbd "RET") nil)
+ (define-key evil-motion-state-map (kbd "TAB") nil))
(evil-collection-init))
- (with-eval-after-load 'evil-maps
- (define-key evil-motion-state-map (kbd "SPC") nil)
- (define-key evil-motion-state-map (kbd "RET") nil)
- (define-key evil-motion-state-map (kbd "TAB") nil))
+
(use-package evil-commentary
:after (evil)
(evil-commentary-mode))
(use-package evil-org
- :after (evil org)
+ :after (evil org)
:hook (org-mode . (lambda () evil-org-mode))
:config
(require 'evil-org-agenda)
(use-package page-break-lines
:init
(page-break-lines-mode))
- (evil-set-initial-state 'pdf-view-mode 'normal)
#+end_src
** Journal
I use org-journal to journal about my life, and it's a part of my website:
#+begin_src emacs-lisp
(use-package org-journal
:after (org)
+ :custom
+ (org-journal-dir "~/monorepo/journal/" "Set journal directory")
+ (org-journal-date-format "%A, %d %B %Y" "Date format")
+ (org-journal-file-format "%Y%m%d.org" "Automatic file creation format based on date")
+ (org-journal-enable-agenda-integration t "All org-journal entries are org-agenda entries")
:init
- (setq org-journal-dir "~/monorepo/journal/")
- (setq org-journal-date-format "%A, %d %B %Y")
-
- (defun org-journal-file-header-func (time)
+ (defun org-journal-file-header-func (time)
"Custom function to create journal header."
(concat
- (pcase org-journal-file-type
- (`daily "#+TITLE: Daily Journal\n#+STARTUP: showeverything\n#+DESCRIPTION: My daily journal entry\n#+AUTHOR: Preston Pan\n#+HTML_HEAD: <link rel=\"stylesheet\" type=\"text/css\" href=\"../style.css\" />\n#+html_head: <script src=\"https://polyfill.io/v3/polyfill.min.js?features=es6\"></script>\n#+html_head: <script id=\"MathJax-script\" async src=\"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js\"></script>\n#+options: broken-links:t")
- (`weekly "#+TITLE: Weekly Journal\n#+STARTUP: folded")
- (`monthly "#+TITLE: Monthly Journal\n#+STARTUP: folded")
- (`yearly "#+TITLE: Yearly Journal\n#+STARTUP: folded"))))
-
- (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))
+ (pcase org-journal-file-type
+ (`daily "#+TITLE: Daily Journal\n#+STARTUP: showeverything\n#+DESCRIPTION: My daily journal entry\n#+AUTHOR: Preston Pan\n#+HTML_HEAD: <link rel=\"stylesheet\" type=\"text/css\" href=\"../style.css\" />\n#+html_head: <script src=\"https://polyfill.io/v3/polyfill.min.js?features=es6\"></script>\n#+html_head: <script id=\"MathJax-script\" async src=\"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js\"></script>\n#+options: broken-links:t")
+ (`weekly "#+TITLE: Weekly Journal\n#+STARTUP: folded")
+ (`monthly "#+TITLE: Monthly Journal\n#+STARTUP: folded")
+ (`yearly "#+TITLE: Yearly Journal\n#+STARTUP: folded"))))
+ (setq org-journal-file-header 'org-journal-file-header-func))
#+end_src
** Doom Modeline
-The default modeline is ugly.
+The default modeline is ugly. I replace it with the doom modeline because it's better.
#+begin_src emacs-lisp
(use-package doom-modeline
:config
(doom-modeline-mode 1))
#+end_src
** Grammar
-I want to write good!
+I want to write good! I grammar good too.
#+begin_src emacs-lisp
(use-package writegood-mode
:hook (text-mode . writegood-mode))
We set up eglot, the LSP manager for emacs, now built in:
#+begin_src emacs-lisp
(use-package eglot
- :config
- (add-to-list 'eglot-server-programs '(nix-mode . ("nil")))
:hook
(prog-mode . eglot-ensure)
- (nix-mode . eglot-ensure))
+ (nix-mode . eglot-ensure)
+ :config
+ (add-to-list 'eglot-server-programs '(nix-mode . ("nil"))))
+
(use-package lsp
:hook
(prog-mode . lsp))
+
+ (use-package flycheck
+ :config (global-flycheck-mode))
+
(use-package platformio-mode
:hook (prog-mode . platformio-conditionally-enable))
#+end_src
*** C/C++
+Specific configuration for C (I also use the clangd lsp):
#+begin_src emacs-lisp
(use-package irony-mode
:hook (
(use-package solidity-mode)
(use-package company-solidity)
(use-package solidity-flycheck
- :init
- (setq solidity-flycheck-solc-checker-active t))
-
- (use-package flycheck
- :config (global-flycheck-mode))
+ :custom
+ (solidity-flycheck-solc-checker-active t))
#+end_src
** Projectile
Manages projects and shit.
#+begin_src emacs-lisp
(use-package projectile
- :init
- (setq projectile-project-search-path '("~/org" "~/src"))
+ :custom
+ (projectile-project-search-path '("~/org" "~/src" "~/monorepo" "~/projects") "search path for projects")
:config
(projectile-mode +1))
#+end_src
#+begin_src emacs-lisp
(use-package dashboard
:after (projectile)
- :init
- (setq dashboard-banner-logo-title "Welcome, Commander!")
- (setq dashboard-icon-type 'nerd-icons)
- (setq dashboard-vertically-center-content t)
- (setq dashboard-set-init-info t)
- (setq dashboard-week-agenda t)
- (setq dashboard-items '((recents . 5)
- (bookmarks . 5)
- (projects . 5)
- (agenda . 5)
- (registers . 5)))
+ :custom
+ (dashboard-banner-logo-title "Welcome, Commander!" "Set title for dashboard")
+ (dashboard-icon-type 'nerd-icons "Use nerd icons")
+ (dashboard-vertically-center-content t "Center content")
+ (dashboard-set-init-info t)
+ (dashboard-week-agenda t "Agenda in dashboard")
+ (dashboard-items '((recents . 5)
+ (bookmarks . 5)
+ (projects . 5)
+ (agenda . 5)
+ (registers . 5)) "Look at some items")
:config
(dashboard-setup-startup-hook))
#+end_src
#+begin_src emacs-lisp
(use-package counsel)
(use-package ivy
- :init
- (setq ivy-use-virtual-buffers t)
- (setq enable-recursive-minibuffers t)
+ :custom
+ (ivy-use-virtual-buffers t "Make searching more efficient")
+ (enable-recursive-minibuffers t "Don't get soft locked when in a minibuffer")
: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)
(ivy-mode))
(define-key ivy-minibuffer-map (kbd "C-j") 'ivy-immediate-done)
#+end_src
+I use it for an M-x replacement and a dired replacement, among other things.
** Magit
+I use magit in order to do all my git management in emacs.
#+begin_src emacs-lisp
(use-package magit)
#+end_src
** IRC
+Configure IRC to use my username.
#+begin_src emacs-lisp
(use-package erc
- :init
- (setq
- erc-nick system-username
- erc-user-full-name system-fullname))
+ :custom
+ (erc-nick system-username "Set erc nick to username")
+ (erc-user-full-name system-fullname "Use real name for full name"))
#+end_src
** Keybindings
+Global keybindings for everything that I care about globally. It's all here! I use general
+to manage my global keybindings in a declarative way. These are in part inspired by the doom
+emacs keybindings.
#+begin_src emacs-lisp
(use-package general
:init
(interactive)
(ement-connect :uri-prefix "http://localhost:8009"))
:config
- (general-create-definer leader-key
- :prefix "SPC")
+ (general-create-definer leader-key :prefix "SPC")
(leader-key 'normal
"o a" '(org-agenda :wk "Open agenda")
"o c" '(org-capture :wk "Capture")
+ "n" '(:ignore t :wk "Org mode plugins")
"n j j" '(org-journal-new-entry :wk "Make new journal entry")
"n r f" '(org-roam-node-find :wk "Find roam node")
"n r i" '(org-roam-node-insert :wk "Insert roam node")
"n r g" '(org-roam-graph :wk "Graph roam database")
"r s s" '(elfeed :wk "rss feed")
"." '(counsel-find-file :wk "find file")
+ "g" '(:ignore t :wk "Magit")
"g /" '(magit-dispatch :wk "git commands")
"g P" '(magit-push :wk "git push")
"g c" '(magit-commit :wk "git commit")
"g p" '(magit-pull :wk "Pull from git")
"g s" '(magit-status :wk "Change status of files")
+ "o" '(:ignore t :wk "Open application")
"o t" '(vterm :wk "Terminal")
"o e" '(eshell :wk "Elisp Interpreter")
"o m" '(mu4e :wk "Email")
+
"e w w" '(eww :wk "web browser")
"e c c" '(ellama-chat :wk "Chat with Ollama")
"e a b" '(ellama-ask-about :wk "Ask Ollama")
"e c e" '(ellama-code-edit :wk "Edit code with Ollama")
"e w i" '(ellama-improve-wording :wk "Improve wording with Ollama")
"e g i" '(ellama-improve-grammar :wk "Improve grammar with Ollama")
+
+ "c" '(:ignore t :wk "Counsel commands")
+ "c g" '(counsel-git :wk "Search file in git project")
+ "c f" '(counsel-git-grep :wk "Find string in git project")
+
"g s" '(gptel-send :wk "Send to Ollama")
"g e" '(gptel :wk "Ollama interface")
- "p w" '(ivy-pass :wk "Password manager interface")
"m P p" '(org-publish :wk "Publish website components")
"s e" '(sudo-edit :wk "Edit file with sudo")
"m m" '(emms :wk "Music player")
"i p c" '(prestonpan :wk "Connect to my IRC server")
"i l c" '(liberachat :wk "Connect to libera chat server")
"i e c" '(efnet :wk "Connect to efnet chat server")
+ "h" '(:ignore t :wk "Documentation")
+ "h v" '(counsel-describe-variable :wk "Describe variable")
+ "h f" '(counsel-describe-function :wk "Describe function")
+ "h h" '(help :wk "Help")
"h m" '(woman :wk "Manual")
"h i" '(info :wk "Info")
"s m" '(proced :wk "System Manager")
competitive LLM that doesn't cost money.
#+begin_src emacs-lisp
(use-package ellama
+ :custom
+ (ellama-sessions-directory "~/org/ellama/" "Set org directory")
:init
- (setopt ellama-sessions-directory "~/org/ellama/")
(require 'llm-ollama)
- (with-eval-after-load 'llm-ollama)
(setopt ellama-provider (make-llm-ollama
- :host "localhost"
- :chat-model "gemma:7b")))
+ :host "localhost"
+ :chat-model "gemma:7b")))
#+end_src
** RSS Feed
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
- (setq elfeed-search-filter "@1-month-ago +unread"))
+ :custom
+ (elfeed-search-filter "@1-month-ago +unread" "Only display unread articles from a month ago")
+ :hook ((elfeed-search-mode . elfeed-update)))
(use-package elfeed-org
- :init
- (setq rmh-elfeed-org-files '("~/monorepo/config/elfeed.org"))
+ :custom
+ (rmh-elfeed-org-files '("~/monorepo/config/elfeed.org") "Use elfeed config in repo as default")
:config
(elfeed-org))
#+end_src
+*** Youtube
Then we set up elfeed-tube for Youtube video RSS feeds (so I don't ever have to use the web
interface and can control it from emacs):
#+begin_src emacs-lisp
:after elfeed
:demand t
:config
- ;; (setq elfeed-tube-auto-save-p nil) ; default value
- ;; (setq elfeed-tube-auto-fetch-p t) ; default value
(elfeed-tube-setup)
-
:bind (:map elfeed-show-mode-map
("F" . elfeed-tube-fetch)
([remap save-buffer] . elfeed-tube-save)
("M" . elfeed-tube-mpv)))
#+end_src
** Project Drawer
+I use treemacs as my sidebar for projects, so that I can easily navigate to any file in the
+project directory.
#+begin_src emacs-lisp
(use-package treemacs)
(use-package treemacs-evil
to Chromium if I have to:
#+begin_src emacs-lisp
(use-package eww
- :init
- (setq search-engines
+ :custom
+ (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")))
+ (("rfc-kw" "rk") "https://www.rfc-editor.org/search/rfc_search_detail.php?title=%s"))
+ "use this set of search engines")
- (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")
+ (search-engine-default "google" "Use google as default")
+ (eww-search-prefix "https://google.com/search?q=" "Google prefix")
+ (browse-url-secondary-browser-function 'browse-url-generic browse-url-generic-program "firefox" "Use firefox as secondary browser")
: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 "~/monorepo/mindmap"))
- (setq org-roam-capture-templates '(("d" "default" plain "%?"
- :target (file+head "${title}.org"
- "#+title: ${title}\n#+author: Preston Pan\n#+html_head: <link rel=\"stylesheet\" type=\"text/css\" href=\"../style.css\" />\n#+html_head: <script src=\"https://polyfill.io/v3/polyfill.min.js?features=es6\"></script>\n#+html_head: <script id=\"MathJax-script\" async src=\"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js\"></script>\n#+options: broken-links:t")
- :unnarrowed t)))
- :config
- (org-roam-db-autosync-mode))
+ (use-package org-roam
+ :after (org)
+ :custom
+ (org-roam-db-update-on-save t "Update org-roam db")
+ (org-roam-graph-viewer "firefox" "Use firefox to view org-roam graph")
+ (org-roam-directory (file-truename "~/monorepo/mindmap") "Set org-roam directory inside monorepo")
+ (org-roam-capture-templates '(("d" "default" plain "%?"
+ :target (file+head "${title}.org"
+ "#+title: ${title}\n#+author: Preston Pan\n#+html_head: <link rel=\"stylesheet\" type=\"text/css\" href=\"../style.css\" />\n#+html_head: <script src=\"https://polyfill.io/v3/polyfill.min.js?features=es6\"></script>\n#+html_head: <script id=\"MathJax-script\" async src=\"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js\"></script>\n#+options: broken-links:t")
+ :unnarrowed t)) "org-roam files start with this snippet by default")
+ :config
+ (org-roam-db-autosync-mode)
+ ;; Otherwise links are broken when publishing
+ (org-roam-update-org-id-locations))
(use-package org-roam-ui
- :after org-roam
- :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))
+ :after org-roam
+ :hook (after-init . org-roam-ui-mode)
+ :custom
+ (org-roam-ui-sync-theme t "Use emacs theme for org-roam-ui")
+ (org-roam-ui-follow t "Have cool visual while editing org-roam")
+ (org-roam-ui-update-on-save t "This option is obvious")
+ (org-roam-ui-open-on-start t "Have cool visual open in firefox when emacs loads"))
#+end_src
** Pinentry
Set up pinentry so that I can use emacs as my pinentry frontend:
#+begin_src emacs-lisp
(use-package pinentry
- :init (setq epa-pinentry-mode `loopback)
+ :custom (epa-pinentry-mode `loopback "Set this option to match gpg-agent.conf")
:config (pinentry-start))
#+end_src
-** LaTeX
-Make LaTeX a litle better:
-#+begin_src emacs-lisp
- ;; (use-package latex-preview-pane
- ;; :config
- ;; (latex-preview-pane-enable))
-#+end_src
** Email
Email in emacs can be done with Mu4e.
#+begin_src emacs-lisp
- ;; SMTP settings:
(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))
+ :custom
+ (user-mail-address system-email "Use our email")
+ (user-full-name system-fullname "Use our full name")
+ (sendmail-program "msmtp" "Use msmtp in order to send emails")
+ (send-mail-function 'smtpmail-send-it "This is required for this to work")
+ (message-sendmail-f-is-evil t "Use evil-mode for sendmail")
+ (message-sendmail-extra-arguments '("--read-envelope-from") "idk what this does")
+ (message-send-mail-function 'message-send-mail-with-sendmail "Use sendmail"))
(use-package mu4e
:after smtpmail
- :init
- (setq mu4e-drafts-folder "/Drafts")
- (setq mu4e-sent-folder "/Sent")
- (setq mu4e-trash-folder "/Trash")
- (setq mu4e-attachment-dir "~/Downloads")
- (setq mu4e-view-show-addresses 't)
- (setq mu4e-confirm-quit nil)
-
-
- (setq message-kill-buffer-on-exit t)
- (setq mu4e-compose-dont-reply-to-self t)
- (setq mu4e-change-filenames-when-moving t)
- (setq mu4e-get-mail-command "mbsync ret2pop")
- (setq mu4e-compose-reply-ignore-address (list "no-?reply" system-email))
- (setq mu4e-html2text-command "w3m -T text/html" ; how to hanfle html-formatted emails
- mu4e-update-interval 300 ; seconds between each mail retrieval
- mu4e-headers-auto-update t ; avoid to type `g' to update
- mu4e-view-show-images t ; show images in the view buffer
- mu4e-compose-signature-auto-include nil ; I don't want a message signature
- mu4e-use-fancy-chars t))
-#+end_src
-** Password Manager
-I use ~pass~ in order to manage my passwords on linux, and this is an ivy frontend for it:
-#+begin_src emacs-lisp
-(use-package ivy-pass)
+ :custom
+ (mu4e-drafts-folder "/Drafts" "Set drafts folder mu db")
+ (mu4e-sent-folder "/Sent" "Set sent folder in mu db")
+ (mu4e-trash-folder "/Trash" "Set trash folder in mu db")
+ (mu4e-attachment-dir "~/Downloads" "Set downloads folder for attachments")
+ (mu4e-view-show-addresses 't "Show email addresses in main view")
+ (mu4e-confirm-quit nil "Don't ask to quit")
+ (message-kill-buffer-on-exit t "Kill buffer when I exit mu4e")
+ (mu4e-compose-dont-reply-to-self t "Don't include self in replies")
+ (mu4e-change-filenames-when-moving t)
+ (mu4e-get-mail-command "mbsync ret2pop" "Use mbsync for imap")
+ (mu4e-compose-reply-ignore-address (list "no-?reply" system-email) "ignore my own address and noreply")
+ (mu4e-html2text-command "w3m -T text/html" "Use w3m to convert html to text")
+ (mu4e-update-interval 300 "Update duration")
+ (mu4e-headers-auto-update t "Auto-updates feed")
+ (mu4e-view-show-images t "Shows images")
+ (mu4e-compose-signature-auto-include nil)
+ (mu4e-use-fancy-chars t "Random option to make mu4e look nicer"))
#+end_src
** Music
Set up emms in order to play music from my music directory:
#+begin_src emacs-lisp
(use-package emms
+ :custom
+ (emms-source-file-default-directory (expand-file-name "~/music/") "Use directory specified in Nix")
+ (emms-player-mpd-music-directory (expand-file-name "~/music/") "Use directory specified in Nix")
+ (emms-player-mpd-server-name "localhost" "Connect to localhost")
+ (emms-player-mpd-server-port "6600" "Connect to port 6600")
+ (emms-player-list '(emms-player-mpd) "Use mpd")
:init
(emms-all)
- (setq emms-source-file-default-directory (expand-file-name "~/music/"))
- (setq emms-player-mpd-music-directory (expand-file-name "~/music/"))
- (setq emms-player-mpd-server-name "localhost")
- (setq emms-player-mpd-server-port "6600")
- (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))
+ :config (emms-player-mpd-connect))
#+end_src
I conditionally enable metamask based on the cryptocurrency option. Everything else here should
be straightforward.
#+begin_src nix :tangle ../nix/modules/home/firefox.nix
-{ lib, config, pkgs, ... }:
-{
- programs.firefox = {
- enable = true;
- policies = {
- EnableTrackingProtection = true;
- OfferToSaveLogins = false;
- };
- package = pkgs.firefox-wayland;
- profiles = {
- default = {
- id = 0;
- name = "default";
- isDefault = true;
-
- extensions = with pkgs.nur.repos.rycee.firefox-addons; [
- ublock-origin
- tree-style-tab
- firefox-color
- vimium
- ]
- ++ (lib.optional
- config.monorepo.profiles.crypto.enable pkgs.nur.repos.rycee.firefox-addons.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;
+ { lib, config, pkgs, ... }:
+ {
+ programs.firefox = {
+ enable = true;
+ policies = {
+ EnableTrackingProtection = true;
+ OfferToSaveLogins = false;
+ };
+ package = pkgs.firefox-wayland;
+ profiles = {
+ default = {
+ id = 0;
+ name = "default";
+ isDefault = true;
+
+ extensions = with pkgs.nur.repos.rycee.firefox-addons; [
+ ublock-origin
+ tree-style-tab
+ firefox-color
+ vimium
+ ]
+ ++ (lib.optional
+ config.monorepo.profiles.crypto.enable pkgs.nur.repos.rycee.firefox-addons.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;
+ };
};
- };
- network = {
- http = {
- max-connections = 1800;
- max-persistent-connections-per-server = 10;
- max-urgent-start-excessive-connections-per-host = 5;
- referer.XOriginTrimmingPolicy = 2;
+ gfx = {
+ content.skia-font-cache-size = 20;
+ canvas.accelerated = {
+ cache-items = 4096;
+ cache-size = 512;
+ };
};
- buffer.cache = {
- size = 262144;
- count = 128;
- };
+ network = {
+ http = {
+ max-connections = 1800;
+ max-persistent-connections-per-server = 10;
+ max-urgent-start-excessive-connections-per-host = 5;
+ referer.XOriginTrimmingPolicy = 2;
+ };
- dns = {
- max_high_priority_threads = 8;
- disablePrefetch = true;
- };
+ buffer.cache = {
+ size = 262144;
+ count = 128;
+ };
- 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;
- };
+ dns = {
+ max_high_priority_threads = 8;
+ disablePrefetch = true;
+ };
- browser = {
- download = {
- always_ask_before_handling_new_types = true;
- manager.addToRecentDocs = false;
- open_pdf_attachments_inline = true;
- start_downloads_in_tmp_dir = 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;
};
- urlbar = {
- suggest.quicksuggest.sponsored = false;
- suggest.quicksuggest.nonsponsored = false;
- suggest.calculator = true;
- update2.engineAliasRefresh = true;
- unitConversion.enabled = true;
- trending.featureGate = false;
- };
+ browser = {
+ download = {
+ always_ask_before_handling_new_types = true;
+ manager.addToRecentDocs = false;
+ open_pdf_attachments_inline = true;
+ start_downloads_in_tmp_dir = true;
+ };
- search = {
- separatePrivateDefault.ui.enabled = true;
- suggest.enabled = false;
- };
+ urlbar = {
+ suggest.quicksuggest.sponsored = false;
+ suggest.quicksuggest.nonsponsored = false;
+ suggest.calculator = true;
+ update2.engineAliasRefresh = true;
+ unitConversion.enabled = true;
+ trending.featureGate = false;
+ };
- newtabpage.activity-stream = {
- feeds = {
- topsites = false;
- section.topstories = 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;
};
- asrouter.userprefs.cfr = {
- addons = false;
- features = false;
+
+ privatebrowsing = {
+ vpnpromourl = "";
+ forceMediaMemoryCache = true;
};
- telemetry = false;
- };
- privatebrowsing = {
- vpnpromourl = "";
- forceMediaMemoryCache = true;
- };
+ display = {
+ focus_ring_on_anything = true;
+ focus_ring_style = 0;
+ focus_ring_width = 0;
+ };
- 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;
};
- 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;
+ 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;
};
- 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 = "";
+ 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;
};
- legacyUserProfileCustomizations.stylesheets = true;
- };
- dom = {
- security = {
- https_first = true;
- https_first_schemeless = true;
- sanitizer.enabled = true;
+ dom = {
+ security = {
+ https_first = true;
+ https_first_schemeless = true;
+ sanitizer.enabled = true;
+ };
+ enable_web_task_scheduling = true;
};
- enable_web_task_scheduling = true;
- };
- layout = {
- css = {
- grid-template-masonry-value.enabled = true;
- has-selector.enabled = true;
- prefers-color-scheme.content-override = 2;
+ 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;
};
- 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";
- };
+ 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;
- };
+ privacy = {
+ globalprivacycontrol.enabled = true;
+ history.custom = true;
+ userContext.ui.enabled = true;
+ trackingprotection = {
+ enabled = true;
+ pbmode.enabled = true;
+ socialtracking.enabled = true;
+ };
+ };
- full-screen-api = {
- transition-duration = {
- enter = "0 0";
- leave = "0 0";
+ full-screen-api = {
+ transition-duration = {
+ enter = "0 0";
+ leave = "0 0";
+ };
+ warning = {
+ delay = -1;
+ timeout = 0;
+ };
};
- warning = {
- delay = -1;
- timeout = 0;
+
+ permissions.default = {
+ desktop-notification = 2;
+ geo = 2;
};
- };
- permissions.default = {
- desktop-notification = 2;
- geo = 2;
- };
+ signon = {
+ formlessCapture.enabled = false;
+ privateBrowsingCapture.enabled = false;
+ };
- signon = {
- formlessCapture.enabled = false;
- privateBrowsingCapture.enabled = false;
- };
+ datareporting = {
+ policy.dataSubmissionEnabled = false;
+ healthreport.uploadEnabled = false;
+ };
- datareporting = {
- policy.dataSubmissionEnabled = false;
- healthreport.uploadEnabled = false;
- };
+ extensions = {
+ pocket.enabled = false;
+ getAddons.showPane = false;
+ htmlaboutaddons.recommendations.enabled = false;
+ postDownloadThirdPartyPrompt = 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 = "";
+ };
- 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;
};
-
- 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;
};
};
};
- };
-}
+ }
#+end_src
*** Fcitx
This is a virtual keyboard program for writing in multiple languages. I use this sometimes.
configuration here that tells emacs to load my real configuration at ~~/monorepo/config/emacs.org~
as an org file which gets automatically tangled to an emacs-lisp file.
#+begin_src nix :tangle ../nix/modules/home/emacs.nix
-{ lib, config, pkgs, ... }:
-{
- programs.emacs =
- {
- enable = true;
- package = pkgs.emacs29-pgtk;
- extraConfig = ''
- (setq debug-on-error t)
- (org-babel-load-file
- (expand-file-name "~/monorepo/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
- ];
- };
-}
+ { lib, config, pkgs, ... }:
+ {
+ programs.emacs =
+ {
+ enable = true;
+ package = pkgs.emacs29-pgtk;
+ extraConfig = ''
+ (setq debug-on-error t)
+ (org-babel-load-file
+ (expand-file-name "~/monorepo/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.kiwix
+ 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
+ ];
+ };
+ }
#+end_src
*** Gammastep
This is a program like redshift for making your screen emit more red and less blue light. Here
generally useful packages and something every home should have, as well as some dependencies
for these configurations.
#+begin_src nix :tangle ../nix/modules/home/user.nix
-{ lib, config, pkgs, ... }:
-{
- home = {
- activation.startup-files = lib.hm.dag.entryAfter [ "installPackages" ] ''
- if [ ! -d "/home/${config.monorepo.vars.userName}/email/ret2pop/" ]; then
- mkdir -p /home/${config.monorepo.vars.userName}/email/ret2pop/
- fi
- if [ ! -d "/home/${config.monorepo.vars.userName}/music" ]; then
- mkdir -p /home/${config.monorepo.vars.userName}/music
- fi
- if [ ! -d /home/${config.monorepo.vars.userName}/org ]; then
- mkdir -p /home/${config.monorepo.vars.userName}/org
- fi
- touch /home/${config.monorepo.vars.userName}/org/agenda.org
- touch /home/${config.monorepo.vars.userName}/org/notes.org
- '';
-
- enableNixpkgsReleaseCheck = false;
- username = config.monorepo.vars.userName;
- homeDirectory = "/home/${config.monorepo.vars.userName}";
- stateVersion = "24.11";
-
- packages = with pkgs; [
- # passwords
- age sops
-
- # formatting
- ghostscript texliveFull pandoc
-
- # Emacs Deps
- graphviz jq
-
- # Apps
- octaveFull vesktop grim swww vim
+ { lib, config, pkgs, ... }:
+ {
+ home = {
+ activation.startup-files = lib.hm.dag.entryAfter [ "installPackages" ] ''
+ if [ ! -d "/home/${config.monorepo.vars.userName}/email/ret2pop/" ]; then
+ mkdir -p /home/${config.monorepo.vars.userName}/email/ret2pop/
+ fi
+ if [ ! -d "/home/${config.monorepo.vars.userName}/music" ]; then
+ mkdir -p /home/${config.monorepo.vars.userName}/music
+ fi
+ if [ ! -d /home/${config.monorepo.vars.userName}/org ]; then
+ mkdir -p /home/${config.monorepo.vars.userName}/org
+ fi
+ touch /home/${config.monorepo.vars.userName}/org/agenda.org
+ touch /home/${config.monorepo.vars.userName}/org/notes.org
+ '';
- # Sound/media
- pavucontrol alsa-utils imagemagick ffmpeg helvum
+ enableNixpkgsReleaseCheck = false;
+ username = config.monorepo.vars.userName;
+ homeDirectory = "/home/${config.monorepo.vars.userName}";
+ stateVersion = "24.11";
- # Net
- curl rsync git
+ packages = with pkgs; [
+ # wikipedia
+ kiwix kiwix-tools
+ # passwords
+ age sops
+
+ # formatting
+ ghostscript texliveFull pandoc
+
+ # Emacs Deps
+ graphviz jq
+
+ # Apps
+ octaveFull vesktop grim swww vim
+
+ # Sound/media
+ pavucontrol alsa-utils imagemagick ffmpeg helvum
+
+ # Net
+ curl rsync git
+
+ # Tor
+ torsocks tor-browser
+
+ # fonts
+ noto-fonts
+ noto-fonts-cjk-sans
+ noto-fonts-emoji
+ fira-code
+ font-awesome_6
+ (aspellWithDicts
+ (dicts: with dicts; [ en en-computers en-science ]))
+ (nerdfonts.override { fonts = [ "Iosevka" ]; })
+
+ # Misc.
+ pinentry
+ x11_ssh_askpass
+ xdg-utils
+ acpilight
+ pfetch
+ libnotify
+ ];
+ };
- # Tor
- torsocks tor-browser
+ services = {
+ gpg-agent = {
+ pinentryPackage = pkgs.pinentry-emacs;
+ enable = true;
+ extraConfig = ''
+ allow-emacs-pinentry
+ allow-loopback-pinentry
+ '';
+ };
+ };
- # fonts
- noto-fonts
- noto-fonts-cjk-sans
- noto-fonts-emoji
- fira-code
- font-awesome_6
- (aspellWithDicts
- (dicts: with dicts; [ en en-computers en-science ]))
- (nerdfonts.override { fonts = [ "Iosevka" ]; })
+ programs.bash.enable = true;
- # Misc.
- pinentry
- x11_ssh_askpass
- xdg-utils
- acpilight
- pfetch
- libnotify
- ];
- };
-
- services = {
- gpg-agent = {
- pinentryPackage = pkgs.pinentry-emacs;
+ gtk = {
enable = true;
- extraConfig = ''
- allow-emacs-pinentry
- allow-loopback-pinentry
- '';
+ theme = null;
+ iconTheme = null;
};
- };
-
- programs.bash.enable = true;
-
- gtk = {
- enable = true;
- theme = null;
- iconTheme = null;
- };
- fonts.fontconfig.enable = true;
- nixpkgs.config.cudaSupport = lib.mkDefault config.monorepo.profiles.cuda.enable;
-}
+ fonts.fontconfig.enable = true;
+ nixpkgs.config.cudaSupport = lib.mkDefault config.monorepo.profiles.cuda.enable;
+ }
#+end_src
* Systems
** Continuity
*** ISO Default Profile
This contains the installation script I use to install my systems.
#+begin_src nix :tangle ../nix/systems/installer/default.nix
-{ pkgs, config, ... }:
-let
- commits = import ./commits.nix;
-in
-{
- networking = {
- hostName = "nixos";
- networkmanager = {
- enable = true;
- };
- firewall = {
- allowedTCPPorts = [ ];
- allowedUDPPorts = [ ];
+ { pkgs, config, ... }:
+ let
+ commits = import ./commits.nix;
+ in
+ {
+ networking = {
+ hostName = "nixos";
+ networkmanager = {
+ enable = true;
+ };
+ firewall = {
+ allowedTCPPorts = [ ];
+ allowedUDPPorts = [ ];
+ };
+ wireless.enable = false;
};
- wireless.enable = false;
- };
- users.extraUsers.root.password = "nixos";
- users.extraUsers.nixos.password = "nixos";
- users.users = {
- nixos = {
- 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
-cd
-if [ ! -d "$HOME/monorepo/" ]; then
- git clone --recurse-submodules https://git.nullring.xyz/monorepo.git
- cd monorepo
- git checkout "${commits.monorepoCommitHash}"
-fi
-vim "$HOME/monorepo/nix/systems/continuity/default.nix"
-sudo nix --experimental-features "nix-command flakes" run "github:nix-community/disko/${commits.diskoCommitHash}" -- --mode destroy,format,mount "$HOME/monorepo/nix/modules/sda-simple.nix"
-cd /mnt
-sudo nixos-install --flake $HOME/monorepo/nix#continuity
-sudo cp -r $HOME/monorepo "/mnt/home/$(ls /mnt/home/)/"
-echo "rebooting..."; sleep 3; reboot
-'')
- ];
+ users.extraUsers.root.password = "nixos";
+ users.extraUsers.nixos.password = "nixos";
+ users.users = {
+ nixos = {
+ 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
+ cd
+ if [ ! -d "$HOME/monorepo/" ]; then
+ git clone --recurse-submodules https://git.nullring.xyz/monorepo.git
+ cd monorepo
+ git checkout "${commits.monorepoCommitHash}"
+ fi
+ vim "$HOME/monorepo/nix/systems/continuity/default.nix"
+ sudo nix --experimental-features "nix-command flakes" run "github:nix-community/disko/${commits.diskoCommitHash}" -- --mode destroy,format,mount "$HOME/monorepo/nix/modules/sda-simple.nix"
+ cd /mnt
+ sudo nixos-install --flake $HOME/monorepo/nix#continuity
+ sudo cp -r $HOME/monorepo "/mnt/home/$(ls /mnt/home/)/"
+ echo "rebooting..."; sleep 3; reboot
+ '')
+ ];
+ };
};
- };
- systemd = {
- services.sshd.wantedBy = pkgs.lib.mkForce [ "multi-user.target" ];
- targets = {
- sleep.enable = false;
- suspend.enable = false;
- hibernate.enable = false;
- hybrid-sleep.enable = false;
+ systemd = {
+ services.sshd.wantedBy = pkgs.lib.mkForce [ "multi-user.target" ];
+ targets = {
+ sleep.enable = false;
+ suspend.enable = false;
+ hibernate.enable = false;
+ hybrid-sleep.enable = false;
+ };
};
- };
-}
+ }
#+end_src
--- /dev/null
+#+TITLE: Daily Journal
+#+STARTUP: showeverything
+#+DESCRIPTION: My daily journal entry
+#+AUTHOR: Preston Pan
+#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../style.css" />
+#+html_head: <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
+#+html_head: <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
+#+options: broken-links:t
+* Thursday, 16 January 2025
+** 19:18
+Today, I finished my monorepo merge, and I'm now onto other tasks. I may try to integrate my
+other configurations into the monorepo, but for now I will work on some programming not for my
+system.
--- /dev/null
+#+TITLE: Daily Journal
+#+STARTUP: showeverything
+#+DESCRIPTION: My daily journal entry
+#+AUTHOR: Preston Pan
+#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../style.css" />
+#+html_head: <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
+#+html_head: <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
+#+options: broken-links:t
+* Sunday, 19 January 2025
+** 11:49
+Right now I'm in Victoria, trying to figure out what to do. Of course
+I want to work on my projects, but I might work on some mathematics as
+well. I'm not really sure.
--- /dev/null
+#+TITLE: Daily Journal
+#+STARTUP: showeverything
+#+DESCRIPTION: My daily journal entry
+#+AUTHOR: Preston Pan
+#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../style.css" />
+#+html_head: <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
+#+html_head: <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
+#+options: broken-links:t
+* Thursday, 23 January 2025
+** 17:09
+I'm heading home from Victoria to Vancouver at this current moment. I
+got sick in Victoria, so unfortunately I didn't have the best
+time. Though, I did get to meet a couple of really cool people and
+have a lot of great talks.
--- /dev/null
+:PROPERTIES:
+:ID: 2193dd78-50c4-4119-832a-e04c707687df
+:END:
+#+title: interpreter
+#+author: Preston Pan
+#+html_head: <link rel="stylesheet" type="text/css" href="../style.css" />
+#+html_head: <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
+#+html_head: <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
+#+options: broken-links:t
+* Introduction
+An interpreter in programming is a computer program that runs another
+computer program. A formal definition of these concepts are required
+in order to make sense of it.
a "base case" -- zero. As soon as the "base case" occurs, we then "go back up" by replacing all the unknown
values with known ones -- and that's how we evaluate recursive functions.
-* Programming Describe Recursion
-In stem, a factorial implementation might look like this:
-#+begin_src stem :exports both
-factorial [ dup 0 <= [ 1 + ] [ dup 1 - factorial * ] if ] def
-5 factorial .
-#+end_src
-
-#+RESULTS:
-: 120
-and in stem, we can print out the [[id:52d255d2-114c-42f4-b362-f0b4a2f7b83d][stack]] every step of the way with the builtin word ~?~:
-#+begin_src stem :exports both
-factorial-debug [ dup 0 <= [ 1 + ] [ ? "\n" . dup 1 - factorial-debug ? "\n" . * ] if ] def
-5 factorial-debug .
-#+end_src
-
-#+RESULTS:
-#+begin_example
-5
-
-5
-4
-
-5
-4
-3
-
-5
-4
-3
-2
-
-5
-4
-3
-2
-1
-
-5
-4
-3
-2
-1
-1
-
-5
-4
-3
-2
-1
-
-5
-4
-3
-2
-
-5
-4
-6
-
-5
-24
-
-120
-#+end_example
-as you can see, the stack is slowly built up to have all of the numbers needed, and then when we reach the basecase (the base case being the condition
-that doesn't cause recursion in the if statement), in which case we "go back up" by multiplying and going back up the stack. This procedure of using a stack
-is present in all programming languages, although in stem the operations are transparent as the stack is accessible by regular program users. In short, we keep
-on going down and down until we hit the bottom, base case, in which case we have all the pieces we need in order to go back up again, where the stack stores
-the information from most recent tasks to be done and we work back up in order to do the less recent tasks.
-
-This concept is important in programming because it allows one to build definitions in an intuitive way, simply by
-specifying the base case and specifying the case that is not the base case. Such an algorithm absolves oneself from having
-to design complicated patterns, as instead the entire computation emerges out of simple rules.
-
-In general, we see recursive definitions and design patterns in nature in the form of fractals.
+* Programming Describes Recursion
+In emacs-lisp, a factorial implementation may look like the following:
* Self Reference Problems
A big part of [[id:654280d8-82e8-4a0e-a914-bd32181c101b][infinite]] [[id:8f265f93-e5fd-4150-a845-a60ab7063164][recursion]] has to do with self reference problems. For instance, Russel's paradox with respect to
set theory: does a set that contains all sets that do not contain themselves contain itself?
]
},
"locked": {
- "lastModified": 1736437680,
- "narHash": "sha256-9Sy17XguKdEU9M5peTrkWSlI/O5IAqjHzdzxbXnc30g=",
+ "lastModified": 1737038063,
+ "narHash": "sha256-rMEuiK69MDhjz1JgbaeQ9mBDXMJ2/P8vmOYRbFndXsk=",
"owner": "nix-community",
"repo": "disko",
- "rev": "4d5d07d37ff773338e40a92088f45f4f88e509c8",
+ "rev": "bf0abfde48f469c256f2b0f481c6281ff04a5db2",
"type": "github"
},
"original": {
},
"nixpkgs": {
"locked": {
- "lastModified": 1736200483,
- "narHash": "sha256-JO+lFN2HsCwSLMUWXHeOad6QUxOuwe9UOAF/iSl1J4I=",
+ "lastModified": 1737885640,
+ "narHash": "sha256-GFzPxJzTd1rPIVD4IW+GwJlyGwBDV1Tj5FLYwDQQ9sM=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "3f0a8ac25fb674611b98089ca3a5dd6480175751",
+ "rev": "4e96537f163fad24ed9eb317798a79afc85b51b7",
"type": "github"
},
"original": {
},
"nixpkgs_2": {
"locked": {
- "lastModified": 1736344531,
- "narHash": "sha256-8YVQ9ZbSfuUk2bUf2KRj60NRraLPKPS0Q4QFTbc+c2c=",
+ "lastModified": 1737885589,
+ "narHash": "sha256-Zf0hSrtzaM1DEz8//+Xs51k/wdSajticVrATqDrfQjg=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "bffc22eb12172e6db3c5dde9e3e5628f8e3e7912",
+ "rev": "852ff1d9e153d8875a83602e03fdef8a63f0ecf8",
"type": "github"
},
"original": {
"treefmt-nix": "treefmt-nix"
},
"locked": {
- "lastModified": 1736483761,
- "narHash": "sha256-4ebVuPVQ1J2NxDDzDjSAeu44B8qv8163l2K63cFYpS4=",
+ "lastModified": 1738096417,
+ "narHash": "sha256-Ilaq4ZBWLKRQnnrVdo07RPXvL2bgLSpRRYQbEkTmY8E=",
"owner": "nix-community",
"repo": "NUR",
- "rev": "4f54273e0e23db6d8c65150de4b29bffa9b1b518",
+ "rev": "9749661663bff263eb630f3a7f200e8b5a6ce3da",
"type": "github"
},
"original": {
"nixpkgs": "nixpkgs_3"
},
"locked": {
- "lastModified": 1736203741,
- "narHash": "sha256-eSjkBwBdQk+TZWFlLbclF2rAh4JxbGg8az4w/Lfe7f4=",
+ "lastModified": 1737411508,
+ "narHash": "sha256-j9IdflJwRtqo9WpM0OfAZml47eBblUHGNQTe62OUqTw=",
"owner": "Mic92",
"repo": "sops-nix",
- "rev": "c9c88f08e3ee495e888b8d7c8624a0b2519cb773",
+ "rev": "015d461c16678fc02a2f405eb453abb509d4e1d4",
"type": "github"
},
"original": {
+++ /dev/null
-Subproject commit 7d1de4f46e219884402b037d0a24a44d423b3db7
--- /dev/null
+# -*- mode: snippet -*-
+# name: bcom
+# key: bcom
+# --
+/*! @brief $0 */
\ No newline at end of file
--- /dev/null
+
+# -*- mode: snippet -*-
+# name: com
+# key: com
+# --
+/*! $0 */
\ No newline at end of file
--- /dev/null
+# -*- mode: snippet -*-
+# name: ndef
+# key: ndef
+# --
+#ifndef $1
+#define $1
+$0
+#endif /* $1 */
--- /dev/null
+# -*- mode: snippet -*-
+# name: ts
+# key: ts
+# --
+/*! @brief $3 */
+typedef struct $1 {
+ $0
+} $2;
\ No newline at end of file
--- /dev/null
+# -*- mode: snippet -*-
+# name: tu
+# key: tu
+# --
+/*! @brief $3 */
+typedef union $1 {
+ $0
+} $2;
\ No newline at end of file
--- /dev/null
+# -*- mode: snippet -*-
+# name: align
+# key: align
+# --
+
+\begin{align}
+ $0
+\end{align}
\ No newline at end of file
--- /dev/null
+# -*- mode: snippet -*-
+# name: blognew
+# key: blognew
+# --
+#+title: $1
+#+author: Preston Pan
+#+description: $2
+#+html_head: <link rel="stylesheet" type="text/css" href="../style.css" />
+#+html_head: <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
+#+html_head: <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
+#+html_head: <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
+#+html_head: <link rel="manifest" href="/site.webmanifest">
+#+html_head: <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
+#+html_head: <meta name="msapplication-TileColor" content="#da532c">
+#+html_head: <meta name="theme-color" content="#ffffff">
+#+html_head: <meta name="viewport" content="width=1000; user-scalable=0;" />
+#+language: en
+#+OPTIONS: broken-links:t
+
+* Introduction
+$0
\ No newline at end of file
--- /dev/null
+# -*- mode: snippet -*-
+# name: elisp
+# key: elisp
+# --
+#+begin_src emacs-lisp :exports both
+$0
+#+end_src