I showed you my source code, pls respond
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

184 lines
7.7 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. #+TITLE: Dotfiles
  2. #+AUTHOR: Christopher James Hayward
  3. #+EMAIL: chris@chrishayward.xyz
  4. #+PROPERTY: header-args:emacs-lisp :tangle init.el :comments org
  5. #+PROPERTY: header-args :results silent :eval no-export
  6. #+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil
  7. #+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
  8. #+ATTR_ORG: :width 420px
  9. #+ATTR_HTML: :width 420px
  10. #+ATTR_LATEX: :width 420px
  11. [[./docs/images/modules-desktop.png]]
  12. [[./docs/images/modules-writing.png]]
  13. Portable [[https://gnu.org/software/emacs][GNU/Emacs]][fn:1] dotfiles. Built for Life, Liberty, and the Open Road.
  14. + 100% Literate
  15. + 100% Immutable
  16. + 100% Reproducible
  17. * Options
  18. All of the options available for configuration are defined here. They may be overriden in a host configuration, and are read by the definitions in the modules. All of the variables are prefixed with ~dotfiles/~ to avoid name collision with other functions and packages. All of the available modules are defined in ~dotfiles/modules-p~. The variable is constant, meaning it cannot be modified. Each time a new module is added, it must be included in this list.
  19. #+begin_src emacs-lisp
  20. (defconst dotfiles/modules-p
  21. '(core
  22. editor
  23. shell
  24. email
  25. feeds
  26. media
  27. terminal
  28. encryption
  29. desktop
  30. writing
  31. presentations
  32. website
  33. capture
  34. projects
  35. development
  36. interface
  37. dashboard)
  38. "All of the available modules.")
  39. #+end_src
  40. After the host configuration has loaded, the modules defined in ~dotfiles/modules~ are loaded sequentially. By default, the value of ~dotfiles/modules~ is equal to ~dotfiles/modules-p~. This means that all of the modules will load by default. Remove symbols from this list in a host configuration, or override it entirely to modify this behaviour.
  41. #+begin_src emacs-lisp
  42. (defvar dotfiles/modules dotfiles/modules-p
  43. "All of the enable modules, default value equal to `dotfiles/modules-p'.")
  44. #+end_src
  45. ** Environment variables
  46. Some of the behaviour in Emacs depends on the values of mutable environment variables. To reduce confusion in my own configuration, the values are read when Emacs starts, and then written to once the configuration has loaded. This allows the values to be overriden in a host configuration, without modifying the environment variable prior to starting.
  47. #+begin_src emacs-lisp
  48. (defvar dotfiles/browser (getenv "BROWSER")
  49. "Default system web browser.")
  50. (defvar dotfiles/language (getenv "LANG")
  51. "Default system dictionary language.")
  52. #+end_src
  53. ** Look and feel
  54. Define the options for the unified system font. The default is =Fira Code= due to its readability and support for ligatures. All font faces will be set with this value. Any variations to the font sizes are based on the value defined here as well, reducing the number of places to make modifications to when changing fonts.
  55. #+begin_src emacs-lisp
  56. (defvar dotfiles/font "Fira Code"
  57. "Unified system font family.")
  58. (defvar dotfiles/font-size 96
  59. "Unified system font size.")
  60. #+end_src
  61. Certain actions like code completions, or binding suggestions, can be configured to wait for a specific delay before offering their respective choices. I prefer to keep this value low, so that suggestions are shown immediately. This can have an affect on the performance of Emacs on older hardware. Adjust accordingly.
  62. #+begin_src emacs-lisp
  63. (defvar dotfiles/idle 0.0
  64. "Delay time before offering suggestions and completions.")
  65. #+end_src
  66. Prefix all of the custom keybinding actions with =SPC=, a tehcnique that comes from Doom / Spacemacs. In some situations, namely when using the [[file:modules/desktop.org][Desktop]] module, the leader key may not always be available. The global prefix should be used in these circumstances.
  67. #+begin_src emacs-lisp
  68. (defvar dotfiles/leader-key "SPC"
  69. "The all-powerful leader key.")
  70. (defvar dotfiles/leader-key-global
  71. (concat "C-" dotfiles/leader-key)
  72. "Global prefix for the all-powerful leader key.")
  73. #+end_src
  74. ** Productivity
  75. The location of source code projects for indexing in the [[file:modules/projects.org][Projects]] module are defined here. These projects will integrate their TODOs with the local Agenda. Override this setting in a host configuration, with the =DOTFILES_PROJECTS= environment variable, or use the default value of =~/.local/source/= in compliance with the XDG Base Directory specification.
  76. #+begin_src emacs-lisp
  77. (defvar dotfiles/projects
  78. (or (getenv "DOTFILES_PROJECTS")
  79. (expand-file-name "~/.local/source"))
  80. "Location of source code projects.")
  81. #+end_src
  82. ** Security
  83. The local password store should be cloned prior to initialization. Override this setting in a host configuration, with the =DOTFILES_PASSWORDS= environment variable, or use the default value of =~/.password-store=, which is what GNU pass will assume.
  84. #+begin_src emacs-lisp
  85. (defvar dotfiles/passwords
  86. (or (getenv "DOTFILES_PASSWORDS")
  87. (expand-file-name "~/.password-store"))
  88. "Location of the local password store.")
  89. #+end_src
  90. Since I keep all of my writing in this repository, I encrypt *most* of my Org files with GPG. Define the key to encrypt them for / to. Override this in a host configuration file.
  91. #+begin_src emacs-lisp
  92. (defvar dotfiles/public-key "37AB1CB72B741E478CA026D43025DCBD46F81C0F"
  93. "GPG kley to encrpy org files for/to.")
  94. #+end_src
  95. * Hosts
  96. Each host machines configuration loaded immediately after declaring the options, before applying any configuration. This allows system to system control while remaining immutable. Override any of the available options configurations in a host file. Here's some examples to get started:
  97. + [[file:hosts/acernitro.org][Acernitro]]
  98. + [[file:hosts/gamingpc.org][GamingPC]]
  99. + [[file:hosts/localhost.org][Termux]]
  100. + [[file:hosts/raspberry.org][Raspberry]]
  101. + [[file:hosts/virtualbox.org][VirtualBox]]
  102. Begin the process by loading any host specific option overrides. The host configuration tangles, and loads (if it exist) using the systems name. If a host definition doesn't exist the default values remain.
  103. #+begin_src emacs-lisp
  104. (let ((host-file (concat dotfiles/home "/hosts/" system-name ".org")))
  105. (when (file-exists-p host-file)
  106. (org-babel-load-file host-file)))
  107. #+end_src
  108. * Modules
  109. Breaking down the project into logical units or chapters to keep the code more maintainable and organized. This is also a fundamental requirement to achieve the goal of modularity. Below are details of the modules, and their respective dependencies.
  110. + [[file:modules/capture.org][Capture]]
  111. + [[file:modules/core.org][Core]]
  112. + [[file:modules/dashboard.org][Dashboard]]
  113. + [[file:modules/desktop.org][Desktop]]
  114. + [[file:modules/development.org][Development]]
  115. + [[file:modules/editor.org][Editor]]
  116. + [[file:modules/email.org][Email]]
  117. + [[file:modules/encryption.org][Encryption]]
  118. + [[file:modules/feeds.org][Feeds]]
  119. + [[file:modules/interface.org][Interface]]
  120. + [[file:modules/media.org][Media]]
  121. + [[file:modules/presentations.org][Presentations]]
  122. + [[file:modules/projects.org][Projects]]
  123. + [[file:modules/shell.org][Shell]]
  124. + [[file:modules/terminal.org][Terminal]]
  125. + [[file:modules/website.org][Website]]
  126. + [[file:modules/writing.org][Writing]]
  127. All of the modules in ~dotfiles/modules~ load after the host overrides. By default, all of the packages defined in ~dotfiles/modules-p~ load. Override this behaviour in a host configuration file.
  128. #+begin_src emacs-lisp
  129. (dolist (m dotfiles/modules)
  130. (let ((mod-file (concat dotfiles/home "/modules/" (symbol-name m) ".org")))
  131. (when (file-exists-p mod-file)
  132. (org-babel-load-file mod-file))))
  133. #+end_src
  134. * Footnotes
  135. [fn:1] https://gnu.org/software/emacs
  136. [fn:2] https://orgmode.org/worg/org-contrib/babel/intro.html
  137. [fn:3] https://orgmode.org
  138. [fn:4] https://gnu.org/software/emacs/manual/html_node/elisp/index.html