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.

2817 lines
92 KiB

3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. :PROPERTIES:
  2. :ID: e4ad3dd5-0996-45bc-92ab-6bdbf16e4310
  3. :ROAM_REFS: https://chrishayward.xyz/dotfiles/
  4. :END:
  5. #+TITLE: Dotfiles
  6. #+AUTHOR: Christopher James Hayward
  7. #+EMAIL: chris@chrishayward.xyz
  8. #+STARTUP: overview
  9. #+STARTUP: hideblocks
  10. #+EXPORT_FILE_NAME: dotfiles
  11. #+HUGO_BASE_DIR: docs
  12. #+HUGO_AUTO_SET_LASTMOD: t
  13. #+HUGO_SECTION:
  14. #+HUGO_DRAFT: false
  15. #+HTML: <a href="https://nixos.org"><img src="https://img.shields.io/badge/NixOS-unstable-blue.svg?style=flat-square&logo=NixOS&logoColor=white"></a>
  16. #+HTML: <a href="https://www.gnu.org/software/emacs/"><img src="https://img.shields.io/badge/Emacs-28.1-blueviolet.svg?style=flat-square&logo=GNU%20Emacs&logoColor=white"></a>
  17. #+HTML: <a href="https://orgmode.org"><img src="https://img.shields.io/badge/Org-9.5.2-%2377aa99?style=flat-square&logo=org&logoColor=white"></a>
  18. #+NAME: description
  19. #+BEGIN_SRC text
  20. Immutable NixOS dotfiles.
  21. #+END_SRC
  22. #+ATTR_ORG: :width 800px
  23. #+ATTR_HTML: :width 800px
  24. #+ATTR_LATEX: :width 800px
  25. [[./docs/images/desktop.png]]
  26. Built for Life, Liberty, and the Open Road.
  27. + 100% Immutable
  28. + 100% Declarative
  29. + 100% Reproducible
  30. * Introduction
  31. This is my personal configuration for [[https://linux.org][GNU/Linux]] systems. It enables a consistent experience and computing environment across all of my machines. This project is written with [[https://gnu.org/software/emacs/][GNU/Emacs]], leveraging its capabilities for [[https://doi.org/10.1093/comjnl/27.2.97][Literate Programming]], a technique where programs are written in a natural language, such as English, interspersed with snippets of code to describe a software project.
  32. #+NAME: file-warning
  33. #+BEGIN_SRC text
  34. This file is controlled by /etc/dotfiles/README.org
  35. #+END_SRC
  36. ** Getting Started
  37. 1) [[https://nixos.org/download.html][Download the latest version of NixOS]]
  38. 2) [[https://nixos.org/manual/nixos/stable/#sec-installation-partitioning][Partition your drives and mount the file system]]
  39. 3) Clone the project ~git clone git@git.chrishayward.xyz:chris/dotfiles /mnt/etc/dotfiles~
  40. 4) Load the default shell ~nix-shell /mnt/etc/dotfiles~
  41. 5) Install the system ~sudo nixos-install --impure --flake /mnt/etc/dotfiles#nixos~
  42. 6) Reboot, login and start a graphical system ~startx~
  43. ** Making Changes
  44. The ~nixos-rebuild~ command updates the system so that it corresponds to the configuration specified in the module. It builds the new system in =/nix/store/=, runs the activation scripts, and restarts and system services (if needed). The command has one required argument, which specifies the desired operation:
  45. #+NAME: rebuild-command-table
  46. | Command | Description |
  47. |----------+---------------------------------------------------------------------------------|
  48. | boot | Build the new configuration and make it the boot default, without activation |
  49. | test | Build and activate the new configuration, without adding it to the boot menu |
  50. | switch | Build and activate the new configuration, making it the new boot default |
  51. | build | Build the new configuration, without activation, nor adding it to the boot menu |
  52. | build-vm | Build a script that starts a virtual machine with the desired configuration |
  53. After making changes to the configuration the ~switch~ command will build and activate a new configuration.
  54. #+BEGIN_SRC shell
  55. # Build and activate a new configuration.
  56. sudo nixos-rebuild switch --flake $FLAKE#$HOSTNAME
  57. #+END_SRC
  58. Instead of building a new configuration, it's possible to rollback to a previous generation using the ~nixos-rebuild~ command, by supplying the ~--rollback~ argument.
  59. #+BEGIN_SRC shell
  60. # Rollback to the previous generation.
  61. sudo nixos-rebuild switch --rollback
  62. #+END_SRC
  63. ** Docker Container
  64. It's possible to use parts of this configuration using a [[https://docker.org][Docker]] container. By default, sandboxing is turned /off/ inside of the container, even though it's enabled in new installations. This can lead to differences between derivations built inside containers, versus those built without any containerization. This is especially true if a derivation relies on sandboxing to block sideloading of dependencies.
  65. Install from the command line: ~docker pull ghcr.io/chayward1/dotfiles:main~
  66. #+BEGIN_SRC dockerfile :tangle Dockerfile :noweb yes
  67. # <<file-warning>>
  68. # Derive from the official image.
  69. FROM nixos/nix
  70. # Setup the default environment.
  71. WORKDIR /etc/dotfiles
  72. COPY . .
  73. # Load the default system shell.
  74. RUN nix-shell /etc/dotfiles/shell.nix
  75. #+END_SRC
  76. * Operating System
  77. #+ATTR_ORG: :width 200px
  78. #+ATTR_HTML: :width 200px
  79. #+ATTR_LATEX: :width 200px
  80. [[./docs/images/nixos.png]]
  81. [[https://nixos.org][NixOS]] is a purely functional Linux distribution built on top of the [[https://nixos.org/manual/nix/stable/Nix][Nix Package Manager]]. It uses a declarative configuration language to define entire computer systems, and allows reliable system upgrades and rollbacks. [[https://nixos.org][NixOS]] also has tool dedicated to DevOps and deployment tasks, and makes it trivial to share development environments.
  82. #+BEGIN_SRC nix :noweb yes :tangle flake.nix
  83. # <<file-warning>>
  84. {
  85. description = "<<description>>";
  86. inputs = {
  87. <<os-nixpkgs>>
  88. <<os-home-manager>>
  89. <<os-emacs-overlay>>
  90. <<os-nixos-hardware>>
  91. };
  92. outputs = inputs @ { self, nixpkgs, nixpkgs-unstable, ... }: {
  93. nixosConfigurations = {
  94. <<host-default>>
  95. };
  96. };
  97. }
  98. #+END_SRC
  99. ** Nixpkgs
  100. [[https://nixos.org/manual/nixpkgs/stable][Nixpkgs]] is a collection of over 60,000 software packages that can be installed with the [[https://nixos.org/manual/nix/stable/Nix][Nix Package Manager]]. Two main branches are offered:
  101. 1) The current stable release
  102. 2) The Unstable branch following the latest development
  103. #+NAME: os-nixpkgs
  104. #+BEGIN_SRC nix
  105. nixpkgs.url = "nixpkgs/nixos-unstable";
  106. nixpkgs-unstable.url = "nixpkgs/master";
  107. #+END_SRC
  108. ** Home Manager
  109. [[https://nixos.wiki/wiki/Home_Manager][Home Manager]] provides a basic system for managing user environments using the [[https://nixos.org/manual/nix/stable/Nix][Nix Package Manager]] together with the Nix libraries found in [[https://nixos.org/manual/nixpkgs/stable][Nixpkgs]]. It allows declarative configuration of user specific (non-global) packages and files.
  110. #+NAME: os-home-manager
  111. #+BEGIN_SRC nix
  112. home-manager.url = "github:nix-community/home-manager";
  113. home-manager.inputs.nixpkgs.follows = "nixpkgs";
  114. #+END_SRC
  115. ** Emacs Overlay
  116. Adding the [[https://github.com/nix-community/emacs-overlay][Emacs Overlay]] extends the [[https://gnu.org/software/emacs/][GNU/Emacs]] package set to contain the latest versions, and daily generations from popular package sources, including the needed dependencies to run Emacs as a Window Manager.
  117. #+NAME: os-emacs-overlay
  118. #+BEGIN_SRC nix
  119. emacs-overlay.url = "github:nix-community/emacs-overlay";
  120. #+END_SRC
  121. ** NixOS Hardware
  122. [[https://github.com/nixos/nixos-hardware][NixOS Hardware]] is a collection of [[https://nixos.org][NixOS]] modules covering specific hardware quirks. Unlike the channel, this will update the git repository on a rebuild. However, it's easy to pin particular revisions for more stability.
  123. #+NAME: os-nixos-hardware
  124. #+BEGIN_SRC nix
  125. nixos-hardware.url = "github:nixos/nixos-hardware";
  126. #+END_SRC
  127. * Development Shells
  128. The command ~nix-shell~ will build the dependencies of the specified derivation, but not the derivation itself. It will then start an interactive shell in which all environment variables defined by the derivation /path/ have been set to their corresponding values.
  129. Import this shell with ~nix-shell /etc/dotfiles/shell.nix~.
  130. #+BEGIN_SRC nix :noweb yes :tangle shell.nix
  131. # <<file-warning>>
  132. { pkgs ? import <nixpkgs> { } }:
  133. with pkgs;
  134. let
  135. nixBin = writeShellScriptBin "nix" ''
  136. exec ${nixFlakes}/bin/nix --option experimental-features "nix-command flakes" "$@"
  137. '';
  138. in mkShell {
  139. buildInputs = [
  140. git
  141. ];
  142. shellHook = ''
  143. export FLAKE="$(pwd)"
  144. export PATH="$FLAKE/bin:${nixBin}/bin:$PATH"
  145. '';
  146. }
  147. #+END_SRC
  148. ** Go
  149. #+ATTR_ORG: :width 800px
  150. #+ATTR_HTML: :width 800px
  151. #+ATTR_LATEX: :width 800px
  152. [[./docs/images/golang.png]]
  153. [[https://golang.org][Go]] is an open-source programming language that makes it easy to build simple, reliable, and efficient software. It's statically typed and compiled programming language. It's syntactically similar to C, but with memory safety, garbage collection, structural typing, and CSP-style concurrency.
  154. Import this shell with ~nix-shell /etc/dotfiles/shells/go.nix~
  155. #+BEGIN_SRC nix :noweb yes :tangle shells/go.nix
  156. # <<file-warning>>
  157. { pkgs ? import <nixpkgs> { } }:
  158. with pkgs;
  159. mkShell {
  160. buildInputs = [
  161. go
  162. gopls
  163. protoc-gen-go
  164. protoc-gen-go-grpc
  165. ];
  166. shellHook = ''
  167. export GO111MODULE=on
  168. export GOPATH=$XDG_DATA_HOME/go
  169. export PATH=$GOPATH/bin:$PATH
  170. '';
  171. }
  172. #+END_SRC
  173. ** Rust
  174. #+ATTR_ORG: :width 800px
  175. #+ATTR_HTML: :width 800px
  176. #+ATTR_LATEX: :width 800px
  177. [[./docs/images/rust.png]]
  178. [[https://rust-lang.org/][Rust]] is a multi-paradigm programming language designed for performance and safety, especially safe concurrency. It is syntactically similar to C++, but can garantee memory safety by using a borrow checker to validate references. Rust achieves memory safety /without/ garbage collection, and reference counting is optional.
  179. Import this shell with ~nix-shell /etc/dotfiles/shells/rust.nix~.
  180. #+BEGIN_SRC nix :noweb yes :tangle shells/rust.nix
  181. # <<file-warning>>
  182. { pkgs ? import <nixpkgs> { } }:
  183. with pkgs;
  184. mkShell {
  185. buildInputs = [
  186. rustup
  187. ];
  188. shellHook = ''
  189. export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
  190. export CARGO_HOME="$XDG_DATA_HOME/cargo"
  191. export PATH="$CARGO_HOME/bin:$PATH"
  192. '';
  193. }
  194. #+END_SRC
  195. ** Node
  196. #+ATTR_ORG: :width 800px
  197. #+ATTR_HTML: :width 800px
  198. #+ATTR_LATEX: :width 800px
  199. [[./docs/images/node.png]]
  200. [[https://nodejs.org][NodeJS]] is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine, and executes JavaScript code outside of a web browser. NodeJS lets developers user JavaScript to write command line tools, and for server-side scripting to produce dynamic web page content.
  201. Import this shell with ~nix-shell /etc/dotfiles/shells/node.nix~.
  202. #+BEGIN_SRC nix :noweb yes :tangle shells/node.nix
  203. # <<file-warning>>
  204. { pkgs ? import <nixpkgs> { } }:
  205. with pkgs;
  206. mkShell {
  207. buildInputs = [
  208. nodejs
  209. yarn
  210. ];
  211. shellHook = ''
  212. export NPM_CONFIG_TMP="$XDG_RUNTIME_DIR/npm"
  213. export NPM_CONFIG_CACHE="$XDG_CACHE_HOME/npm"
  214. export NPM_CACHE_PREFIX="$XDG_CACHE_HOME/npm"
  215. export PATH="$(yarn global bin):$PATH"
  216. '';
  217. }
  218. #+END_SRC
  219. ** Java
  220. [[https://openjdk.java.net][OpenJDK]] is a free and open-source implementation of the [[https://en.wikipedia.org/wiki/Java_(software_platform)][Java]] Platform, Standard Edition. It is the result of an effort Sun Microsystems began in 2006. The implementation is licensed under the GNU General Public License Version 2 with a linking exception.
  221. Import this shell with ~nix-shell /etc/dotfiles/shells/java.nix~.
  222. #+BEGIN_SRC nix :noweb yes :tangle shells/java.nix
  223. # <<file-warning>>
  224. { pkgs ? import <nixpkgs> { } }:
  225. with pkgs;
  226. mkShell {
  227. buildInputs = [
  228. # openjdk8 # Legacy Java 8 VM.
  229. # openjdk11 # Current LTS version of OpenJDK.
  230. openjdk14 # Current version of OpenJDK.
  231. ];
  232. shellHook = ''
  233. '';
  234. }
  235. #+END_SRC
  236. ** gRPC
  237. [[https://grpc.io][gRPC]] is a modern open-source, high-performance Remote Procedure Call (RPC) framework that can run in any environment. It can efficiently connect services in and across data centres with pluggable support for load balancing, tracing, health checking, and authentication.
  238. Import this shell with ~nix-shell /etc/dotfiles/shells/grpc.nix~.
  239. #+BEGIN_SRC nix :noweb yes :tangle shells/grpc.nix
  240. # <<file-warning>>
  241. { pkgs ? import <nixpkgs> { } }:
  242. with pkgs;
  243. mkShell {
  244. buildInputs = [
  245. grpc
  246. grpcui
  247. grpcurl
  248. grpc-tools
  249. ];
  250. shellHook = ''
  251. '';
  252. }
  253. #+END_SRC
  254. ** C/C++
  255. [[https://iso.org/standard/74528.html][C]] is a general-purpose, procedural computer programming language support structured programming, lexical variable scope, and recursion. It has a static type system, and by design provides constructs that map efficiently to typical machine instructions. [[https://en.wikipedia.org/wiki/C++/][C++]] is a general-purpose programming language created as an extension of the C programming language.
  256. Import this shell with ~nix-shell /etc/dotfiles/shells/cc.nix~.
  257. #+BEGIN_SRC nix :noweb yes :tangle shells/cc.nix
  258. # <<file-warning>>
  259. { pkgs ? import <nixpkgs> { } }:
  260. with pkgs;
  261. mkShell {
  262. buildInputs = [
  263. gdb
  264. ccls
  265. cmake
  266. boost
  267. gnumake
  268. gcc-unwrapped
  269. ];
  270. shellHook = ''
  271. '';
  272. }
  273. #+END_SRC
  274. ** Python
  275. [[https://python.org][Python]] is an interpreted high-level, general-purpose programming language. Its design philosophy emphasizes code readability, with its notable use of significant indentation. Its language constructs, as well as its object-oriented approach aim to help programmers write clear, logical, code for small and large projects.
  276. Import this shell with ~nix-shell /etc/dotfiles/shells/python.nix~
  277. #+BEGIN_SRC nix :noweb yes :tangle shells/python.nix
  278. # <<file-warning>>
  279. { pkgs ? import <nixpkgs> { } }:
  280. with pkgs;
  281. mkShell {
  282. buildInputs = [
  283. python310Packages.pip
  284. python310Packages.pip-tools
  285. python310Packages.python-lsp-black
  286. python310Packages.python-lsp-server
  287. python310Packages.python-lsp-jsonrpc
  288. ];
  289. shellHook = ''
  290. '';
  291. }
  292. #+END_SRC
  293. ** Docker
  294. [[https://docker.org][Docker]] is a set of platform as a service tools that use OS level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries, and configuratuion files.
  295. [[https://docs.docker.com/compose/][Compose]] is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application services. Then, with a single command, you create and start all of the services from your configuration.
  296. [[https://docs.docker.com/machine/][Machine]] is a tool that lets you install Docker Engine on virtual hosts, and manage the hosts with ~docker-machine~ commands. You can use Machine to create hosts on your local box, company network, data center, or on any cloud provider.
  297. Import this shell with ~nix-shell /etc/dotfiles/shells/docker.nix~
  298. #+BEGIN_SRC nix :noweb yes :tangle shells/docker.nix
  299. # <<file-warning>>
  300. { pkgs ? import <nixpkgs> { } }:
  301. with pkgs;
  302. mkShell {
  303. buildInputs = [
  304. docker-compose
  305. docker-machine
  306. ];
  307. shellHook = ''
  308. '';
  309. }
  310. #+END_SRC
  311. ** Heroku
  312. [[https://heroku.com][Heroku]] is a cloud platform as a service supporting several programming languages. One of the first cloud platforms, Heroku has been in development since June 2007, when it supported only the Ruby programming language. It now supports Java, Node.js, Scala, Clojure, Python, PHP, and Go.
  313. Import this shell with ~nix-shell /etc/dotfiles/shells/heroku.nix~
  314. #+BEGIN_SRC nix :noweb yes :tangle shells/heroku.nix
  315. # <<file-warning>>
  316. { pkgs ? import <nixpkgs> { } }:
  317. with pkgs;
  318. mkShell {
  319. buildInputs = [
  320. heroku
  321. ];
  322. shellHook = ''
  323. '';
  324. }
  325. #+END_SRC
  326. * Host Configurations
  327. [[https://nixos.org/][NixOS]] typically stores the current machine configuration in =/etc/nixos/configuration.nix=. In this project, this file is stored in =/etc/dotfiles/hosts/$HOSTNAME/...=, and imported, along with the generated hardware configurations. This ensures that multiple host machines can share the same modules, and generating new host definitions is trivial. It also makes it easier to share common configurations amongst all of the hosts, such as with pre-configured wireless networking:
  328. #+NAME: host-config-wifi
  329. #+BEGIN_SRC nix
  330. networking.wireless.networks = {
  331. MyWiFi_5C1870 = {
  332. priority = 2;
  333. pskRaw = "409b3c85fef1c5737f284d2f82f20dc6023e41804e862d4fa26265ef8193b326";
  334. };
  335. SM-G975W3034 = {
  336. priority = 1;
  337. pskRaw = "74835d96a98ca2c56ffe4eaf92223f8a555168b59ec2bb22b1e46b2a333adc80";
  338. };
  339. };
  340. #+END_SRC
  341. It's helpful to add the machine hostnames to the networking configuration, so I can refer to another host across the network by name. Some devices that can have more than one IP (WIFI / Ethernet) will have the wireless hostname suffixed:
  342. #+NAME: host-config-home
  343. #+BEGIN_SRC nix
  344. networking.hosts = {
  345. # "192.168.3.105" = [ "gamingpc" ];
  346. # "192.168.3.163" = [ "acernitro" ];
  347. # "192.168.3.182" = [ "raspberry" ];
  348. # "192.168.3.183" = [ "homecloud" ];
  349. };
  350. #+END_SRC
  351. Setting up new machines, especially headless ones like the Raspberry Pi Zero, can be difficult with NixOS. I find it easier to setup automatic network configuration, and wait for the machine to appear on the network. This is complimented with a pre-authorized SSH key, making it simple to connect and complete the installation headlessly.
  352. #+NAME: host-config-ssh
  353. #+BEGIN_SRC nix
  354. users.users.chris.openssh.authorizedKeys.keys = [
  355. "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4wka/LfG3pto15DIm9LIRbb6rWr7/ipCRiCdAKSlY4 chris@chrishayward.xyz"
  356. ];
  357. #+END_SRC
  358. ** Default
  359. The default host, built using [[https://qemu.org][QEMU]], a free and open-source emulator that can perform hardware virtualization. It features a lightweight system optimized for development, running [[https://gnu.org/software/emacs/][GNU/Emacs]] + [[https://github.com/ch11ng/exwm][EXWM]] as the graphical environment.
  360. #+NAME: host-default
  361. #+BEGIN_SRC nix :noweb yes
  362. nixos = nixpkgs.lib.nixosSystem {
  363. system = "x86_64-linux";
  364. specialArgs = { inherit inputs; };
  365. modules = [
  366. ./hosts/nixos
  367. <<module-x11>>
  368. <<module-ssh>>
  369. <<module-hugo>>
  370. <<module-godot>>
  371. <<module-flakes>>
  372. <<module-cachix>>
  373. <<module-firefox>>
  374. <<module-home-manager>>
  375. ];
  376. };
  377. #+END_SRC
  378. Deploy this configuration with ~nixos-rebuild switch --flake /etc/dotfiles/#nixos~.
  379. #+BEGIN_SRC nix :noweb yes :tangle hosts/nixos/default.nix
  380. # <<file-warning>>
  381. { ... }:
  382. {
  383. imports = [
  384. ./configuration.nix
  385. ./hardware.nix
  386. ];
  387. }
  388. #+END_SRC
  389. *** Configuration
  390. This is a basic default configuration that specified the indended default configuration of the system. Because [[https://nixos.org/][NixOS]] has a declarative configuration model, you can create or edit a description of the desired configuration, and update it from one file.
  391. #+BEGIN_SRC nix :noweb yes :tangle hosts/nixos/configuration.nix
  392. # <<file-warning>>
  393. { config, pkgs, inputs, ... }:
  394. {
  395. time.timeZone = "America/Toronto";
  396. networking.hostName = "nixos";
  397. networking.useDHCP = false;
  398. networking.firewall.enable = false;
  399. networking.interfaces.ens3.useDHCP = true;
  400. <<host-config-home>>
  401. <<host-config-ssh>>
  402. programs.mtr.enable = true;
  403. programs.fish.enable = true;
  404. programs.gnupg.agent.enable = true;
  405. users.users.chris = {
  406. shell = pkgs.fish;
  407. isNormalUser = true;
  408. extraGroups = [ "wheel" ];
  409. };
  410. }
  411. #+END_SRC
  412. *** Hardware
  413. The file system for this host is a single 24GB =QCOW= file, a format for disk images used by [[https://qemu.org][QEMU]]. The file can be recreated easily by following the steps listed in the [[https://nixos.org/][NixOS]] installation manual, specifically the section on disk formatting.
  414. #+BEGIN_SRC nix :noweb yes :tangle hosts/nixos/hardware.nix
  415. # <<file-warning>>
  416. { config, lib, pkgs, modulesPath, ... }:
  417. {
  418. imports =
  419. [ (modulesPath + "/profiles/qemu-guest.nix")
  420. ];
  421. boot.initrd.availableKernelModules = [ "ata_piix" "floppy" "sd_mod" "sr_mod" ];
  422. boot.initrd.kernelModules = [ ];
  423. boot.kernelModules = [ ];
  424. boot.extraModulePackages = [ ];
  425. boot.loader.grub.enable = true;
  426. boot.loader.grub.version = 2;
  427. boot.loader.grub.device = "/dev/sda";
  428. fileSystems."/" =
  429. { device = "/dev/disk/by-label/nixos";
  430. fsType = "ext4";
  431. };
  432. swapDevices =
  433. [ { device = "/dev/disk/by-label/swap"; }
  434. ];
  435. }
  436. #+END_SRC
  437. * Module Definitions
  438. Modules are files combined by [[https://nixos.org/][NixOS]] to produce the full system configuration. Modules wre introduced to allow extending NixOS without modifying its source code. They also allow splitting up =configuration.nix=, making the system configuration easier to maintain and use.
  439. ** X11
  440. #+NAME: module-x11
  441. #+BEGIN_SRC nix
  442. ./modules/x11.nix
  443. #+END_SRC
  444. [[https://x.org/wiki/][X11]], or X is the generic name for the X Window System Display Server. All graphical [[https://linux.org][GNU/Linux]] applications connect to an X-Window (or Wayland) to display graphical data on the monitor of a computer. Its a program that acts as the interface between graphical applications and the graphics subsystem of the computer.
  445. #+BEGIN_SRC nix :noweb yes :tangle modules/x11.nix
  446. # <<file-warning>>
  447. { config, pkgs, ... }:
  448. {
  449. services.xserver.enable = true;
  450. services.xserver.layout = "us";
  451. services.xserver.libinput.enable = true;
  452. services.xserver.displayManager.startx.enable = true;
  453. environment = {
  454. variables = {
  455. XDG_DESKTOP_DIR = "$HOME/";
  456. XDG_CACHE_HOME = "$HOME/.cache";
  457. XDG_CONFIG_HOME = "$HOME/.config";
  458. XDG_DATA_HOME = "$HOME/.local/share";
  459. XDG_BIN_HOME = "$HOME/.local/bin";
  460. };
  461. systemPackages = with pkgs; [
  462. pkgs.sqlite
  463. pkgs.pfetch
  464. pkgs.cmatrix
  465. pkgs.asciiquarium
  466. ];
  467. extraInit = ''
  468. export XAUTHORITY=/tmp/Xauthority
  469. export xserverauthfile=/tmp/xserverauth
  470. [ -e ~/.Xauthority ] && mv -f ~/.Xauthority "$XAUTHORITY"
  471. [ -e ~/.serverauth.* ] && mv -f ~/.serverauth.* "$xserverauthfile"
  472. '';
  473. };
  474. services.picom.enable = true;
  475. services.printing.enable = true;
  476. fonts.fonts = with pkgs; [
  477. iosevka-bin
  478. emacs-all-the-icons-fonts
  479. ];
  480. }
  481. #+END_SRC
  482. ** SSH
  483. #+NAME: module-ssh
  484. #+BEGIN_SRC nix
  485. ./modules/ssh.nix
  486. #+END_SRC
  487. [[https://openssh.com][OpenSSH]] is a suite of secure networking utilities based on the [[https://en.wikipedia.org/wiki/Secure_Shell][Secure Shell Protocol]], which provides a secure channel over an unsecured network in a client-server architecture. OpenSSH started as a fork of the free SSH program; later versions were proprietary software.
  488. Apply some configuration to the default settings:
  489. + Disable logging in as =root=
  490. + Disable password authentication
  491. #+BEGIN_SRC nix :noweb yes :tangle modules/ssh.nix
  492. # <<file-warning>>
  493. { config, pkgs, ... }:
  494. {
  495. services.openssh = {
  496. enable = true;
  497. permitRootLogin = "no";
  498. passwordAuthentication = false;
  499. };
  500. }
  501. #+END_SRC
  502. ** Hugo
  503. #+NAME: module-hugo
  504. #+BEGIN_SRC nix
  505. ./modules/hugo.nix
  506. #+END_SRC
  507. [[https://gohugo.io][Hugo]] is one of the most popular open-source static site generators. I use it to build https://chrishayward.xyz which is included in a later section of this configuration. This module adds a custom package to push the site to the server.
  508. #+BEGIN_SRC nix :noweb yes :tangle modules/hugo.nix
  509. # <<file-warning>>
  510. { config, pkgs, ... }:
  511. let
  512. mySiteDir = "/etc/dotfiles/docs/public/";
  513. mySiteTgt = "ubuntu@chrishayward.xyz:/var/www/wedding";
  514. mySiteBuild = pkgs.writeShellScriptBin "my-site-build" ''
  515. pushd ${mySiteDir}../ && ${pkgs.hugo}/bin/hugo -v ; popd
  516. '';
  517. mySiteUpdate = pkgs.writeShellScriptBin "my-site-update" ''
  518. ${pkgs.rsync}/bin/rsync -aP ${mySiteDir} ${mySiteTgt}
  519. '';
  520. in {
  521. environment.systemPackages = [
  522. mySiteBuild
  523. mySiteUpdate
  524. ];
  525. }
  526. #+END_SRC
  527. ** Godot
  528. #+NAME: module-godot
  529. #+BEGIN_SRC nix
  530. ./modules/godot.nix
  531. #+END_SRC
  532. [[https://godotengine.org][Godot]] is a cross-platform, free and open-source game engine released under the MIT license. It provides a huge set of common tools, so you can focus on making your game without reinventing the wheel. It's completely free and open-source, no strings attached, no royalties. The game belongs to the creator down to each line of the engine code.
  533. #+BEGIN_SRC nix :noweb yes :tangle modules/godot.nix
  534. # <<file-warning>>
  535. { config, pkgs, ... }:
  536. {
  537. environment.systemPackages = [
  538. pkgs.tiled
  539. pkgs.godot
  540. pkgs.godot-server
  541. pkgs.godot-headless
  542. pkgs.python310Packages.gdtoolkit
  543. ];
  544. }
  545. #+END_SRC
  546. ** Flakes
  547. #+NAME: module-flakes
  548. #+BEGIN_SRC nix
  549. ./modules/flakes.nix
  550. #+END_SRC
  551. [[https://nixos.wiki/wiki/Flakes][Nix Flakes]] are an upcoming feature of the [[https://nixos.org/manual/nix/stable/][Nix Package Manager]]. They allow you to specify your codes dependencies in a declarative way, simply by listing them inside of a ~flake.nix~ file. Each dependency is then pinned to a specific git-hash. Flakes replace the =nix-channels= command and things like ~builtins.fetchGit~, keeping dependencies at the top of the tree, and channels always in sync. Currently, Flakes are not available unless explicitly enabled.
  552. #+BEGIN_SRC nix :noweb yes :tangle modules/flakes.nix
  553. # <<file-warning>>
  554. { config, pkgs, inputs, ... }:
  555. {
  556. nix = {
  557. package = pkgs.nixUnstable;
  558. extraOptions = ''
  559. experimental-features = nix-command flakes
  560. '';
  561. };
  562. nixpkgs = {
  563. config = { allowUnfree = true; };
  564. overlays = [ inputs.emacs-overlay.overlay ];
  565. };
  566. }
  567. #+END_SRC
  568. ** Cachix
  569. #+NAME: module-cachix
  570. #+BEGIN_SRC nix
  571. ./modules/cachix.nix
  572. #+END_SRC
  573. [[https://nix-community.cachix.org][Cachix]] is a Command line client for [[https://nixos.org/manual/nix/stable/][Nix]] binary cache hosting. This allows downloading and usage of pre-compiled binaries for applications on /nearly/ every available system architecture. This speeds up the time it takes to rebuild configurations.
  574. #+BEGIN_SRC nix :noweb yes :tangle modules/cachix.nix
  575. # <<file-warning>>
  576. { config, ... }:
  577. {
  578. nix = {
  579. settings = {
  580. substituters = [
  581. "https://nix-community.cachix.org"
  582. ];
  583. trusted-public-keys = [
  584. "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
  585. ];
  586. };
  587. };
  588. }
  589. #+END_SRC
  590. ** Docker
  591. #+NAME: module-docker
  592. #+BEGIN_SRC nix
  593. ./modules/docker.nix
  594. #+END_SRC
  595. [[https://docker.org][Docker]] is a set of platform as a service tools that use OS level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries, and configuration files; they can communicate with each other through well-defined channels.
  596. #+BEGIN_SRC nix :noweb yes :tangle modules/docker.nix
  597. { config, pkgs, ... }:
  598. {
  599. # Enable the docker virutalization platform.
  600. virtualisation.docker = {
  601. enable = true;
  602. enableOnBoot = true;
  603. autoPrune.enable = true;
  604. };
  605. # Required for the `docker' command.
  606. users.users.chris.extraGroups = [ "docker" ];
  607. }
  608. #+END_SRC
  609. ** Firefox
  610. #+NAME: module-firefox
  611. #+BEGIN_SRC nix
  612. ./modules/firefox.nix
  613. #+END_SRC
  614. [[https://firefox.com][Firefox Browser]], also known as Mozilla Firefox or simply Firefox, is a free and open-source web browser developed by the Mozilla Foundation and its subsidiary, the Mozilla Corporation. Firefox uses the Gecko layout engine to render web pages, which implements current and anticipated web standards. In 2017, Firefox began incorporating new technology under the code name Quantum to promote parallelism and a more intuitive user interface.
  615. #+BEGIN_SRC nix :noweb yes :tangle modules/firefox.nix
  616. # <<file-warning>>
  617. { config, pkgs, ... }:
  618. let
  619. myFirefox = pkgs.writeShellScriptBin "firefox" ''
  620. HOME=~/.local/share/mozilla ${pkgs.firefox-bin}/bin/firefox
  621. '';
  622. in {
  623. # NOTE: Use the binary until module is developed.
  624. environment.systemPackages = [
  625. myFirefox
  626. ];
  627. }
  628. #+END_SRC
  629. ** Home Manager
  630. [[https://nixos.wiki/wiki/Home_Manager][Home Manager]] includes a =flake.nix= file for compatibility with Nix Flakes, a feature utilized heavily in this project. When using flakes, switching to a new configuration is done /only/ for the entire system, using the command ~nixos-rebuild switch --flake <path>~, instead of ~nixos-rebuild~, and ~home-manager~ seperately.
  631. #+NAME: module-home-manager
  632. #+BEGIN_SRC nix :noweb yes
  633. inputs.home-manager.nixosModules.home-manager {
  634. home-manager.useGlobalPkgs = true;
  635. home-manager.useUserPackages = true;
  636. home-manager.users.chris = {
  637. imports = [
  638. <<module-git>>
  639. <<module-gpg>>
  640. <<module-vim>>
  641. <<module-gtk>>
  642. <<module-emacs>>
  643. ];
  644. };
  645. }
  646. #+END_SRC
  647. Certain modules have to be included within home manager or they will not function correctly.
  648. #+NAME: home-manager-warning
  649. #+BEGIN_SRC text
  650. This module MUST be included within home manager
  651. #+END_SRC
  652. *** Git
  653. #+NAME: module-git
  654. #+BEGIN_SRC nix
  655. ./modules/git.nix
  656. #+END_SRC
  657. [[https://git.scm.com][Git]] is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git is easy to learn, has a tiny footprint, and lighting fast performance. It outclasses every other version control tool such as: SCM, Subversion, CVS, ClearCase, with features like cheap local branching, convinient staging areas, and multiple workflows.
  658. #+BEGIN_SRC nix :noweb yes :tangle modules/git.nix
  659. # <<file-warning>>
  660. # <<home-manager-warning>>
  661. { pkgs, ... }:
  662. let
  663. # Fix any corruptions in the local copy.
  664. myGitFix = pkgs.writeShellScriptBin "git-fix" ''
  665. if [ -d .git/objects/ ]; then
  666. find .git/objects/ -type f -empty | xargs rm -f
  667. git fetch -p
  668. git fsck --full
  669. fi
  670. exit 1
  671. '';
  672. in {
  673. home.packages = [ myGitFix ];
  674. programs.git = {
  675. enable = true;
  676. userName = "Christopher James Hayward";
  677. userEmail = "chris@chrishayward.xyz";
  678. signing = {
  679. key = "37AB1CB72B741E478CA026D43025DCBD46F81C0F";
  680. signByDefault = true;
  681. };
  682. };
  683. }
  684. #+END_SRC
  685. *** Gpg
  686. #+NAME: module-gpg
  687. #+BEGIN_SRC nix
  688. ./modules/gpg.nix
  689. #+END_SRC
  690. [[https://gnupg.org][GNU Privacy Guard]] is a free-software replacement for Symantec's PGP cryptographic software suite. It is compliant with RFC 4880, the IETF standards-track specification of OpenPGP. Modern versions of PGP are interoperable with GnuPG and other OpenPGP-compliant systems.
  691. #+BEGIN_SRC nix :noweb yes :tangle modules/gpg.nix
  692. # <<file-warning>>
  693. # <<home-manager-warning>>
  694. { pkgs, ... }:
  695. {
  696. services.gpg-agent = {
  697. enable = true;
  698. defaultCacheTtl = 1800;
  699. enableSshSupport = true;
  700. pinentryFlavor = "gtk2";
  701. };
  702. }
  703. #+END_SRC
  704. *** Vim
  705. #+NAME: module-vim
  706. #+BEGIN_SRC nix
  707. ./modules/vim.nix
  708. #+END_SRC
  709. [[https://neovim.io][Neovim]] is a project that seeks to aggressively refactor Vim in order to:
  710. + Simplify maintenance and encourage contributions
  711. + Split the work between multiple developers
  712. + Enable advanced UIs without core modification
  713. + Maximize extensibility
  714. #+BEGIN_SRC nix :noweb yes :tangle modules/vim.nix
  715. # <<file-warning>>
  716. # <<home-manager-warning>>
  717. { pkgs, ... }:
  718. {
  719. programs.neovim = {
  720. enable = true;
  721. viAlias = true;
  722. vimAlias = true;
  723. vimdiffAlias = true;
  724. extraConfig = ''
  725. set number relativenumber
  726. set nobackup
  727. '';
  728. extraPackages = [
  729. pkgs.nixfmt
  730. ];
  731. plugins = with pkgs.vimPlugins; [
  732. vim-nix
  733. vim-airline
  734. vim-polyglot
  735. ];
  736. };
  737. }
  738. #+END_SRC
  739. *** GTK
  740. #+NAME: module-gtk
  741. #+BEGIN_SRC nix
  742. ./modules/gtk.nix
  743. #+END_SRC
  744. [[https://gtk.org][GTK]] is a free and open-source, cross-platform widget toolkit for graphical user interfaces. It's one of the most popular toolkits for the [[https://wayland.freedesktop.org][Wayland]] and [[https://x.org/wiki/][X11]] windowing systems.
  745. #+BEGIN_SRC nix :noweb yes :tangle modules/gtk.nix
  746. # <<file-warning>>
  747. # <<home-manager-warning>>
  748. { pkgs, ... }:
  749. {
  750. home.packages = [
  751. pkgs.nordic
  752. pkgs.arc-icon-theme
  753. pkgs.lxappearance
  754. ];
  755. home.file.".gtkrc-2.0" = {
  756. text = ''
  757. gtk-theme-name="Nordic-darker"
  758. gtk-icon-theme-name="Arc"
  759. gtk-font-name="Iosevka 11"
  760. gtk-cursor-theme-size=0
  761. gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ
  762. gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
  763. gtk-button-images=0
  764. gtk-menu-images=0
  765. gtk-enable-event-sounds=1
  766. gtk-enable-input-feedback-sounds=1
  767. gtk-xft-antialias=1
  768. gtk-xft-hinting=1
  769. gtk-xft-hintstyle="hintmedium"
  770. '';
  771. };
  772. home.file.".config/gtk-2.0/gtkfilechooser.ini" = {
  773. text = ''
  774. [Filechooser Settings]
  775. LocationMode=path-bar
  776. ShowHidden=false
  777. ShowSizeColumn=true
  778. GeometryX=442
  779. GeometryY=212
  780. GeometryWidth=1036
  781. GeometryHeight=609
  782. SortColumn=name
  783. SortOrder=ascending
  784. StartupMode=recent
  785. '';
  786. };
  787. home.file.".config/gtk-3.0/settings.ini" = {
  788. text = ''
  789. [Settings]
  790. gtk-theme-name=Nordic-darker
  791. gtk-icon-theme-name=Arc
  792. gtk-font-name=Iosevka 11
  793. gtk-cursor-theme-size=0
  794. gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ
  795. gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
  796. gtk-button-images=0
  797. gtk-menu-images=0
  798. gtk-enable-event-sounds=1
  799. gtk-enable-input-feedback-sounds=1
  800. gtk-xft-antialias=1
  801. gtk-xft-hinting=1
  802. gtk-xft-hintstyle=hintmedium
  803. '';
  804. };
  805. }
  806. #+END_SRC
  807. * Emacs Configuration
  808. #+ATTR_ORG: :width 800px
  809. #+ATTR_HTML: :width 800px
  810. #+ATTR_LATEX: :width 800px
  811. [[./docs/images/emacs.png]]
  812. #+NAME: module-emacs
  813. #+BEGIN_SRC nix
  814. ./modules/emacs.nix
  815. #+END_SRC
  816. [[https://gnu.org/software/emacs/][GNU/Emacs]] is an extensible, customizable, free/libre text editor -- and more. At its core is an interpreter for [[https://www.gnu.org/software/emacs/manual/html_node/elisp/index.html][Emacs Lisp]], a dialect of the Lisp programming language with extensions to support text editing. Other features include:
  817. + Highly customizable
  818. + Full Unicopde support
  819. + Content-aware editing modes
  820. + Complete built-in documentation
  821. + Wide range of functionality beyond text editing
  822. #+BEGIN_SRC nix :noweb yes :tangle modules/emacs.nix
  823. # <<file-warning>>
  824. # <<home-manager-warning>>
  825. { pkgs, ... }:
  826. let
  827. myEmacs = pkgs.emacsWithPackagesFromUsePackage {
  828. config = ../README.org;
  829. package = <<emacs-native-comp-package>>
  830. alwaysEnsure = true;
  831. alwaysTangle = true;
  832. extraEmacsPackages = epkgs: [
  833. # Required packages...
  834. <<emacs-exwm-package>>
  835. <<emacs-evil-package>>
  836. <<emacs-general-package>>
  837. <<emacs-which-key-package>>
  838. # Optional packages.
  839. <<emacs-org-package>>
  840. <<emacs-org-roam-package>>
  841. <<emacs-org-roam-ui-package>>
  842. <<emacs-org-drill-package>>
  843. <<emacs-pomodoro-package>>
  844. <<emacs-writegood-package>>
  845. <<emacs-http-package>>
  846. <<emacs-hugo-package>>
  847. <<emacs-pass-package>>
  848. <<emacs-docker-package>>
  849. <<emacs-mu4e-package>>
  850. <<emacs-dired-package>>
  851. <<emacs-icons-package>>
  852. <<emacs-emoji-package>>
  853. <<emacs-eshell-package>>
  854. <<emacs-vterm-package>>
  855. <<emacs-magit-package>>
  856. <<emacs-hydra-package>>
  857. <<emacs-elfeed-package>>
  858. <<emacs-nix-mode-package>>
  859. <<emacs-projectile-package>>
  860. <<emacs-lsp-package>>
  861. <<emacs-company-package>>
  862. <<emacs-gdscript-package>>
  863. <<emacs-ccls-package>>
  864. <<emacs-golang-package>>
  865. <<emacs-python-package>>
  866. <<emacs-rustic-package>>
  867. <<emacs-protobuf-package>>
  868. <<emacs-typescript-package>>
  869. <<emacs-plantuml-package>>
  870. # User interface packages.
  871. <<emacs-swiper-package>>
  872. <<emacs-desktop-package>>
  873. <<emacs-doom-themes-package>>
  874. <<emacs-doom-modeline-package>>
  875. ];
  876. };
  877. in {
  878. home.packages = [
  879. <<emacs-exwm-extras>>
  880. <<emacs-pass-extras>>
  881. <<emacs-mu4e-extras>>
  882. <<emacs-aspell-extras>>
  883. <<emacs-texlive-extras>>
  884. <<emacs-desktop-extras>>
  885. <<emacs-plantuml-extras>>
  886. <<emacs-nix-mode-extras>>
  887. <<emacs-doom-themes-extras>>
  888. ];
  889. programs.emacs = {
  890. enable = true;
  891. package = myEmacs;
  892. };
  893. <<emacs-exwm-config>>
  894. <<emacs-exwm-xinitrc>>
  895. <<emacs-mu4e-config>>
  896. }
  897. #+END_SRC
  898. When Emacs is started, it normally tries to load a Lisp program from an ititialization file, or /init/ file. This file, if it exists, specifies how to initialize and configure Emacs.
  899. #+BEGIN_SRC emacs-lisp :noweb yes :tangle ~/.config/emacs/init.el
  900. ;; <<file-warning>>
  901. ;; Required inputs.
  902. <<emacs-exwm-elisp>>
  903. <<emacs-evil-elisp>>
  904. <<emacs-general-elisp>>
  905. <<emacs-which-key-elisp>>
  906. ;; Optional inputs.
  907. <<emacs-org-elisp>>
  908. <<emacs-org-roam-elisp>>
  909. <<emacs-org-roam-ui-elisp>>
  910. <<emacs-org-drill-elisp>>
  911. <<emacs-org-agenda-elisp>>
  912. <<emacs-pomodoro-elisp>>
  913. <<emacs-writegood-elisp>>
  914. <<emacs-aspell-elisp>>
  915. <<emacs-eww-elisp>>
  916. <<emacs-http-elisp>>
  917. <<emacs-hugo-elisp>>
  918. <<emacs-pass-elisp>>
  919. <<emacs-docker-elisp>>
  920. <<emacs-erc-elisp>>
  921. <<emacs-mu4e-elisp>>
  922. <<emacs-dired-elisp>>
  923. <<emacs-icons-elisp>>
  924. <<emacs-emoji-elisp>>
  925. <<emacs-eshell-elisp>>
  926. <<emacs-vterm-elisp>>
  927. <<emacs-magit-elisp>>
  928. <<emacs-fonts-elisp>>
  929. <<emacs-frames-elisp>>
  930. <<emacs-elfeed-elisp>>
  931. <<emacs-projectile-elisp>>
  932. <<emacs-lsp-elisp>>
  933. <<emacs-company-elisp>>
  934. <<emacs-gdscript-elisp>>
  935. <<emacs-golang-elisp>>
  936. <<emacs-python-elisp>>
  937. <<emacs-rustic-elisp>>
  938. <<emacs-plantuml-elisp>>
  939. <<emacs-desktop-elisp>>
  940. ;; User interface.
  941. <<emacs-swiper-elisp>>
  942. <<emacs-transparency-elisp>>
  943. <<emacs-doom-themes-elisp>>
  944. <<emacs-doom-modeline-elisp>>
  945. #+END_SRC
  946. It's somtimes desirable to have customization that takes effect during Emacs startup earlier than the normal init file. Place these configurations in =~/.emacs.d/early-init.el=. Most customizations should be put in the normal init file =~/.emacs.d/init.el=.
  947. #+BEGIN_SRC emacs-lisp :noweb yes :tangle ~/.config/emacs/early-init.el
  948. ;; <<file-warning>>
  949. <<emacs-disable-ui-elisp>>
  950. <<emacs-native-comp-elisp>>
  951. <<emacs-backup-files-elisp>>
  952. <<emacs-shell-commands-elisp>>
  953. <<emacs-improved-prompts>>
  954. #+END_SRC
  955. ** Native Comp
  956. #+NAME: emacs-native-comp-package
  957. #+BEGIN_SRC nix
  958. pkgs.emacsNativeComp;
  959. #+END_SRC
  960. Native Comp, also known as GccEmacs, refers to the ~--with-native-compilation~ configuration option when building [[https://gnu.org/software/emacs/][GNU/Emacs]]. It adds support for compiling [[https://www.gnu.org/software/emacs/manual/html_node/elisp/index.html][Emacs Lisp]] to native code using ~libgccjit~. All of the Emacs Lisp packages shipped with Emacs are native-compiled, providing a noticable performance iomprovement out-of-the-box.
  961. #+NAME: emacs-native-comp-elisp
  962. #+BEGIN_SRC emacs-lisp
  963. ;; Silence warnings from packages that don't support `native-comp'.
  964. (setq comp-async-report-warnings-errors nil ;; Emacs 27.2 ...
  965. native-comp-async-report-warnings-errors nil) ;; Emacs 28+ ...
  966. #+END_SRC
  967. ** Disable UI
  968. [[https://gnu.org/software/emacs/][Emacs]] has been around since the 1980s, and it's painfully obvious when you're greeted with the default user interface. Disable some unwanted features to clean it up, and bring the appearance to something closer to a modern editor.
  969. #+NAME: emacs-disable-ui-elisp
  970. #+BEGIN_SRC emacs-lisp
  971. ;; Disable unwanted UI elements.
  972. (tooltip-mode -1)
  973. (menu-bar-mode -1)
  974. (tool-bar-mode -1)
  975. (scroll-bar-mode -1)
  976. ;; Fix the scrolling behaviour.
  977. (setq scroll-conservatively 101)
  978. ;; Fix mouse-wheel scrolling behaviour.
  979. (setq mouse-wheel-follow-mouse t
  980. mouse-wheel-progressive-speed t
  981. mouse-wheel-scroll-amount '(3 ((shift) . 3)))
  982. ;; Start in fullscreen/maximized.
  983. (add-to-list 'default-frame-alist '(fullscreen . maximized))
  984. #+END_SRC
  985. ** Backup Files
  986. [[https://gnu.org/software/emacs/][Emacs]] makes a backup for a file only the first time the file is saved from a buffer. No matter how many times the file is subsequently written to, the backup remains unchanged. For files managed by a version control system, backup files are redundant since the previous versions are already stored.
  987. #+NAME: emacs-backup-files-elisp
  988. #+BEGIN_SRC emacs-lisp
  989. ;; Disable unwanted features.
  990. (setq make-backup-files nil
  991. create-lockfiles nil)
  992. #+END_SRC
  993. ** Shell Commands
  994. Define some methods for interaction between [[https://gnu.org/software/emacs/][GNU/Emacs]], and the systems underyling shell:
  995. 1) Method to run an external process, launching any application on a new process without interference
  996. 2) Method to apply commands to the current call process, effecting the running instance
  997. #+NAME: emacs-shell-commands-elisp
  998. #+BEGIN_SRC emacs-lisp
  999. ;; Define a method to run an external process.
  1000. (defun dotfiles/run (cmd)
  1001. "Run an external process."
  1002. (interactive (list (read-shell-command "λ ")))
  1003. (start-process-shell-command cmd nil cmd))
  1004. ;; Define a method to run a background process.
  1005. (defun dotfiles/run-in-background (cmd)
  1006. (let ((command-parts (split-string cmd "[ ]+")))
  1007. (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))
  1008. #+END_SRC
  1009. ** Improved prompts
  1010. By default Emacs will ask you to enter 'Yes' or 'No' instead of 'Y' or 'N'. This is a relatively conservative design decision, based on the fact that certain prompts may be important enough to warrant typing three characters.
  1011. #+NAME: emacs-improved-prompts
  1012. #+BEGIN_SRC emacs-lisp
  1013. ;; Use 'y' and 'n' instead of 'yes' and 'no'.
  1014. (defalias 'yes-or-no-p 'y-or-n-p)
  1015. #+END_SRC
  1016. ** Nix Mode
  1017. #+NAME: emacs-nix-mode-extras
  1018. #+BEGIN_SRC nix
  1019. pkgs.nixfmt
  1020. pkgs.rnix-lsp
  1021. #+END_SRC
  1022. [[https://github.com/nixos/nix-mode][Nix Mode]] is an [[https://gnu.org/software/emacs/][Emacs]] major mode for editing [[https://nixos.org/manual/nix/stable/][Nix]] expressions. This provides basic handling of =.nix= files. Syntax highlighting and indentation support using =SMIE= are provided. [[https:github.com/nix-community/rnix-lsp][rnix-lsp]] is a work-in-progress language server for Nix with syntax checking and basic completion.
  1023. #+NAME: emacs-nix-mode-package
  1024. #+BEGIN_SRC nix
  1025. epkgs.nix-mode
  1026. #+END_SRC
  1027. ** Evil Mode
  1028. [[https://evil.readthedocs.io/en/latest/overview.html][Evil Mode]] is an extensible VI layer for [[https://gnu.org/software/emacs/][GNU/Emacs]]. It emulates the main features of [[https://neovim.io][Vim]], transforming GNU/Emacs into a modal editor.
  1029. #+NAME: emacs-evil-package
  1030. #+BEGIN_SRC nix
  1031. epkgs.evil
  1032. epkgs.evil-collection
  1033. epkgs.evil-surround
  1034. epkgs.evil-nerd-commenter
  1035. #+END_SRC
  1036. The next time [[https://gnu.org/software/emacs/][Emacs]] is started, it will come up in /normal state/, denoted by =<N>= in the modeline. This is where the main ~vi~ bindings are defined. Like Emacs in general, [[https://evil.readthedocs.io/en/latest/overview.html][Evil Mode]] is extensible in [[https://www.gnu.org/software/emacs/manual/html_node/elisp/index.html][Emacs Lisp]].
  1037. #+NAME: emacs-evil-elisp
  1038. #+BEGIN_SRC emacs-lisp
  1039. ;; Enable the Extensible VI Layer for Emacs.
  1040. (setq evil-want-integration t ;; Required for `evil-collection.'
  1041. evil-want-keybinding nil ;; Same as above.
  1042. evil-want-C-i-jump nil) ;; Disable jumping in terminal.
  1043. (evil-mode +1)
  1044. ;; Configure `evil-collection'.
  1045. (evil-collection-init)
  1046. ;; Configure `evil-surround'.
  1047. (global-evil-surround-mode +1)
  1048. ;; Configure `evil-nerd-commenter'.
  1049. (global-set-key (kbd "M-;") 'evilnc-comment-or-uncomment-lines)
  1050. ;; Invoke `org-cycle' in normal mode inside of `org-mode' buffers.
  1051. (evil-define-key 'normal 'org-mode-map (kbd "<tab>") #'org-cycle)
  1052. #+END_SRC
  1053. ** EXWM
  1054. #+NAME: emacs-exwm-package
  1055. #+BEGIN_SRC nix
  1056. epkgs.exwm
  1057. #+END_SRC
  1058. [[https://github.com/ch11ng/exwm][EXWM]] (Emacs X Window Manager) is a full-featured tiling [[https://x.org/wiki/][X11]] window manager for [[https://gnu.org/software/emacs/][GNU/Emacs]] built on-top of XELB. It features:
  1059. + Fully keyboard-driven operations
  1060. + Hybrid layout modes (tiling & stacking)
  1061. + Dynamic workspace support
  1062. + ICCM/EWMH compliance
  1063. #+NAME: emacs-exwm-extras
  1064. #+BEGIN_SRC nix
  1065. pkgs.nitrogen
  1066. pkgs.autorandr
  1067. #+END_SRC
  1068. I wanted to leave ~(exwm-enable)~ out of my Emacs configuration (which does no harm anyways). This can be called when using the daemon to start [[https://github.com/ch11ng/exwm][EXWM]].
  1069. #+NAME: emacs-exwm-config
  1070. #+BEGIN_SRC nix
  1071. xsession = {
  1072. enable = true;
  1073. windowManager.command = ''
  1074. ${pkgs.nitrogen}/bin/nitrogen --restore
  1075. ${myEmacs}/bin/emacs --daemon -f exwm-enable
  1076. ${myEmacs}/bin/emacsclient -c
  1077. '';
  1078. };
  1079. #+END_SRC
  1080. [[https://github.com/ch11ng/exwm][EXWM]] cannot make an [[https://x.org/wiki/][X]] window manager by itself, this is by design; You must tell X to do it. Override the =~/.xinitrc= file to start the =xsession=.
  1081. #+NAME: emacs-exwm-xinitrc
  1082. #+BEGIN_SRC nix
  1083. home.file.".xinitrc" = {
  1084. text = ''
  1085. exec ./.xsession
  1086. '';
  1087. };
  1088. #+END_SRC
  1089. #+NAME: emacs-exwm-elisp
  1090. #+BEGIN_SRC emacs-lisp
  1091. ;; Configure `exwm'.
  1092. (setq exwm-workspace-number 5
  1093. exwm-layout-show-all-buffers t
  1094. exwm-worspace-show-all-buffers t)
  1095. ;; Configure input keys.
  1096. (setq exwm-input-prefix-keys
  1097. '(?\M-x
  1098. ?\C-g
  1099. ?\C-\ ))
  1100. (setq exwm-input-global-keys
  1101. `(([?\s-r] . exwm-reset)
  1102. ,@(mapcar (lambda (i)
  1103. `(,(kbd (format "s-%d" i)) .
  1104. (lambda ()
  1105. (interactive)
  1106. (exwm-workspace-switch-create ,i))))
  1107. (number-sequence 0 9))))
  1108. ;; Configure `exwm-randr'.
  1109. (require 'exwm-randr)
  1110. (exwm-randr-enable)
  1111. ;; Configure custom hooks.
  1112. (setq display-time-day-and-date t)
  1113. (add-hook 'exwm-init-hook
  1114. (lambda ()
  1115. (display-battery-mode +1) ;; Display battery info (if available).
  1116. (display-time-mode +1))) ;; Display the time in the modeline.
  1117. ;; Setup buffer display names.
  1118. (add-hook 'exwm-update-class-hook
  1119. (lambda ()
  1120. (exwm-workspace-rename-buffer exwm-class-name))) ;; Use the system class name.
  1121. ;; Configure monitor hot-swapping.
  1122. (add-hook 'exwm-randr-screen-change-hook
  1123. (lambda ()
  1124. (dotfiles/run-in-background "autorandr --change --force"))) ;; Swap to the next screen config.
  1125. #+END_SRC
  1126. ** General
  1127. #+NAME: emacs-general-package
  1128. #+BEGIN_SRC nix
  1129. epkgs.general
  1130. #+END_SRC
  1131. [[https://github.com/noctuid/general.el][General.el]] provides a more convenient method for binding keys in [[https://gnu.org/software/emacs/][Emacs]], providing a unified interface for key definitions. Its primary purpose is to build on /existing/ functionality to make key definitions more clear and concise.
  1132. #+NAME: emacs-general-elisp
  1133. #+BEGIN_SRC emacs-lisp
  1134. ;; Use <SPC> as a leader key via `general.el'.
  1135. (general-create-definer dotfiles/leader
  1136. :keymaps '(normal insert visual emacs)
  1137. :prefix "SPC"
  1138. :global-prefix "C-SPC")
  1139. ;; Setup general to work with `evil-mode'.
  1140. (setq general-evil-setup t)
  1141. ;; Find files with <SPC> <period> ...
  1142. ;; Switch buffers with <SPC> <comma> ...
  1143. (dotfiles/leader
  1144. "." '(find-file :which-key "File")
  1145. "," '(switch-to-buffer :which-key "Buffer")
  1146. "k" '(kill-buffer :which-key "Kill")
  1147. "c" '(kill-buffer-and-window :which-key "Close"))
  1148. ;; Add keybindings for executing shell commands.
  1149. (dotfiles/leader
  1150. "r" '(:ignore t :which-key "Run")
  1151. "rr" '(dotfiles/run :which-key "Run")
  1152. "ra" '(async-shell-command :which-key "Async"))
  1153. ;; Add keybindings for quitting Emacs.
  1154. (dotfiles/leader
  1155. "q" '(:ignore t :which-key "Quit")
  1156. "qq" '(save-buffers-kill-emacs :which-key "Save")
  1157. "qw" '(kill-emacs :which-key "Now")
  1158. "qf" '(delete-frame :which-key "Frame"))
  1159. ;; Add keybindings for toggles / tweaks.
  1160. (dotfiles/leader
  1161. "t" '(:ignore t :which-key "Toggle / Tweak"))
  1162. #+END_SRC
  1163. ** Which Key
  1164. [[https://github.com/justbur/emacs-which-key][Which Key]] is an [[https://gnu.org/software/emacs/][Emacs]] minor mode that displays the key bindings following your currently entered incomplete command (prefix) in a popup or mini-buffer.
  1165. #+NAME: emacs-which-key-package
  1166. #+BEGIN_SRC nix
  1167. epkgs.which-key
  1168. #+END_SRC
  1169. #+NAME: emacs-which-key-elisp
  1170. #+BEGIN_SRC emacs-lisp
  1171. ;; Configure `which-key' to see keyboard bindings in the
  1172. ;; mini-buffer and when using M-x.
  1173. (setq which-key-idle-delay 0.0)
  1174. (which-key-mode +1)
  1175. #+END_SRC
  1176. ** EWW
  1177. [[https://emacswiki.org/emacs/eww][Emacs Web Wowser (EWW)]] is a Web browser written in [[https://www.gnu.org/software/emacs/manual/html_node/elisp/index.html][Emacs Lisp]] based on the ~shr.el~ library. It's my primary browser when it comes to text-based browsing.
  1178. + Use ~eww~ as the default browser
  1179. + Don't use any special fonts or colours
  1180. #+NAME: emacs-eww-elisp
  1181. #+BEGIN_SRC emacs-lisp
  1182. ;; Set `eww' as the default browser.
  1183. (setq browse-url-browser-function 'eww-browse-url)
  1184. ;; Configure the `shr' rendering engine.
  1185. (setq shr-use-fonts nil
  1186. shr-use-colors nil)
  1187. #+END_SRC
  1188. ** ERC
  1189. [[https://gnu.org/software/emacs/erc.html][ERC]] is a powerful, modular, and extensible IRC client for [[https://gnu.org/software/emacs/][GNU/Emacs]]. It's part of the GNU project, and included in Emacs.
  1190. #+NAME: emacs-erc-elisp
  1191. #+BEGIN_SRC emacs-lisp
  1192. ;; Configure `erc'.
  1193. (setq erc-autojoin-channels-alist '(("irc.libera.chat" "#emacs" "#nixos" "#org-mode" "#systemcrafters"))
  1194. erc-track-exclude-types '("JOIN" "NICK" "QUIT" "MODE")
  1195. erc-lurker-hide-list '("JOIN" "PART" "QUIT"))
  1196. ;; Configure `erc-fill-column'.
  1197. (add-hook 'window-configuration-change-hook
  1198. '(lambda ()
  1199. (setq erc-fill-column (- (window-width) 12))))
  1200. ;; Connect to IRC via `erc'.
  1201. (defun dotfiles/erc-connect ()
  1202. "Connected to IRC via `erc'."
  1203. (interactive)
  1204. (erc-tls :server "irc.libera.chat"
  1205. :port 6697
  1206. :nick "megaphone"
  1207. :password (password-store-get "libera.chat/megaphone")
  1208. :full-name "Chris Hayward"))
  1209. ;; Configure keybindings.
  1210. (dotfiles/leader
  1211. "i" '(dotfiles/erc-connect :which-key "Chat"))
  1212. #+END_SRC
  1213. ** Dired
  1214. #+NAME: emacs-dired-package
  1215. #+BEGIN_SRC nix
  1216. epkgs.dired-single
  1217. #+END_SRC
  1218. [[https://emacswiki.org/emacs/DiredMode][Dired Mode]] shows a directory listing inside of an [[https://gnu.org/software/emacs/][Emacs]] buffer that can be used to perform various file operations on files and subdirectories. The operations you can perform are numerous, from creating subdirectories, byte-compiling files, searching, and editing files. [[https://emacswiki.org/emacs/DiredExtra#Dired_X][Dired Extra]] provides extra functionality.
  1219. #+NAME: emacs-dired-elisp
  1220. #+BEGIN_SRC emacs-lisp
  1221. ;; Include `dired-x' for the `jump' method.
  1222. (require 'dired-x)
  1223. ;; Configure `dired-single' to support `evil' keys.
  1224. (evil-collection-define-key 'normal 'dired-mode-map
  1225. "h" 'dired-single-up-directory
  1226. "l" 'dired-single-buffer)
  1227. ;; Configure keybindings for `dired'.
  1228. (dotfiles/leader
  1229. "d" '(dired-jump :which-key "Dired"))
  1230. #+END_SRC
  1231. ** Icons
  1232. #+NAME: emacs-icons-package
  1233. #+BEGIN_SRC nix
  1234. epkgs.all-the-icons
  1235. epkgs.all-the-icons-dired
  1236. epkgs.all-the-icons-ivy-rich
  1237. #+END_SRC
  1238. [[https://github.com/domtronn/all-the-icons.el][All The Icons]] is a utility package to collect various Icon Fonts and prioritize them within [[https://gnu.org/software/emacs/][GNU/Emacs]].
  1239. #+NAME: emacs-icons-elisp
  1240. #+BEGIN_SRC emacs-lisp
  1241. ;; Setup `all-the-icons-dired'.
  1242. (add-hook 'dired-mode-hook 'all-the-icons-dired-mode)
  1243. ;; Disable monochrome icons.
  1244. (setq all-the-icons-dired-monochrome nil)
  1245. ;; Display default font ligatures.
  1246. (global-prettify-symbols-mode +1)
  1247. #+END_SRC
  1248. ** Emojis
  1249. #+NAME: emacs-emoji-package
  1250. #+BEGIN_SRC nix
  1251. epkgs.emojify
  1252. #+END_SRC
  1253. [[https://github.com/iqbalansari/emacs-emojify][Emojify]] is an [[https://gnu.org/software/emacs/][Emacs]] extension to display Emojis. It can display GitHub style Emojis like :smile: or plain ascii ones such as :). It tries to be as efficient as possible, while also providing flexibility.
  1254. #+NAME: emacs-emoji-elisp
  1255. #+BEGIN_SRC emacs-lisp
  1256. ;; Setup `emojify'.
  1257. (add-hook 'after-init-hook 'global-emojify-mode)
  1258. #+END_SRC
  1259. ** EShell
  1260. #+NAME: emacs-eshell-package
  1261. #+BEGIN_SRC nix
  1262. epkgs.eshell-prompt-extras
  1263. #+END_SRC
  1264. [[https://gnu.org/software/emacs/manual/html_mono/eshell.html][EShell]] is a shell-like command interpreter for [[https://gnu.org/software/emacs/][GNU/Emacs]] implemented in [[https://www.gnu.org/software/emacs/manual/html_node/elisp/index.html][Emacs Lisp]]. It invokes no external processes except for those requested by the user. It's intended to be an alternative for IELM, and a full REPL envionment for Emacs.
  1265. #+NAME: emacs-eshell-elisp
  1266. #+BEGIN_SRC emacs-lisp
  1267. ;; Configure `eshell'.
  1268. (setq eshell-highlight-prompt nil
  1269. eshell-prefer-lisp-functions nil)
  1270. ;; Configure the lambda prompt.
  1271. (autoload 'epe-theme-lambda "eshell-prompt-extras")
  1272. (setq eshell-prompt-function 'epe-theme-lambda)
  1273. ;; Configure keybindings for `eshell'.
  1274. (dotfiles/leader
  1275. "e" '(eshell :which-key "EShell"))
  1276. #+END_SRC
  1277. ** VTerm
  1278. [[https://github.com/akermu/emacs-libvterm][Emacs Libvterm (VTerm)]] is a fully-fledged terminal emulator inside [[https://gnu.org/software/emacs/][GNU/Emacs]] based on [[https://github.com/neovim/libvterm][Libvterm]], a blazing fast C library used in [[https://neovim.io][Neovim]]. As a result of using compiled code (instead of [[https://www.gnu.org/software/emacs/manual/html_node/elisp/index.html][Emacs Lisp]]), VTerm is capable, fast, and it can seamlessly handle large outputs.
  1279. #+NAME: emacs-vterm-package
  1280. #+BEGIN_SRC nix
  1281. epkgs.vterm
  1282. #+END_SRC
  1283. #+NAME: emacs-vterm-elisp
  1284. #+BEGIN_SRC emacs-lisp
  1285. ;; Add keybindings for interacting with the shell(s).
  1286. (dotfiles/leader
  1287. "v" '(vterm :which-key "VTerm"))
  1288. #+END_SRC
  1289. ** Magit
  1290. [[https://magit.vc][Magit]] is an interface to the [[https://git-scm.com][Git]] version control system, implemented as a [[https://gnu.org/software/emacs/][GNU/Emacs]] package written in [[https://www.gnu.org/software/emacs/manual/html_node/elisp/index.html][Emacs Lisp]]. It fills the glaring gap between the Git command line interface and various GUIs, letting you perform trivial as well as elaborate version control tasks within a few mnemonic key presses.
  1291. #+NAME: emacs-magit-package
  1292. #+BEGIN_SRC nix
  1293. epkgs.magit
  1294. #+END_SRC
  1295. #+NAME: emacs-magit-elisp
  1296. #+BEGIN_SRC emacs-lisp
  1297. ;; Add keybindings for working with `magit'.
  1298. (dotfiles/leader
  1299. "g" '(:ignore t :which-key "Git")
  1300. "gg" '(magit-status :which-key "Status")
  1301. "gc" '(magit-clone :which-key "Clone")
  1302. "gf" '(magit-fetch :which-key "Fetch")
  1303. "gp" '(magit-pull :which-key "Pull"))
  1304. #+END_SRC
  1305. ** Hydra
  1306. #+NAME: emacs-hydra-package
  1307. #+BEGIN_SRC nix
  1308. epkgs.hydra
  1309. #+END_SRC
  1310. [[https://github.com/abo-abo/hydra][Hydra]] allows you to create keymaps for related commands, with the ability to easily repeat commands using a single keystroke.
  1311. ** Fonts
  1312. [[https://typeof.net/Iosevka][Iosevka]] is an open-source, sans-serif + slab-serif, monospace + quasi-proportional typeface family, designed for writing code, using in terminals, and preparing technical documents. Configure it as the default font face inside of [[https://gnu.org/software/emacs/][Emacs]] and define a [[https://github.com/abo-abo/hydra][Hydra]] command for quickly scaling text.
  1313. #+NAME: emacs-fonts-elisp
  1314. #+BEGIN_SRC emacs-lisp
  1315. ;; Configure the font when running as `emacs-server'.
  1316. (custom-set-faces
  1317. '(default ((t (:inherit nil :height 120 :family "Iosevka")))))
  1318. ;; Define a `hydra' function for scaling the text interactively.
  1319. (defhydra hydra-text-scale (:timeout 4)
  1320. "Scale the text in the current buffer."
  1321. ("k" text-scale-decrease "Decrease")
  1322. ("j" text-scale-increase "Increase")
  1323. ("f" nil "Finished" :exit t))
  1324. ;; Create keybinding for calling the function.
  1325. (dotfiles/leader
  1326. "tf" '(hydra-text-scale/body :which-key "Font"))
  1327. #+END_SRC
  1328. ** Frames
  1329. Sometimes it's useful to resize the current frame without using the mouse (always). The default behaviour when calling ~shrink-window~ and ~enlarge-window~ only changes the size by a small margin. I solved this problem with the same method used for scaling text:
  1330. #+NAME: emacs-frames-elisp
  1331. #+BEGIN_SRC emacs-lisp
  1332. ;; Define a `hydra' function for resizing the current frame.
  1333. (defhydra hydra-resize-frame (:timeout 4)
  1334. "Scale the current frame."
  1335. ("h" shrink-window-horizontally "Left")
  1336. ("j" enlarge-window "Down")
  1337. ("k" shrink-window "Up")
  1338. ("l" enlarge-window-horizontally "Right")
  1339. ("f" nil "Finished" :exit t))
  1340. ;; Add keybindings for working with frames to replace
  1341. ;; the C-x <num> <num> method of bindings, which is awful.
  1342. (dotfiles/leader
  1343. "w" '(:ignore t :which-key "Windows")
  1344. "ww" '(window-swap-states :which-key "Swap")
  1345. "wc" '(delete-window :which-key "Close")
  1346. "wh" '(windmove-left :which-key "Left")
  1347. "wj" '(windmove-down :which-key "Down")
  1348. "wk" '(windmove-up :which-key "Up")
  1349. "wl" '(windmove-right :which-key "Right")
  1350. "ws" '(:ignore t :which-key "Split")
  1351. "wsj" '(split-window-below :which-key "Below")
  1352. "wsl" '(split-window-right :which-key "Right")
  1353. "wr" '(hydra-resize-frame/body :which-key "Resize"))
  1354. #+END_SRC
  1355. ** Elfeed
  1356. #+NAME: emacs-elfeed-package
  1357. #+BEGIN_SRC nix
  1358. epkgs.elfeed
  1359. #+END_SRC
  1360. [[https://github.com/skeeto/elfeed][Elfeed]] is an extensible web feed reader for [[https://gnu.org/software/emacs/][GNU/Emacs]], support both =Atom= and =RSS=. It requires =Emacs 24.3+= and is available for download from the standard repositories.
  1361. #+NAME: emacs-elfeed-elisp
  1362. #+BEGIN_SRC emacs-lisp
  1363. ;; Configure `elfeed'.
  1364. (setq elfeed-db-directory (expand-file-name "~/.cache/elfeed"))
  1365. ;; Add custom feeds for `elfeed' to fetch.
  1366. (setq elfeed-feeds (quote
  1367. (("https://hexdsl.co.uk/rss.xml")
  1368. ("https://lukesmith.xyz/rss.xml")
  1369. ("https://friendo.monster/rss.xml")
  1370. ("https://chrishayward.xyz/index.xml")
  1371. ("https://protesilaos.com/master.xml"))))
  1372. ;; Add custom keybindings for `elfeed'.
  1373. (dotfiles/leader
  1374. "f" '(:ignore t :which-key "Elfeed")
  1375. "fl" '(elfeed :which-key "Open")
  1376. "fu" '(elfeed-update :which-key "Update"))
  1377. #+END_SRC
  1378. ** Org Mode
  1379. #+NAME: emacs-org-package
  1380. #+BEGIN_SRC nix
  1381. epkgs.org
  1382. #+END_SRC
  1383. [[https://orgmode.org][Org Mode]] is a document editing and organizing mode, designed for notes, planning, and authoring within the free software text editor [[https://gnu.org/software/emacs/][GNU/Emacs]]. The name is used to encompass plain text files (such as this one) that include simple marks to indicate levels of a hierarchy, and an editor with functions that can read the markup and manipulate the hierarchy elements.
  1384. #+NAME: emacs-org-elisp
  1385. #+BEGIN_SRC emacs-lisp
  1386. ;; Configure `org-mode' source blocks.
  1387. (setq org-src-fontify-natively t ;; Make source blocks prettier.
  1388. org-src-tab-acts-natively t ;; Use TAB indents within source blocks.
  1389. org-hide-emphasis-markers t ;; Don't show emphasis markup.
  1390. org-src-preserve-indentation t ;; Stop `org-mode' from formatting blocks.
  1391. org-confirm-babel-evaluate nil) ;; Don't ask for confirmation to evaluate blocks.
  1392. ;; Add an `org-mode-hook'.
  1393. (add-hook 'org-mode-hook
  1394. (lambda ()
  1395. (org-indent-mode)
  1396. (visual-line-mode)))
  1397. ;; Remove the `Validate XHTML 1.0' message from HTML export.
  1398. (setq org-export-html-validation-link nil
  1399. org-html-validation-link nil)
  1400. ;; Configure the keywords in the TODO -> DONE sequence.
  1401. (setq org-todo-keywords '((sequence "TODO" "START" "WAIT" "DONE")))
  1402. ;; Track ids globally.
  1403. (setq org-id-track-globally t)
  1404. ;; Configure `org-babel' languages.
  1405. (org-babel-do-load-languages
  1406. 'org-babel-load-languages
  1407. '((C . t)))
  1408. ;; Log / Clock into property drawers.
  1409. (setq org-log-into-drawer t
  1410. org-clock-into-drawer t)
  1411. ;; Encrypt files with the public key.
  1412. (setq epa-file-select-keys 2
  1413. epa-file-encrypt-to "37AB1CB72B741E478CA026D43025DCBD46F81C0F"
  1414. epa-cache-passphrase-for-symmetric-encryption t)
  1415. ;; TODO: Configure default structure templates.
  1416. ;; (require 'org-tempo)
  1417. ;; Apply custom keybindings.
  1418. (dotfiles/leader
  1419. "o" '(:ignore t :which-key "Org")
  1420. "oe" '(org-export-dispatch :which-key "Export")
  1421. "ot" '(org-babel-tangle :which-key "Tangle")
  1422. "oi" '(org-toggle-inline-images :which-key "Images")
  1423. "of" '(:ignore t :which-key "Footnotes")
  1424. "ofn" '(org-footnote-normalize :which-key "Normalize"))
  1425. #+END_SRC
  1426. ** Org Roam
  1427. #+NAME: emacs-org-roam-package
  1428. #+BEGIN_SRC nix
  1429. epkgs.org-roam
  1430. #+END_SRC
  1431. [[https://github.com/org-roam/org-roam][Org Roam]] is a plain-text knowledge management system. It borrows principles from the [[https://zettelkasten.de][Zettelkasten]] method, providing a solution for non-hierarchical note-taking. It should also work as a plug-and-play solution for anyone already using [[https://orgmode.org][Org Mode]] for their personal wiki.
  1432. #+NAME: emacs-org-roam-elisp
  1433. #+BEGIN_SRC emacs-lisp
  1434. ;; Setup `org-roam'.
  1435. (require 'org-roam)
  1436. ;; Silence the migration warnings.
  1437. (setq org-roam-v2-ack t)
  1438. ;; Enable `visual-line-mode' in `org-roam' buffer.
  1439. (add-hook 'org-roam-mode-hook
  1440. (lambda ()
  1441. (visual-line-mode +1)))
  1442. ;; Enable completion everywhere.
  1443. (setq org-roam-completion-everywhere t)
  1444. ;; Set the roam directories.
  1445. (setq org-roam-directory (expand-file-name "/etc/dotfiles")
  1446. org-roam-dailies-directory (concat org-roam-directory "/docs/daily"))
  1447. ;; Clear the deafult capture templates.
  1448. (setq org-roam-capture-templates '()
  1449. org-roam-dailies-capture-templates '())
  1450. ;; Override the default slug method.
  1451. (cl-defmethod org-roam-node-slug ((node org-roam-node))
  1452. (let ((title (org-roam-node-title node))
  1453. (slug-trim-chars '(768 ; U+0300 COMBINING GRAVE ACCENT
  1454. 769 ; U+0301 COMBINING ACUTE ACCENT
  1455. 770 ; U+0302 COMBINING CIRCUMFLEX ACCENT
  1456. 771 ; U+0303 COMBINING TILDE
  1457. 772 ; U+0304 COMBINING MACRON
  1458. 774 ; U+0306 COMBINING BREVE
  1459. 775 ; U+0307 COMBINING DOT ABOVE
  1460. 776 ; U+0308 COMBINING DIAERESIS
  1461. 777 ; U+0309 COMBINING HOOK ABOVE
  1462. 778 ; U+030A COMBINING RING ABOVE
  1463. 780 ; U+030C COMBINING CARON
  1464. 795 ; U+031B COMBINING HORN
  1465. 803 ; U+0323 COMBINING DOT BELOW
  1466. 804 ; U+0324 COMBINING DIAERESIS BELOW
  1467. 805 ; U+0325 COMBINING RING BELOW
  1468. 807 ; U+0327 COMBINING CEDILLA
  1469. 813 ; U+032D COMBINING CIRCUMFLEX ACCENT BELOW
  1470. 814 ; U+032E COMBINING BREVE BELOW
  1471. 816 ; U+0330 COMBINING TILDE BELOW
  1472. 817 ; U+0331 COMBINING MACRON BELOW
  1473. )))
  1474. (cl-flet* ((nonspacing-mark-p (char)
  1475. (memq char slug-trim-chars))
  1476. (strip-nonspacing-marks (s)
  1477. (ucs-normalize-NFC-string
  1478. (apply #'string (seq-remove #'nonspacing-mark-p
  1479. (ucs-normalize-NFD-string s)))))
  1480. (cl-replace (title pair)
  1481. (replace-regexp-in-string (car pair) (cdr pair) title)))
  1482. (let* ((pairs `(("[^[:alnum:][:digit:]]" . "-")
  1483. ("--*" . "-")
  1484. ("^-" . "")
  1485. ("-$" . "")))
  1486. (slug (-reduce-from #'cl-replace (strip-nonspacing-marks title) pairs)))
  1487. (downcase slug)))))
  1488. ;; Configure capture templates.
  1489. ;; Standard document.
  1490. (add-to-list 'org-roam-capture-templates
  1491. '("d" "Default" plain "%?"
  1492. :target (file+head "docs/%<%Y%m%d%H%M%S>-${slug}.org.gpg"
  1493. "
  1494. ,#+TITLE: ${title}
  1495. ,#+AUTHOR: Christopher James Hayward
  1496. ,#+EMAIL: chris@chrishayward.xyz
  1497. "
  1498. )
  1499. :unnarrowed t))
  1500. ;; Daily notes.
  1501. (add-to-list 'org-roam-dailies-capture-templates
  1502. '("d" "Default" entry "* %?"
  1503. :target (file+head "%<%Y-%m-%d>.org.gpg"
  1504. "
  1505. ,#+TITLE: %<%Y-%m-%d>
  1506. ,#+AUTHOR: Christopher James Hayward
  1507. ,#+EMAIL: chris@chrishayward.xyz
  1508. ")))
  1509. ;; Apply custom keybindings.
  1510. (dotfiles/leader
  1511. "or" '(:ignore t :which-key "Roam")
  1512. "ori" '(org-roam-node-insert :which-key "Insert")
  1513. "orf" '(org-roam-node-find :which-key "Find")
  1514. "orc" '(org-roam-capture :which-key "Capture")
  1515. "orb" '(org-roam-buffer-toggle :which-key "Buffer"))
  1516. ;; Apply custom keybindings for dailies.
  1517. (dotfiles/leader
  1518. "ord" '(:ignore t :which-key "Dailies")
  1519. "ordd" '(org-roam-dailies-goto-date :which-key "Date")
  1520. "ordt" '(org-roam-dailies-goto-today :which-key "Today")
  1521. "ordm" '(org-roam-dailies-goto-tomorrow :which-key "Tomorrow")
  1522. "ordy" '(org-roam-dailies-goto-yesterday :which-key "Yesterday"))
  1523. ;; Run the setup command.
  1524. (org-roam-setup)
  1525. #+END_SRC
  1526. ** Org Roam UI
  1527. #+NAME: emacs-org-roam-ui-package
  1528. #+BEGIN_SRC nix
  1529. epkgs.org-roam-ui
  1530. epkgs.websocket
  1531. epkgs.simple-httpd
  1532. #+END_SRC
  1533. [[https://github.com/org-roam/org-roam-ui][Org Roam UI]] is a graphical frontend for exploring your [[https://github.com/org-roam/org-roam][Org Roam]] [[https://zettelkasten.de][Zettelkasten]]. It's meant as a successor to [[https://github.com/org-roam/org-roam-server][Org Roam Server]] that extends functionality of Org Roam with a web application that runs side-by-side with [[https://gnu.org/software/emacs/][Emacs]].
  1534. #+NAME: emacs-org-roam-ui-elisp
  1535. #+BEGIN_SRC emacs-lisp
  1536. ;; HACK: Set up `org-roam-ui'.
  1537. ;; (add-to-list 'load-path "~/.local/source/org-roam-ui")
  1538. (load-library "org-roam-ui")
  1539. ;; Configure `org-roam-ui'.
  1540. (setq org-roam-ui-follow t
  1541. org-roam-ui-sync-theme t
  1542. org-roam-ui-open-on-start t
  1543. org-roam-ui-update-on-save t
  1544. org-roam-ui-browser-function #'browse-url-firefox)
  1545. ;; Configure keybindings.
  1546. (dotfiles/leader
  1547. "oru" '(:ignore t :which-key "UI")
  1548. "oruu" '(org-roam-ui-mode :which-key "Toggle UI")
  1549. "orut" '(org-roam-ui-sync-theme :which-key "Sync Theme"))
  1550. #+END_SRC
  1551. ** Org Drill
  1552. #+NAME: emacs-org-drill-package
  1553. #+BEGIN_SRC nix
  1554. epkgs.org-drill
  1555. #+END_SRC
  1556. [[https://orgmode.org/worg/org-contrib/org-drill.html][Org Drill]] is an extension for [[https://orgmode.org][Org Mode]] that uses a spaced repition algorithm to conduct interactive /Drill Sessions/ using Org files as sources of facts to be memorized.
  1557. #+NAME: emacs-org-drill-elisp
  1558. #+BEGIN_SRC emacs-lisp
  1559. ;; Exclude :drill: items from `org-roam'.
  1560. (setq org-roam-db-node-include-function
  1561. (defun dotfiles/org-roam-include ()
  1562. (not (member "drill" (org-get-tags)))))
  1563. ;; Configure keybindings for `org-drill'.
  1564. (dotfiles/leader
  1565. "od" '(:ignore t :which-key "Drill")
  1566. "odd" '(org-drill :which-key "Drill")
  1567. "odc" '(org-drill-cram :which-key "Cram")
  1568. "odr" '(org-drill-resume :which-key "Resume"))
  1569. #+END_SRC
  1570. ** Org Agenda
  1571. The way [[https://orgmode.org][Org Mode]] works, TODO items, time-stamped items, and tagged headlines can be scattered throughout a file, or even a number of files. To get an overview of open action items, or of events that are important for a particular date, this information must be collected, sorted, and displayed in an organized way.
  1572. #+NAME: emacs-org-agenda-elisp
  1573. #+BEGIN_SRC emacs-lisp
  1574. ;; Configure `org-agenda' to use the project files.
  1575. (setq org-agenda-files '("/etc/dotfiles/"
  1576. "/etc/dotfiles/docs/"
  1577. "/etc/dotfiles/docs/daily/"))
  1578. ;; Include files encrypted with `gpg'.
  1579. (require 'org)
  1580. (unless (string-match-p "\\.gpg" org-agenda-file-regexp)
  1581. (setq org-agenda-file-regexp
  1582. (replace-regexp-in-string "\\\\\\.org" "\\\\.org\\\\(\\\\.gpg\\\\)?"
  1583. org-agenda-file-regexp)))
  1584. ;; Open an agenda buffer with SPC o a.
  1585. (dotfiles/leader
  1586. "oa" '(org-agenda :which-key "Agenda"))
  1587. #+END_SRC
  1588. ** Org Pomodoro
  1589. #+NAME: emacs-pomodoro-package
  1590. #+BEGIN_SRC nix
  1591. epkgs.org-pomodoro
  1592. #+END_SRC
  1593. [[https://github.com/marcinkoziej/org-pomodoro][Org Pomodoro]] adds basic support for the [[https://en.wikipedia.org/wiki/Pomodoro_Technique][Pomodoro Technique]] in [[https://gnu.org/software/emacs/][GNU/Emacs]]. It can be started for the task at point, or the last task time was clocked for. Each session starts a timer of 25 minutes, finishing with a break of 5 minutes. After 4 sessions, ther will be a break of 20 minutes. All values are customizable.
  1594. #+NAME: emacs-pomodoro-elisp
  1595. #+BEGIN_SRC emacs-lisp
  1596. ;; Configure `org-pomodor' with the overtime workflow.
  1597. (setq org-pomodoro-manual-break t
  1598. org-pomodoro-keep-killed-time t)
  1599. ;; Configure keybindings.
  1600. (dotfiles/leader
  1601. "op" '(org-pomodoro :which-key "Pomodoro"))
  1602. #+END_SRC
  1603. ** Writegood Mode
  1604. #+NAME: emacs-writegood-package
  1605. #+BEGIN_SRC nix
  1606. epkgs.writegood-mode
  1607. #+END_SRC
  1608. [[https://github.com/bnbeckwith/writegood-mode][Writegood Mode]] is an [[https://gnu.org/software/emacs/][Emacs]] minor mode to aid in finding common writing problems. It highlights the text based on the following criteria:
  1609. + Weasel Words
  1610. + Passive Voice
  1611. + Duplicate Words
  1612. #+NAME: emacs-writegood-elisp
  1613. #+BEGIN_SRC emacs-lisp
  1614. ;; Configure `writegood-mode'.
  1615. (dotfiles/leader
  1616. "tg" '(writegood-mode :which-key "Grammar"))
  1617. #+END_SRC
  1618. ** Aspell
  1619. #+NAME: emacs-aspell-extras
  1620. #+BEGIN_SRC nix
  1621. pkgs.aspell
  1622. pkgs.aspellDicts.en
  1623. pkgs.aspellDicts.en-science
  1624. pkgs.aspellDicts.en-computers
  1625. #+END_SRC
  1626. [[https://aspell.net][GNU Aspell]] is a Free and Open Source spell checker designed to replace ISpell. It can be used as a library, or an independent spell checker. Its main feature is that it does a superior job of suggesting possible replacements for mis-spelled words than any other spell checker for the English language.
  1627. #+NAME: emacs-aspell-elisp
  1628. #+BEGIN_SRC emacs-lisp
  1629. ;; Use `aspell' as a drop-in replacement for `ispell'.
  1630. (setq ispell-program-name "aspell"
  1631. ispell-eextra-args '("--sug-mode=fast"))
  1632. ;; Configure the built-in `flyspell-mode'.
  1633. (dotfiles/leader
  1634. "ts" '(flyspell-mode :which-key "Spelling"))
  1635. #+END_SRC
  1636. ** TexLive
  1637. [[https://wikipedia.org/wiki/Tex_Live][TeX Live]] is a free software distributution for the TeX typesetting system that includes major TeX-related programs, macro packages, and fonts. Since TeX Live consists of /thousands/ of packages, to make managing it easier, NixOS replicates the organization of Tex Live into /schemes/ and /collections/:
  1638. | Name | Derivation | Comment |
  1639. |---------+---------------------------------+------------------------------------------------------------|
  1640. | Full | texlive.combined.scheme-full | Contains every TeX Live package |
  1641. | Medium | texlive.combined.scheme-medium | Contains everything in small + more packages and languages |
  1642. | Small | texlive.combined.scheme-small | Contains everything in basic + xetex + metapost |
  1643. | Basic | texlive.combined.scheme-basic | Contains everything in the plain scheme but includes latex |
  1644. | Minimal | texlive.combined.scheme-minimal | Contains plain only |
  1645. #+NAME: emacs-texlive-extras
  1646. #+BEGIN_SRC nix
  1647. # pkgs.texlive.combined.scheme-full
  1648. #+END_SRC
  1649. ** Http
  1650. #+NAME: emacs-http-package
  1651. #+BEGIN_SRC nix
  1652. epkgs.ob-http
  1653. #+END_SRC
  1654. It's possible to make HTTP requests from Org Mode buffers using [[https://github.com/zweifisch/ob-http][ob-http]], this relies on Org Babel (included with [[https://orgmode.org][Org Mode]]) being present and configured properly.
  1655. #+NAME: emacs-http-elisp
  1656. #+BEGIN_SRC emacs-lisp
  1657. ;; Required to setup `ob-http'.
  1658. (org-babel-do-load-languages
  1659. 'org-babel-load-languages
  1660. '((http . t)))
  1661. #+END_SRC
  1662. ** Hugo
  1663. #+NAME: emacs-hugo-package
  1664. #+BEGIN_SRC nix
  1665. epkgs.ox-hugo
  1666. #+END_SRC
  1667. [[https://oxhugo.scripter.co][Ox Hugo]] is an [[https://orgmode.org][Org Mode]] exporter for [[https://gohugo.io][Hugo]] compabile markdown. My dotfiles are a result of this, and are available to view here https://chrishayward.xyz/dotfiles/.
  1668. #+NAME: emacs-hugo-elisp
  1669. #+BEGIN_SRC emacs-lisp
  1670. ;; Configure `ox-hugo' as an `org-mode-export' backend.
  1671. (require 'ox-hugo)
  1672. ;; Set up the base directory.
  1673. (setq org-hugo-base-dir (expand-file-name "/etc/dotfiles/docs"))
  1674. ;; Capture templates.
  1675. ;; Shared content
  1676. ;; (add-to-list 'org-roam-capture-templates
  1677. ;; '("p" "Post" plain "%?"
  1678. ;; :target (file+head "docs/posts/${slug}.org.gpg"
  1679. ;; "
  1680. ;; ,#+TITLE: ${title}
  1681. ;; ,#+AUTHOR: Christopher James Hayward
  1682. ;; ,#+DATE: %<%Y-%m-%d>
  1683. ;; ,#+EXPORT_FILE_NAME: ${slug}
  1684. ;; ,#+OPTIONS: num:nil todo:nil tasks:nil
  1685. ;; ,#+ROAM_KEY: https://chrishayward.xyz/posts/${slug}/
  1686. ;; ,#+HUGO_BASE_DIR: ../
  1687. ;; ,#+HUGO_AUTO_SET_LASTMOD: t
  1688. ;; ,#+HUGO_SECTION: posts
  1689. ;; ,#+HUGO_DRAFT: true
  1690. ;; "
  1691. ;; )
  1692. ;; :unnarrowed t))
  1693. #+END_SRC
  1694. ** Passwords
  1695. #+NAME: emacs-pass-extras
  1696. #+BEGIN_SRC nix
  1697. pkgs.pass
  1698. #+END_SRC
  1699. With [[https://password-store.org][Pass]], each password lives inside of an encrypted [[https://gnupg.org][GPG]] file, whose name is the title of the website or resource that requires the password. These encrypted files may be organized into meaningful folder hierarchies, compies from computer to computer, and in general, manipulated using standard command line tools.
  1700. #+NAME: emacs-pass-package
  1701. #+BEGIN_SRC nix
  1702. epkgs.password-store
  1703. #+END_SRC
  1704. Configure keybindings for passwords behind =SPC p=:
  1705. #+NAME: emacs-pass-elisp
  1706. #+BEGIN_SRC emacs-lisp
  1707. ;; Set the path to the password store.
  1708. (setq password-store-dir (expand-file-name "~/.password-store"))
  1709. ;; Apply custom keybindings.
  1710. (dotfiles/leader
  1711. "p" '(:ignore t :which-key "Passwords")
  1712. "pp" '(password-store-copy :which-key "Copy")
  1713. "pe" '(password-store-edit :which-key "Edit")
  1714. "pi" '(password-store-insert :which-key "Insert")
  1715. "pr" '(password-store-rename :which-key "Rename")
  1716. "pg" '(password-store-generate :which-key "Generate"))
  1717. #+END_SRC
  1718. ** Docker
  1719. #+NAME: emacs-docker-package
  1720. #+BEGIN_SRC nix
  1721. epkgs.docker
  1722. epkgs.dockerfile-mode
  1723. #+END_SRC
  1724. Manage Docker from inside of Emacs using [[https://github.com/Silex/docker.el][Docker.el]]. This is a full docker porcelain similar to Magit, allowing complete control of a Docker system. Add syntax highlighting to Dockerfiles using [[https://github.com/spotify/dockerfile-mode][dockerfile-mode]] from Spotify.
  1725. #+NAME: emacs-docker-elisp
  1726. #+BEGIN_SRC emacs-lisp
  1727. ;; Apply custom keybindings.
  1728. (dotfiles/leader
  1729. "n" '(:ignore t :which-key "Containers")
  1730. "nd" '(docker :which-key "Docker"))
  1731. #+END_SRC
  1732. ** MU4E
  1733. #+NAME: emacs-mu4e-extras
  1734. #+BEGIN_SRC nix
  1735. pkgs.mu
  1736. pkgs.isync
  1737. (pkgs.writeShellScriptBin "mail-init" ''
  1738. ${pkgs.mu} init --maildir="~/.cache/mail" --my-address="chris@chrishayward.xyz"
  1739. ${pkgs.mu} index
  1740. '')
  1741. (pkgs.writeShellScriptBin "mail-sync" ''
  1742. ${pkgs.isync}/bin/mbsync -a
  1743. '')
  1744. #+END_SRC
  1745. [[https://github.com/djcb/mu][MU]] is a tool for dealing with email messages stored in the Maildir-format. Its purpose is to help quickly find the messages needed, and allows users to view messages, extract attachments, create new maildirs, and much more. It's written in C and C++, and includes extensions for Emacs (MU4E) and guile scheme.
  1746. #+NAME: emacs-mu4e-package
  1747. #+BEGIN_SRC nix
  1748. epkgs.mu4e-alert
  1749. #+END_SRC
  1750. [[https://emacswiki.org/emacs/mu4e][MU4E]] is an email client for Emacs. It's based on the mu email indexer / searcher.
  1751. + Fully search based: no folders, only queries
  1752. + Fully documented, with example configurations
  1753. + User-interface optimized for speed, with quick keystrokes for common actions
  1754. + Asynchronous; heavy actions do not block Emacs
  1755. + Support for non-English languages
  1756. + Support for signing and encryption
  1757. + Address auto-completion based on existing messages
  1758. + Extensibile with existing code and snippets
  1759. #+NAME: emacs-mu4e-config
  1760. #+BEGIN_SRC nix
  1761. # Deploy the authinfo file.
  1762. home.file.".authinfo.gpg".source = ../config/authinfo.gpg;
  1763. # Deploy the isync configuration file.
  1764. home.file.".mbsyncrc" = {
  1765. text = ''
  1766. IMAPStore xyz-remote
  1767. Host mail.chrishayward.xyz
  1768. User chris@chrishayward.xyz
  1769. PassCmd "pass chrishayward.xyz/chris"
  1770. SSLType IMAPS
  1771. MaildirStore xyz-local
  1772. Path ~/.cache/mail/
  1773. Inbox ~/.cache/mail/inbox
  1774. SubFolders Verbatim
  1775. Channel xyz
  1776. Far :xyz-remote:
  1777. Near :xyz-local:
  1778. Patterns * !Archives
  1779. Create Both
  1780. Expunge Both
  1781. SyncState *
  1782. '';
  1783. };
  1784. #+END_SRC
  1785. Before using the software inside of Emacs, the maildir must be created in the local filesystem, and indexed. This is done with a single custom shell script binary ~mail-init~ which wraps the underlying mu commands. The emacs extension is shipped with the mu mail indexer. To utilize it, it must be added to the load path inside of Emacs.
  1786. #+NAME: emacs-mu4e-elisp
  1787. #+BEGIN_SRC emacs-lisp
  1788. ;; Add the `mu4e' shipped with `mu' to the load path.
  1789. (add-to-list 'load-path "/etc/profiles/per-user/chris/share/emacs/site-lisp/mu4e/")
  1790. (require 'mu4e)
  1791. ;; Confiugure `mu4e'.
  1792. (setq mu4e-maildir "~/.cache/mail"
  1793. mu4e-update-interval (* 5 60)
  1794. mu4e-get-mail-command "mail-sync"
  1795. mu4e-compose-format-flowed t
  1796. mu4e-change-filenames-when-moving t
  1797. mu4e-compose-signature (concat "Chris Hayward\n"
  1798. "chris@chrishayward.xyz"))
  1799. ;; Sign all outbound email with GPG.
  1800. (add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime)
  1801. (setq message-send-mail-function 'smtpmail-send-it
  1802. mml-secure-openpgp-signers '("37AB1CB72B741E478CA026D43025DCBD46F81C0F"))
  1803. ;; Setup `mu4e' accounts.
  1804. (setq mu4e-contexts
  1805. (list
  1806. ;; Main
  1807. ;; chris@chrishayward.xyz
  1808. (make-mu4e-context
  1809. :name "Main"
  1810. :match-func
  1811. (lambda (msg)
  1812. (when msg
  1813. (string-prefix-p "/Main" (mu4e-message-field msg :maildir))))
  1814. :vars
  1815. '((user-full-name . "Christopher James Hayward")
  1816. (user-mail-address . "chris@chrishayward.xyz")
  1817. (smtpmail-smtp-server . "mail.chrishayward.xyz")
  1818. (smtpmail-smtp-service . 587)
  1819. (smtpmail-stream-type . starttls)))))
  1820. ;; Setup `mu4e-alert'.
  1821. (setq mu4e-alert-set-default-style 'libnotify)
  1822. (mu4e-alert-enable-notifications)
  1823. (mu4e-alert-enable-mode-line-display)
  1824. ;; Open the `mu4e' dashboard.
  1825. (dotfiles/leader
  1826. "m" '(mu4e :which-key "Mail"))
  1827. #+END_SRC
  1828. ** Projectile
  1829. #+NAME: emacs-projectile-package
  1830. #+BEGIN_SRC nix
  1831. epkgs.projectile
  1832. #+END_SRC
  1833. [[https://projectile.mx][Projectile]] is a project interaction library for [[https://gnu.org/software/emacs/][GNU/Emacs]]. Its goal is to provide a nice set of features operating on a project level, without introducing external dependencies.
  1834. #+NAME: emacs-projectile-elisp
  1835. #+BEGIN_SRC emacs-lisp
  1836. ;; Configure the `projectile-project-search-path'.
  1837. (setq projectile-project-search-path '("~/.local/source"))
  1838. (projectile-mode +1)
  1839. #+END_SRC
  1840. ** LSP Mode
  1841. #+NAME: emacs-lsp-package
  1842. #+BEGIN_SRC nix
  1843. epkgs.lsp-mode
  1844. epkgs.lsp-ui
  1845. #+END_SRC
  1846. The [[https://microsoft.github.io/language-server-protocol][Language Server Protocol (LSP)]] defines the protocol used between an Editor or IDE, and a language server that provides features like:
  1847. + Auto Complete
  1848. + Go To Defintion
  1849. + Find All References
  1850. #+NAME: emacs-lsp-elisp
  1851. #+BEGIN_SRC emacs-lisp
  1852. ;; Configure `lsp-mode'.
  1853. (setq lsp-idle-delay 0.5
  1854. lsp-prefer-flymake t)
  1855. ;; Configure `lsp-ui'.
  1856. (setq lsp-ui-doc-position 'at-point
  1857. lsp-ui-doc-delay 0.5)
  1858. ;; Add custom keybindings for `lsp'.
  1859. (dotfiles/leader
  1860. "l" '(:ignore t :which-key "LSP")
  1861. "ll" '(lsp :which-key "LSP"))
  1862. #+END_SRC
  1863. ** CCLS
  1864. #+NAME: emacs-ccls-package
  1865. #+BEGIN_SRC nix
  1866. epkgs.ccls
  1867. #+END_SRC
  1868. [[https://github.com/MaskRay/emacs-ccls][Emacs CCLS]] is a client for CCLS, a C/C++/Objective-C language server supporting multi-million line C++ code bases, powered by libclang.
  1869. #+NAME: emacs-ccls-elisp
  1870. #+BEGIN_SRC emacs-lisp
  1871. ;; Configure `ccls' to work with `lsp-mode'.
  1872. (defun dotfiles/ccls-hook ()
  1873. (require 'ccls)
  1874. (lsp))
  1875. ;; Configure `ccls' mode hooks.
  1876. (add-hook 'c-mode-hook 'dotfiles/ccls-hook)
  1877. (add-hook 'c++-mode-hook 'dotfiles/ccls-hook)
  1878. (add-hook 'objc-mode-hook 'dotfiles/ccls-hook)
  1879. (add-hook 'cuda-mode-hook 'dotfiles/ccls-hook)
  1880. #+END_SRC
  1881. ** Company Mode
  1882. #+NAME: emacs-company-package
  1883. #+BEGIN_SRC nix
  1884. epkgs.company
  1885. #+END_SRC
  1886. [[https://company-mode.github.io][Company Mode]] is a text completion framework for [[https://gnu.org/software/emacs/][GNU/Emacs]]. The name stands for =Complete Anything=. It uses pluggable back-ends and front-ends to retieve and display completion candidates.
  1887. #+NAME: emacs-company-elisp
  1888. #+BEGIN_SRC emacs-lisp
  1889. ;; Configure `company-mode'.
  1890. (setq company-backend 'company-capf
  1891. lsp-completion-provider :capf)
  1892. ;; Enable it globally.
  1893. (global-company-mode +1)
  1894. #+END_SRC
  1895. ** GDScript Mode
  1896. #+NAME: emacs-gdscript-package
  1897. #+BEGIN_SRC nix
  1898. epkgs.gdscript-mode
  1899. #+END_SRC
  1900. https://github.com/godotengine/emacs-gdscript-mode is an Emacs package to get GDScript support and syntax highlighting. Some of its features include:
  1901. + Syntax highlighting
  1902. + Code folding
  1903. + Debugger support
  1904. + Support for scenes and script files
  1905. + Comment wrapping
  1906. + Indentation
  1907. + Automatic parsing
  1908. + Code formatting
  1909. #+NAME: emacs-gdscript-elisp
  1910. #+BEGIN_SRC emacs-lisp
  1911. (require 'gdscript-mode)
  1912. ;; Silence lsp warnings for gdscript.
  1913. (defun lsp--gdscript-ignore-errors (original-function &rest args)
  1914. "Ignore the error message resulting from Godot not replying to the `JSONRPC' request."
  1915. (if (string-equal major-mode "gdscript-mode")
  1916. (let ((json-data (nth 0 args)))
  1917. (if (and (string= (gethash "jsonrpc" json-data "") "2.0")
  1918. (not (gethash "id" json-data nil))
  1919. (not (gethash "method" json-data nil)))
  1920. nil; (message "Method not found")
  1921. (apply original-function args)))
  1922. (apply original-function args)))
  1923. ;; Run the function around `lsp--get-message-type' to suppress warnings.
  1924. (advice-add #'lsp--get-message-type :around #'lsp--gdscript-ignore-errors)
  1925. ;; Add custom keybinds.
  1926. (dotfiles/leader
  1927. "lg" '(gdscript-hydra-show :which-key "GDScript"))
  1928. #+END_SRC
  1929. ** Go Mode
  1930. #+NAME: emacs-golang-package
  1931. #+BEGIN_SRC nix
  1932. epkgs.go-mode
  1933. #+END_SRC
  1934. [[https://emacswiki.org/emacs/GoMode][Go Mode]] is an [[https://gnu.org/software/emacs/][Emacs]] major mode for editing [[https://golang.org][Golang]] source code.
  1935. #+NAME: emacs-golang-elisp
  1936. #+BEGIN_SRC emacs-lisp
  1937. ;; Configure `go-mode' to work with `lsp-mode'.
  1938. (defun dotfiles/go-hook ()
  1939. (add-hook 'before-save-hook #'lsp-format-buffer t t)
  1940. (add-hook 'before-save-hook #'lsp-organize-imports t t))
  1941. ;; Configure a custom `before-save-hook'.
  1942. (add-hook 'go-mode-hook #'dotfiles/go-hook)
  1943. #+END_SRC
  1944. ** Rustic
  1945. #+NAME: emacs-rustic-package
  1946. #+BEGIN_SRC nix
  1947. epkgs.rustic
  1948. #+END_SRC
  1949. Rustic is a fork of Rust Mode that integrates well with the [[https://microsoft.github.io/language-server-protocol][Language Server Protocol (LSP)]]. Include the rust shell before launching [[https://gnu.org/software/emacs/][GNU/Emacs]] to use this!
  1950. #+NAME: emacs-rustic-elisp
  1951. #+BEGIN_SRC emacs-lisp
  1952. ;; Configure `rustic' with `lsp-mode'.
  1953. (setq rustic-format-on-save t
  1954. rustic-lsp-server 'rls)
  1955. #+END_SRC
  1956. ** Python Mode
  1957. #+NAME: emacs-python-package
  1958. #+BEGIN_SRC nix
  1959. epkgs.pretty-mode
  1960. #+END_SRC
  1961. The built in [[https://emacswiki.org/emacs/PythonProgrammingInEmacs][Python Mode]] has a nice feature set for working with [[https://python.org][Python]] code in [[https://gnu.org/software/emacs/][GNU/Emacs]]. It is complimented with the addition of a [[https://microsoft.github.io/language-server-protocol][Language Server Protocol (LSP)]] server. These tools are included in the Development Shell for Python.
  1962. #+NAME: emacs-python-elisp
  1963. #+BEGIN_SRC emacs-lisp
  1964. ;; Configure `pretty-mode' to work with `python-mode'.
  1965. (add-hook 'python-mode-hook
  1966. (lambda ()
  1967. (turn-on-pretty-mode)))
  1968. #+END_SRC
  1969. ** Protobuf Mode
  1970. #+NAME: emacs-protobuf-package
  1971. #+BEGIN_SRC nix
  1972. epkgs.protobuf-mode
  1973. #+END_SRC
  1974. ** Typescript Mode
  1975. #+NAME: emacs-typescript-package
  1976. #+BEGIN_SRC nix
  1977. epkgs.typescript-mode
  1978. #+END_SRC
  1979. ** PlantUML
  1980. #+NAME: emacs-plantuml-extras
  1981. #+BEGIN_SRC nix
  1982. pkgs.plantuml
  1983. #+END_SRC
  1984. [[https://plantuml.com][PlantUML]] is an open-source tool allowing users to create diagrams from a plain-text language. Besides various UML diagrams, PlantUML has support for various other software developmented related formats, as well as visualizations of =JSON= and =YAML= files.
  1985. #+NAME: emacs-plantuml-package
  1986. #+BEGIN_SRC nix
  1987. epkgs.plantuml-mode
  1988. #+END_SRC
  1989. [[https://github.com/skuro/plantuml-mode][PlantUML Mode]] is a major mode for editing [[https://plantuml.com][PlantUML]] sources in [[https://gnu.org/software/emacs/][GNU/Emacs]].
  1990. #+NAME: emacs-plantuml-elisp
  1991. #+BEGIN_SRC emacs-lisp
  1992. ;; Configure `plantuml-mode'.
  1993. (add-to-list 'org-src-lang-modes '("plantuml" . plantuml))
  1994. (org-babel-do-load-languages 'org-babel-load-languages '((plantuml . t)))
  1995. (setq plantuml-default-exec-mode 'executable
  1996. org-plantuml-exec-mode 'plantuml)
  1997. #+END_SRC
  1998. ** Swiper
  1999. #+NAME: emacs-swiper-package
  2000. #+BEGIN_SRC nix
  2001. epkgs.ivy
  2002. epkgs.counsel
  2003. epkgs.ivy-rich
  2004. epkgs.ivy-posframe
  2005. epkgs.ivy-prescient
  2006. #+END_SRC
  2007. [[https://github.com/abo-abo/swiper][Ivy (Swiper)]] is a generic completion mechanism for [[https://gnu.org/software/emacs/][GNU/Emacs]]. While operating similarily to other completion schemes like =icomplete-mode=, it aims to be more efficient, smaller, simpler, and smoother to use, while remaining highly customizable.
  2008. #+NAME: emacs-swiper-elisp
  2009. #+BEGIN_SRC emacs-lisp
  2010. ;; Configure `ivy'.
  2011. (setq counsel-linux-app-format-function
  2012. #'counsel-linux-app-format-function-name-only)
  2013. (ivy-mode +1)
  2014. (counsel-mode +1)
  2015. ;; Configure `ivy-rich'.
  2016. (ivy-rich-mode +1)
  2017. ;; Configure `ivy-posframe'.
  2018. (setq ivy-posframe-parameters '((parent-frame nil))
  2019. ivy-posframe-display-functions-alist '((t . ivy-posframe-display)))
  2020. (ivy-posframe-mode +1)
  2021. ;; Configure `ivy-prescient'.
  2022. (setq ivy-prescient-enable-filtering nil)
  2023. (ivy-prescient-mode +1)
  2024. #+END_SRC
  2025. ** Transparency
  2026. It's possible to control the frame opacity in [[https://gnu.org/software/emacs/][GNU/Emacs]]. Unlike other transparency hacks, it's not merely showing the desktop background image, but is true transparency -- you can see other windows behind the Emacs window.
  2027. #+NAME: emacs-transparency-elisp
  2028. #+BEGIN_SRC emacs-lisp
  2029. ;; Configure the default frame transparency.
  2030. (set-frame-parameter (selected-frame) 'alpha '(95 . 95))
  2031. (add-to-list 'default-frame-alist '(alpha . (95 . 95)))
  2032. #+END_SRC
  2033. ** Desktop Environment
  2034. #+NAME: emacs-desktop-extras
  2035. #+BEGIN_SRC nix
  2036. pkgs.brightnessctl
  2037. #+END_SRC
  2038. The [[https://github.com/DamienCassou/desktop-environment][Desktop Environment]] package provides commands and a global minor mode for controlling your [[https://linux.org][GNU/Linux]] desktop from within [[https://gnu.org/software/emacs/][GNU/Emacs]].
  2039. #+NAME: emacs-desktop-package
  2040. #+BEGIN_SRC nix
  2041. epkgs.desktop-environment
  2042. #+END_SRC
  2043. You can control the brightness, volume, take screenshots, and lock / unlock the screen. The package depends on the availability of shell commands to do the heavy lifting. They can be changed by customizing the appropriate variables.
  2044. #+NAME: emacs-desktop-elisp
  2045. #+BEGIN_SRC emacs-lisp
  2046. ;; Configure `desktop-environment'.
  2047. (require 'desktop-environment)
  2048. (desktop-environment-mode +1)
  2049. #+END_SRC
  2050. ** Doom Themes
  2051. #+NAME: emacs-doom-themes-package
  2052. #+BEGIN_SRC nix
  2053. epkgs.doom-themes
  2054. #+END_SRC
  2055. [[https://github.com/hlissner/emacs-doom-themes][Doom Themes]] is a theme megapack for [[https://gnu.org/software/emacs/][GNU/Emacs]], inspired by community favourites.
  2056. #+NAME: emacs-doom-themes-elisp
  2057. #+BEGIN_SRC emacs-lisp
  2058. ;; Include modern themes from `doom-themes'.
  2059. (setq doom-themes-enable-bold t
  2060. doom-themes-enable-italic t)
  2061. ;; Load the `doom-nord' and `doom-nord-light' themes.
  2062. ;; (load-theme 'doom-nord-light t)
  2063. (load-theme 'doom-nord t)
  2064. ;; Define a method for returning information about the current theme.
  2065. ;; This is based off the function `org-roam-ui-get-theme'.
  2066. (defun dotfiles/theme ()
  2067. "Return information about the current theme."
  2068. (list `(bg . ,(face-background hl-line-face))
  2069. `(bg-alt . ,(face-background 'default))
  2070. `(fg . ,(face-foreground 'default))
  2071. `(fg-alt . ,(face-foreground font-lock-comment-face))
  2072. `(red . ,(face-foreground 'error))
  2073. `(orange . ,(face-foreground 'warning))
  2074. `(yellow . ,(face-foreground font-lock-builtin-face))
  2075. `(green . ,(face-foreground 'success))
  2076. `(cyan . ,(face-foreground font-lock-constant-face))
  2077. `(blue . ,(face-foreground font-lock-keyword-face))
  2078. `(violet . ,(face-foreground font-lock-constant-face))
  2079. `(magenta . ,(face-foreground font-lock-preprocessor-face))))
  2080. ;; Load a new theme with <SPC> t t.
  2081. (dotfiles/leader
  2082. "tt" '(counsel-load-theme :which-key "Theme"))
  2083. #+END_SRC
  2084. Create a shell command that returns a JSON string of the current theme in the following format:
  2085. #+BEGIN_SRC json
  2086. {
  2087. "bg": "#272C36",
  2088. "bg-alt": "#2E3440",
  2089. "fg": "#ECEFF4",
  2090. "fg-alt": "#6f7787",
  2091. "red": "#BF616A",
  2092. "orange": "#EBCB8B",
  2093. "yellow": "#81A1C1",
  2094. "green": "#A3BE8C",
  2095. "cyan": "#81A1C1",
  2096. "blue": "#81A1C1",
  2097. "violet": "#81A1C1",
  2098. "magenta": "#81A1C1"
  2099. }
  2100. #+END_SRC
  2101. #+NAME: emacs-doom-themes-extras
  2102. #+BEGIN_SRC nix
  2103. (pkgs.writeShellScriptBin "dotfiles-theme" ''
  2104. ${myEmacs}/bin/emacsclient --no-wait --eval '(json-encode (dotfiles/theme))' | sed "s/\\\\//g" | sed -e 's/^"//' -e 's/"$//'
  2105. '')
  2106. #+END_SRC
  2107. ** Doom Modeline
  2108. #+NAME: emacs-doom-modeline-package
  2109. #+BEGIN_SRC nix
  2110. epkgs.doom-modeline
  2111. #+END_SRC
  2112. [[https://github.com/seagle0128/doom-modeline][Doom Modeline]] is a fancy and fast modeline inspired by minimalism design. It's integrated into Centaur Emacs, Doom Emacs, and Spacemacs.
  2113. #+NAME: emacs-doom-modeline-elisp
  2114. #+BEGIN_SRC emacs-lisp
  2115. ;; Configure `doom-modeline'.
  2116. (require 'doom-modeline)
  2117. (setq doom-modeline-height 16
  2118. doom-modeline-icon t)
  2119. ;; Launch after initialization.
  2120. (add-hook 'after-init-hook 'doom-modeline-mode)
  2121. ;; Define a modeline segment to show the workspace information.
  2122. (doom-modeline-def-segment dotfiles/workspaces
  2123. (exwm-workspace--update-switch-history)
  2124. (concat
  2125. (doom-modeline-spc)
  2126. (elt (let* ((num (exwm-workspace--count))
  2127. (sequence (number-sequence 0 (1- num)))
  2128. (not-empty (make-vector num nil)))
  2129. (dolist (i exwm--id-buffer-alist)
  2130. (with-current-buffer (cdr i)
  2131. (when exwm--frame
  2132. (setf (aref not-empty
  2133. (exwm-workspace--position exwm--frame))
  2134. t))))
  2135. (mapcar
  2136. (lambda (i)
  2137. (mapconcat
  2138. (lambda (j)
  2139. (format (if (= i j) "[%s]" " %s ")
  2140. (propertize
  2141. (apply exwm-workspace-index-map (list j))
  2142. 'face
  2143. (cond ((frame-parameter (elt exwm-workspace--list j)
  2144. 'exwm-urgency)
  2145. '(:inherit warning :weight bold))
  2146. ((= i j) '(:inherit underline :weight bold))
  2147. ((aref not-empty j) '(:inherit success :weight bold))
  2148. (t `((:foreground ,(face-foreground 'mode-line-inactive))))))))
  2149. sequence ""))
  2150. sequence))
  2151. (exwm-workspace--position (selected-frame)))))
  2152. ;; Define a custom modeline to override the default.
  2153. (doom-modeline-def-modeline 'dotfiles/modeline
  2154. '(bar workspace-name dotfiles/workspaces window-number modals matches buffer-info remote-host buffer-position word-count parrot selection-info)
  2155. '(objed-state misc-info persp-name battery grip irc mu4e gnus github debug repl lsp minor-modes input-method indent-info buffer-encoding major-mode process vcs checker))
  2156. ;; Define a method to load the modeline.
  2157. (defun dotfiles/load-modeline ()
  2158. "Load the default modeline."
  2159. (doom-modeline-set-modeline 'dotfiles/modeline 'default))
  2160. ;; Enable `doom-modeline'.
  2161. (add-hook 'doom-modeline-mode-hook 'dotfiles/load-modeline)
  2162. (doom-modeline-mode +1)
  2163. (doom-modeline-set-modeline 'dotfiles/modeline 'default)
  2164. #+END_SRC
  2165. * Website Configuration
  2166. #+ATTR_ORG: :width 800px
  2167. #+ATTR_HTML: :width 800px
  2168. #+ATTR_LATEX: :width 800px
  2169. [[./docs/images/website.png]]
  2170. My [[https://chrishayward.xyz][personal website]] is a static HTML page written with [[https://gohugo.io][Hugo]], and is fully integrated into this configuration. It uses the ~config.toml~, ~config.yaml~, or ~config.json~ file (found in the sites root directory) as the default site config. Working with this requires the module to be enabled.
  2171. #+BEGIN_SRC conf :noweb yes :tangle docs/config.toml
  2172. # <<file-warning>>
  2173. title = "Chris Hayward"
  2174. copyright = "Licensed under Attribution 4.0 International (CC BY 4.0)"
  2175. baseURL = "https://chrishayward.xyz/"
  2176. theme = "hello-friend-ng"
  2177. languageCode = "en-us"
  2178. defaultContentLanguage = "en"
  2179. pygmentsCodefences = true
  2180. pygmentsUseClasses = true
  2181. <<website-params>>
  2182. <<website-privacy>>
  2183. <<website-layout>>
  2184. #+END_SRC
  2185. ** Params
  2186. Dates are important in [[https://gohugo.io][Hugo]], and they configure how dates are assigned and displayed in your content pages. Themes are also able to extract information from the configuration to display, including social media icons, subtitles, and footer sections.
  2187. #+NAME: website-params
  2188. #+BEGIN_SRC conf
  2189. [params]
  2190. dateform = "Jan 2, 2006"
  2191. dateformShort = "Jan 2"
  2192. dateformNum = "2006-01-02"
  2193. dateformNumTime = "2006-01-02 15:04 -0700"
  2194. authorName = "Christopher James Hayward"
  2195. homeSubtitle = "Airplanes, Linux, and Metalcore"
  2196. footerCopyright = ' &#183; <a href="http://creativecommons.org/licenses/by/4.0/" target="_blank" rel="noopener">CC BY 4.0</a>'
  2197. [[params.social]]
  2198. name = "paypal"
  2199. url = "https://paypal.me/chrishaywardxyz"
  2200. [[params.social]]
  2201. name = "github"
  2202. url = "https://github.com/chayward1/"
  2203. [[params.social]]
  2204. name = "gitlab"
  2205. url = "https://gitlab.com/chayward1/"
  2206. [[params.social]]
  2207. name = "email"
  2208. url = "mailto:chris@chrishayward.xyz"
  2209. #+END_SRC
  2210. ** Privacy
  2211. I do not use any analytics or tracking in my website. Depending on the theme selected, some of these features may be enabled. I opt to override those settings here to make sure no unwanted trackers are loaded.
  2212. #+NAME: website-privacy
  2213. #+BEGIN_SRC conf
  2214. [privacy]
  2215. [privacy.disqus]
  2216. disable = true
  2217. [privacy.googleAnalytics]
  2218. disable = true
  2219. [privacy.instagram]
  2220. disable = true
  2221. [privacy.twitter]
  2222. disable = true
  2223. [privacy.vimeo]
  2224. disable = true
  2225. [privacy.youtube]
  2226. disable = true
  2227. #+END_SRC
  2228. ** Layout
  2229. Individual pages can be configured here to define the layout of the page. This is where quick links can be configured, and other sections such as blog posts, an about section, or a contact page can be added.
  2230. #+NAME: website-layout
  2231. #+BEGIN_SRC conf
  2232. [menu]
  2233. [[menu.main]]
  2234. identifier = "cloud"
  2235. name = "Cloud"
  2236. url = "https://cloud.chrishayward.xyz"
  2237. [[menu.main]]
  2238. identifier = "dotfiles"
  2239. name = "Dotfiles"
  2240. url = "/dotfiles"
  2241. [[menu.main]]
  2242. identifier = "projects"
  2243. name = "Projects"
  2244. url = "https://git.chrishayward.xyz"
  2245. #+END_SRC
  2246. * Footnotes