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.

180 lines
7.6 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
  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. terminal
  26. encryption
  27. desktop
  28. writing
  29. presentations
  30. website
  31. capture
  32. projects
  33. development
  34. interface
  35. dashboard)
  36. "All of the available modules.")
  37. #+end_src
  38. 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.
  39. #+begin_src emacs-lisp
  40. (defvar dotfiles/modules dotfiles/modules-p
  41. "All of the enable modules, default value equal to `dotfiles/modules-p'.")
  42. #+end_src
  43. ** Environment variables
  44. 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.
  45. #+begin_src emacs-lisp
  46. (defvar dotfiles/browser (getenv "BROWSER")
  47. "Default system web browser.")
  48. (defvar dotfiles/language (getenv "LANG")
  49. "Default system dictionary language.")
  50. #+end_src
  51. ** Look and feel
  52. 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.
  53. #+begin_src emacs-lisp
  54. (defvar dotfiles/font "Fira Code"
  55. "Unified system font family.")
  56. (defvar dotfiles/font-size 96
  57. "Unified system font size.")
  58. #+end_src
  59. 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.
  60. #+begin_src emacs-lisp
  61. (defvar dotfiles/idle 0.0
  62. "Delay time before offering suggestions and completions.")
  63. #+end_src
  64. 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.
  65. #+begin_src emacs-lisp
  66. (defvar dotfiles/leader-key "SPC"
  67. "The all-powerful leader key.")
  68. (defvar dotfiles/leader-key-global
  69. (concat "C-" dotfiles/leader-key)
  70. "Global prefix for the all-powerful leader key.")
  71. #+end_src
  72. ** Productivity
  73. 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.
  74. #+begin_src emacs-lisp
  75. (defvar dotfiles/projects
  76. (or (getenv "DOTFILES_PROJECTS")
  77. (expand-file-name "~/.local/source"))
  78. "Location of source code projects.")
  79. #+end_src
  80. ** Security
  81. 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.
  82. #+begin_src emacs-lisp
  83. (defvar dotfiles/passwords
  84. (or (getenv "DOTFILES_PASSWORDS")
  85. (expand-file-name "~/.password-store"))
  86. "Location of the local password store.")
  87. #+end_src
  88. 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.
  89. #+begin_src emacs-lisp
  90. (defvar dotfiles/public-key "37AB1CB72B741E478CA026D43025DCBD46F81C0F"
  91. "GPG kley to encrpy org files for/to.")
  92. #+end_src
  93. * Hosts
  94. 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:
  95. + [[file:hosts/acernitro.org][Acernitro]]
  96. + [[file:hosts/gamingpc.org][GamingPC]]
  97. + [[file:hosts/localhost.org][Termux]]
  98. + [[file:hosts/raspberry.org][Raspberry]]
  99. + [[file:hosts/virtualbox.org][VirtualBox]]
  100. 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.
  101. #+begin_src emacs-lisp
  102. (let ((host-file (concat dotfiles/home "/hosts/" system-name ".org")))
  103. (when (file-exists-p host-file)
  104. (org-babel-load-file host-file)))
  105. #+end_src
  106. * Modules
  107. 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.
  108. + [[file:modules/capture.org][Capture]]
  109. + [[file:modules/core.org][Core]]
  110. + [[file:modules/dashboard.org][Dashboard]]
  111. + [[file:modules/desktop.org][Desktop]]
  112. + [[file:modules/development.org][Development]]
  113. + [[file:modules/editor.org][Editor]]
  114. + [[file:modules/email.org][Email]]
  115. + [[file:modules/encryption.org][Encryption]]
  116. + [[file:modules/interface.org][Interface]]
  117. + [[file:modules/presentations.org][Presentations]]
  118. + [[file:modules/projects.org][Projects]]
  119. + [[file:modules/shell.org][Shell]]
  120. + [[file:modules/terminal.org][Terminal]]
  121. + [[file:modules/website.org][Website]]
  122. + [[file:modules/writing.org][Writing]]
  123. 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.
  124. #+begin_src emacs-lisp
  125. (dolist (m dotfiles/modules)
  126. (let ((mod-file (concat dotfiles/home "/modules/" (symbol-name m) ".org")))
  127. (when (file-exists-p mod-file)
  128. (org-babel-load-file mod-file))))
  129. #+end_src
  130. * Footnotes
  131. [fn:1] https://gnu.org/software/emacs
  132. [fn:2] https://orgmode.org/worg/org-contrib/babel/intro.html
  133. [fn:3] https://orgmode.org
  134. [fn:4] https://gnu.org/software/emacs/manual/html_node/elisp/index.html