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