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.

3081 lines
90 KiB

4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 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
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
  1. #+TITLE: Dotfiles
  2. #+AUTHOR: Christopher James Hayward
  3. #+EMAIL: chris@chrishayward.xyz
  4. #+EXPORT_FILE_NAME: dotfiles
  5. #+ROAM_KEY: https://chrishayward.xyz/dotfiles/
  6. #+HUGO_BASE_DIR: docs
  7. #+HUGO_AUTO_SET_LASTMOD: t
  8. #+HUGO_SECTION:
  9. #+HUGO_DRAFT: false
  10. #+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>
  11. #+HTML: <a href="https://www.gnu.org/software/emacs/"><img src="https://img.shields.io/badge/Emacs-28.0.50-blueviolet.svg?style=flat-square&logo=GNU%20Emacs&logoColor=white"></a>
  12. #+HTML: <a href="https://orgmode.org"><img src="https://img.shields.io/badge/Org-9.4.6-%2377aa99?style=flat-square&logo=org&logoColor=white"></a>
  13. #+NAME: description
  14. #+BEGIN_SRC text
  15. Immutable NixOS dotfiles.
  16. #+END_SRC
  17. #+ATTR_ORG: :width 800px
  18. #+ATTR_HTML: :width 800px
  19. #+ATTR_LATEX: :width 800px
  20. [[./docs/images/desktop-example.png]]
  21. Built for Life, Liberty, and the Open Road.
  22. + 100% Immutable
  23. + 100% Declarative
  24. + 100% Reproducible
  25. * Introduction
  26. This is my personal configuration(s) for GNU/Linux[fn:1] systems. It enables a consistent experience and computing environment across all of my machines. This project is written with GNU/Emacs[fn:2], leveraging its capabilities for Literate Programming[fn:3], a technique where programs are written in a natural language, such as English, interspersed with snippets of code to describe a software project.
  27. #+NAME: file-warning
  28. #+BEGIN_SRC text
  29. This file is controlled by /etc/dotfiles/README.org
  30. #+END_SRC
  31. ** Getting Started
  32. 1) Download the latest version of NixOS https://nixos.org/download.html
  33. 2) Partition drives and mount the file system https://nixos.org/manual/nixos/stable/#sec-installation-partitioning
  34. 3) Clone the project to =/mnt/etc/dotfiles= ~git clone git@git.chrishayward.xyz:chris/dotfiles /mnt/etc/dotfiles~
  35. 4) Load the default shell environment ~nix-shell /mnt/etc/dotfiles~
  36. 5) Install the default system ~sudo nixos-install --flake /mnt/etc/dotfiles#nixos~
  37. 6) Reboot and login, start a graphical system with ~startx~
  38. ** Making Changes
  39. 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:
  40. + boot :: Build the new configuration and make it the boot default, without activation
  41. + test :: Build and activate the new configuration, without adding it to the boot menu
  42. + switch :: Build and activate the new configuration, making it the new boot default
  43. + build :: Build the new configuration, without activation, nor adding it to the boot menu
  44. + build-vm :: Build a script that starts a virtual machine with the desired configuration
  45. #+BEGIN_SRC shell
  46. # Build and activate a new configuration.
  47. sudo nixos-rebuild switch --flake $FLAKE#$HOSTNAME
  48. #+END_SRC
  49. 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.
  50. #+BEGIN_SRC shell
  51. # Rollback to the previous generation.
  52. sudo nixos-rebuild switch --rollback
  53. #+END_SRC
  54. ** Docker Container
  55. It's possible to use parts of this configuration using a 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.
  56. #+BEGIN_SRC conf :tangle Dockerfile :noweb yes
  57. # <<file-warning>>
  58. # Derive from the official image.
  59. FROM nixos/nix
  60. # Setup the default environment.
  61. WORKDIR /etc/dotfiles
  62. COPY . .
  63. # Load the default system shell.
  64. RUN nix-shell /etc/dotfiles/shell.nix
  65. #+END_SRC
  66. * Operating System
  67. NixOS[fn:4] is a purely functional Linux distribution built on top of the Nix[fn:5] package manager. It uses a declarative configuration language to define entire computer systems, and allows reliable system upgrades and rollbacks. NixOS[fn:4] also has tool dedicated to DevOps and deployment tasks, and makes it trivial to share development environments.
  68. #+BEGIN_SRC nix :noweb yes :tangle flake.nix
  69. # <<file-warning>>
  70. {
  71. description = "<<description>>";
  72. inputs = {
  73. <<os-nixpkgs>>
  74. <<os-home-manager>>
  75. <<os-emacs-overlay>>
  76. <<os-nixos-hardware>>
  77. <<os-nix-on-droid>>
  78. };
  79. outputs = inputs @ { self, nixpkgs, nixpkgs-unstable, ... }: {
  80. nixosConfigurations = {
  81. <<host-default>>
  82. <<host-acernitro>>
  83. <<host-raspberry>>
  84. <<host-homecloud>>
  85. <<host-android>>
  86. };
  87. };
  88. }
  89. #+END_SRC
  90. ** Nixpkgs
  91. Nixpkgs[fn:6] is a collection of over 60,000 software packages that can be installed with the Nix[fn:5] package manager. Two main branches are offered:
  92. 1) The current stable release
  93. 2) The Unstable branch following the latest development
  94. #+NAME: os-nixpkgs
  95. #+BEGIN_SRC nix
  96. nixpkgs.url = "nixpkgs/nixos-unstable";
  97. nixpkgs-unstable.url = "nixpkgs/master";
  98. #+END_SRC
  99. ** Home Manager
  100. Home Manager[fn:7] provides a basic system for managing user environments using the Nix[fn:5] package manager together with the Nix libraries found in Nixpkgs[fn:6]. It allows declarative configuration of user specific (non-global) packages and files.
  101. #+NAME: os-home-manager
  102. #+BEGIN_SRC nix
  103. home-manager.url = "github:nix-community/home-manager";
  104. home-manager.inputs.nixpkgs.follows = "nixpkgs";
  105. #+END_SRC
  106. ** Emacs Overlay
  107. Adding the Emacs Overlay[fn:8] extends the GNU/Emacs[fn:2] package set to contain the latest versions, and daily generations from popular package sources, including the needed dependencies to run GNU/Emacs[fn:2] as a Window Manager.
  108. #+NAME: os-emacs-overlay
  109. #+BEGIN_SRC nix
  110. emacs-overlay.url = "github:nix-community/emacs-overlay";
  111. #+END_SRC
  112. ** NixOS Hardware
  113. NixOS Hardware[fn:9] is a collection of NixOS[fn:4] 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.
  114. #+NAME: os-nixos-hardware
  115. #+BEGIN_SRC nix
  116. nixos-hardware.url = "github:nixos/nixos-hardware";
  117. #+END_SRC
  118. ** Nix On Droid
  119. Nix On Droid[fn:10] is a deployment of the Nix[fn:5] Package Manager on Android, in a single-click installable package. It does not require =root=, user namespace support, or disabling SELinux, but relies on =proot=. It has no relation to the Termux distribution.
  120. #+NAME: os-nix-on-droid
  121. #+BEGIN_SRC nix
  122. nix-on-droid.url = "github:t184256/nix-on-droid/master";
  123. nix-on-droid.inputs.nixpkgs.follows = "nixpkgs";
  124. #+END_SRC
  125. * Development Shells
  126. The command ~nix-shell~[fn:11] 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.
  127. Import this shell with ~nix-shell /etc/dotfiles/shell.nix~.
  128. #+BEGIN_SRC nix :noweb yes :tangle shell.nix
  129. # <<file-warning>>
  130. { pkgs ? import <nixpkgs> { } }:
  131. with pkgs;
  132. let
  133. nixBin = writeShellScriptBin "nix" ''
  134. ${nixFlakes}/bin/nix --option experimental-features "nix-command flakes" "$@"
  135. '';
  136. in mkShell {
  137. buildInputs = [
  138. git
  139. ];
  140. shellHook = ''
  141. export FLAKE="$(pwd)"
  142. export PATH="$FLAKE/bin:${nixBin}/bin:$PATH"
  143. '';
  144. }
  145. #+END_SRC
  146. ** Go
  147. Go[fn:12] 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.
  148. Import this shell with ~nix-shell /etc/dotfiles/shells/go.nix~
  149. #+BEGIN_SRC nix :noweb yes :tangle shells/go.nix
  150. # <<file-warning>>
  151. { pkgs ? import <nixpkgs> { } }:
  152. with pkgs;
  153. mkShell {
  154. buildInputs = [
  155. go
  156. gopls
  157. # FIXME: Broken on nixpkgs/unstable.
  158. # protoc-gen-go
  159. # protoc-gen-go-grpc
  160. ];
  161. shellHook = ''
  162. export GO111MODULE=on
  163. export GOPATH=$XDG_DATA_HOME/go
  164. export PATH=$GOPATH/bin:$PATH
  165. '';
  166. }
  167. #+END_SRC
  168. ** Rust
  169. Rust[fn:13] 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[fn:13] achieves memory safety /without/ garbage collection, and reference counting is optional.
  170. Import this shell with ~nix-shell /etc/dotfiles/shells/rust.nix~.
  171. #+BEGIN_SRC nix :noweb yes :tangle shells/rust.nix
  172. # <<file-warning>>
  173. { pkgs ? import <nixpkgs> { } }:
  174. with pkgs;
  175. mkShell {
  176. buildInputs = [
  177. rustup
  178. ];
  179. shellHook = ''
  180. export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
  181. export CARGO_HOME="$XDG_DATA_HOME/cargo"
  182. export PATH="$CARGO_HOME/bin:$PATH"
  183. '';
  184. }
  185. #+END_SRC
  186. ** Node
  187. Node.js[fn:14] 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. Node.js[fn:14] lets developers user JavaScript to write command line tools, and for server-side scripting to produce dynamic web page content.
  188. Import this shell with ~nix-shell /etc/dotfiles/shells/node.nix~.
  189. #+BEGIN_SRC nix :noweb yes :tangle shells/node.nix
  190. # <<file-warning>>
  191. { pkgs ? import <nixpkgs> { } }:
  192. with pkgs;
  193. mkShell {
  194. buildInputs = [
  195. nodejs
  196. yarn
  197. ];
  198. shellHook = ''
  199. export NPM_CONFIG_TMP="$XDG_RUNTIME_DIR/npm"
  200. export NPM_CONFIG_CACHE="$XDG_CACHE_HOME/npm"
  201. export NPM_CACHE_PREFIX="$XDG_CACHE_HOME/npm"
  202. export PATH="$(yarn global bin):$PATH"
  203. '';
  204. }
  205. #+END_SRC
  206. ** gRPC
  207. gRPC[fn:15] 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.
  208. Import this shell with ~nix-shell /etc/dotfiles/shells/grpc.nix~.
  209. #+BEGIN_SRC nix :noweb yes :tangle shells/grpc.nix
  210. # <<file-warning>>
  211. { pkgs ? import <nixpkgs> { } }:
  212. with pkgs;
  213. mkShell {
  214. buildInputs = [
  215. grpc
  216. grpcui
  217. grpcurl
  218. # FIXME: Broken on nixpkgs/unstable.
  219. # grpc-tools
  220. ];
  221. shellHook = ''
  222. '';
  223. }
  224. #+END_SRC
  225. ** C/C++
  226. C[fn:16] 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. C++[fn:17] is a general-purpose programming language created as an extension of the C[fn:16] programming language.
  227. Import this shell with ~nix-shell /etc/dotfiles/shells/cc.nix~.
  228. #+BEGIN_SRC nix :noweb yes :tangle shells/cc.nix
  229. # <<file-warning>>
  230. { pkgs ? import <nixpkgs> { } }:
  231. with pkgs;
  232. mkShell {
  233. buildInputs = [
  234. gdb
  235. ccls
  236. cmake
  237. gnumake
  238. gcc-unwrapped
  239. ];
  240. shellHook = ''
  241. '';
  242. }
  243. #+END_SRC
  244. ** Python
  245. Python[fn:18] 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.
  246. Import this shell with ~nix-shell /etc/dotfiles/shells/python.nix~
  247. #+BEGIN_SRC nix :noweb yes :tangle shells/python.nix
  248. # <<file-warning>>
  249. { pkgs ? import <nixpkgs> { } }:
  250. with pkgs;
  251. mkShell {
  252. buildInputs = [
  253. python38Packages.pip
  254. python38Packages.pip-tools
  255. python38Packages.pyls-mypy
  256. python38Packages.pyls-isort
  257. python38Packages.pyls-black
  258. ];
  259. shellHook = ''
  260. '';
  261. }
  262. #+END_SRC
  263. ** Docker
  264. Compose[fn:19] is a tool for defining and running multi-container Docker[fn:20] applications. With Compose[fn:19], 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.
  265. Machine[fn:21] is a tool that lets you install Docker Engine on virtual hosts, and manage the hosts with ~docker-machine~ commands. You can use Machine[fn:21] to create hosts on your local box, company network, data center, or on any cloud provider.
  266. Import this shell with ~nix-shell /etc/dotfiles/shells/docker.nix~
  267. #+BEGIN_SRC nix :noweb yes :tangle shells/docker.nix
  268. # <<file-warning>>
  269. { pkgs ? import <nixpkgs> { } }:
  270. with pkgs;
  271. mkShell {
  272. buildInputs = [
  273. docker-compose
  274. docker-machine
  275. ];
  276. shellHook = ''
  277. '';
  278. }
  279. #+END_SRC
  280. ** Heroku
  281. Heroku[fn:22] is a cloud platform as a service supporting several programming languages. One of the first cloud platforms, Heroku[fn:22] 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.
  282. #+BEGIN_SRC nix :noweb yes :tangle shells/heroku.nix
  283. # <<file-warning>>
  284. { pkgs ? import <nixpkgs> { } }:
  285. with pkgs;
  286. mkShell {
  287. buildInputs = [
  288. heroku
  289. ];
  290. shellHook = ''
  291. '';
  292. }
  293. #+END_SRC
  294. * Host Configurations
  295. NixOS[fn:4] 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:
  296. #+NAME: host-config-wifi
  297. #+BEGIN_SRC nix
  298. networking.wireless.networks = {
  299. MyWiFi_5C1870.pskRaw = "409b3c85fef1c5737f284d2f82f20dc6023e41804e862d4fa26265ef8193b326";
  300. SM-G975W3034.pskRaw = "74835d96a98ca2c56ffe4eaf92223f8a555168b59ec2bb22b1e46b2a333adc80";
  301. };
  302. #+END_SRC
  303. 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:
  304. #+NAME: host-config-home
  305. #+BEGIN_SRC nix
  306. networking.hosts = {
  307. "192.168.3.105" = [ "gamingpc" ];
  308. "192.168.3.163" = [ "acernitro" ];
  309. "192.168.3.182" = [ "raspberry" ];
  310. "192.168.3.183" = [ "homecloud" ];
  311. };
  312. #+END_SRC
  313. 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.
  314. #+NAME: host-config-ssh
  315. #+BEGIN_SRC nix
  316. users.users.chris.openssh.authorizedKeys.keys = [
  317. "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4wka/LfG3pto15DIm9LIRbb6rWr7/ipCRiCdAKSlY4 chris@chrishayward.xyz"
  318. ];
  319. #+END_SRC
  320. ** Default
  321. The default host, built using QEMU[fn:23], a free and open-source emulator that can perform hardware virtualization. It features a lightweight system optimized for development, running GNU/Emacs[fn:2] + EXWM[fn:24] as the graphical environment.
  322. #+NAME: host-default
  323. #+BEGIN_SRC nix :noweb yes
  324. nixos = nixpkgs.lib.nixosSystem {
  325. system = "x86_64-linux";
  326. specialArgs = { inherit inputs; };
  327. modules = [
  328. ./hosts/nixos
  329. <<module-x11>>
  330. <<module-ssh>>
  331. <<module-flakes>>
  332. <<module-cachix>>
  333. <<module-home-manager>>
  334. ];
  335. };
  336. #+END_SRC
  337. Deploy this configuration with ~nixos-rebuild switch --flake /etc/dotfiles/#nixos~.
  338. #+BEGIN_SRC nix :noweb yes :tangle hosts/nixos/default.nix
  339. # <<file-warning>>
  340. { ... }:
  341. {
  342. imports = [
  343. ./configuration.nix
  344. ./hardware.nix
  345. ];
  346. }
  347. #+END_SRC
  348. *** Configuration
  349. This is a basic default configuration that specified the indended default configuration of the system. Because NixOS[fn:4] has a declarative configuration model, you can create or edit a description of the desired configuration, and update it from one file.
  350. #+BEGIN_SRC nix :noweb yes :tangle hosts/nixos/configuration.nix
  351. # <<file-warning>>
  352. { config, pkgs, inputs, ... }:
  353. {
  354. time.timeZone = "America/Toronto";
  355. networking.hostName = "nixos";
  356. networking.useDHCP = false;
  357. networking.firewall.enable = false;
  358. networking.interfaces.ens3.useDHCP = true;
  359. <<host-config-home>>
  360. <<host-config-ssh>>
  361. programs.mtr.enable = true;
  362. programs.fish.enable = true;
  363. programs.gnupg.agent.enable = true;
  364. users.users.chris = {
  365. shell = pkgs.fish;
  366. isNormalUser = true;
  367. extraGroups = [ "wheel" ];
  368. };
  369. }
  370. #+END_SRC
  371. *** Hardware
  372. The file system for this host is a single 24GB QCOW file, a format for disk images used by QEMU[fn:23]. The file can be recreated easily by following the steps listed in the NixOS[fn:4] installation manual, specifically the section on disk formatting.
  373. #+BEGIN_SRC nix :noweb yes :tangle hosts/nixos/hardware.nix
  374. # <<file-warning>>
  375. { config, lib, pkgs, modulesPath, ... }:
  376. {
  377. imports =
  378. [ (modulesPath + "/profiles/qemu-guest.nix")
  379. ];
  380. boot.initrd.availableKernelModules = [ "ata_piix" "floppy" "sd_mod" "sr_mod" ];
  381. boot.initrd.kernelModules = [ ];
  382. boot.kernelModules = [ ];
  383. boot.extraModulePackages = [ ];
  384. boot.loader.grub.enable = true;
  385. boot.loader.grub.version = 2;
  386. boot.loader.grub.device = "/dev/sda";
  387. fileSystems."/" =
  388. { device = "/dev/disk/by-uuid/fddc37ff-a442-41fa-afc4-abf878be7c5a";
  389. fsType = "ext4";
  390. };
  391. swapDevices =
  392. [ { device = "/dev/disk/by-uuid/5fc0e3df-e796-4fe2-8482-c6acaed9d36f"; }
  393. ];
  394. }
  395. #+END_SRC
  396. ** Acernitro
  397. My gaming laptop, the model is an Acer Nitro AN-515-53[fn:25]. The Nitro 5 has more in common with the mid-range notebooks rather than the gaming models due to its cooling design, chassis, and overall construction.
  398. Here are the specs:
  399. | Slot | Component |
  400. |---------+---------------------------------------|
  401. | CPU | Intel Core i5-8300H |
  402. | GPU | NVIDIA GeForce GTX 1050Ti (4GB GDDR5) |
  403. | RAM | 16GB DDR4 |
  404. | Display | 15.6" Full HD (1920 x 1080), IPS |
  405. | Storage | 1000GB HDD |
  406. | Weight | 2.48kg (5.5 lbs) |
  407. #+NAME: host-acernitro
  408. #+BEGIN_SRC nix :noweb yes
  409. acernitro = nixpkgs.lib.nixosSystem {
  410. system = "x86_64-linux";
  411. specialArgs = { inherit inputs; };
  412. modules = [
  413. ./hosts/acernitro
  414. <<module-x11>>
  415. <<module-ssh>>
  416. <<module-hugo>>
  417. <<module-steam>>
  418. <<module-docker>>
  419. <<module-flakes>>
  420. <<module-cachix>>
  421. <<module-nvidia>>
  422. <<module-firefox>>
  423. <<module-moonlight>>
  424. <<module-teamviewer>>
  425. <<module-home-manager>>
  426. ];
  427. };
  428. #+END_SRC
  429. Deploy this configuration with ~nixos-rebuild switch --flake /etc/dotfiles/#acernitro~.
  430. #+BEGIN_SRC nix :noweb yes :tangle hosts/acernitro/default.nix
  431. # <<file-warning>>
  432. { ... }:
  433. {
  434. imports = [
  435. ./configuration.nix
  436. ./hardware.nix
  437. ];
  438. }
  439. #+END_SRC
  440. *** Configuration
  441. This configuration is nearly identical to the default, except for a few key differences:
  442. + Enables sound
  443. + Applies the desired hostname
  444. + Enables power management daemon
  445. + It adds support for =UEFI= systems
  446. + Enables support for wireless networking
  447. #+BEGIN_SRC nix :noweb yes :tangle hosts/acernitro/configuration.nix
  448. # <<file-warning>>
  449. { config, pkgs, inputs, ... }:
  450. {
  451. time.timeZone = "America/Toronto";
  452. networking.hostName = "acernitro";
  453. networking.firewall.enable = false;
  454. networking.wireless.enable = true;
  455. networking.wireless.userControlled.enable = true;
  456. networking.useDHCP = false;
  457. networking.interfaces.enp6s0f1.useDHCP = true;
  458. networking.interfaces.wlp0s20f3.useDHCP = true;
  459. <<host-config-wifi>>
  460. <<host-config-home>>
  461. <<host-config-ssh>>
  462. services.tlp.enable = true;
  463. services.xserver.dpi = 96;
  464. services.xserver.libinput.touchpad.tapping = false;
  465. services.printing.enable = true;
  466. programs.mtr.enable = true;
  467. programs.fish.enable = true;
  468. programs.gnupg.agent.enable = true;
  469. users.users.chris = {
  470. shell = pkgs.fish;
  471. isNormalUser = true;
  472. extraGroups = [ "wheel" ];
  473. };
  474. }
  475. #+END_SRC
  476. *** Hardware
  477. + Enables sound via PulseAudio
  478. + Enables powertop via power management
  479. + Adds support for the NVIDIA Hybrid GPU
  480. #+BEGIN_SRC nix :noweb yes :tangle hosts/acernitro/hardware.nix
  481. # <<file-warning>>
  482. { config, lib, pkgs, modulesPath, ... }:
  483. {
  484. imports =
  485. [ (modulesPath + "/installer/scan/not-detected.nix")
  486. ];
  487. boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
  488. boot.initrd.kernelModules = [ ];
  489. boot.kernelModules = [ "kvm-intel" ];
  490. boot.extraModulePackages = [ ];
  491. boot.loader.systemd-boot.enable = true;
  492. boot.loader.efi.canTouchEfiVariables = true;
  493. sound.enable = true;
  494. hardware.pulseaudio.enable = true;
  495. hardware.pulseaudio.support32Bit = true;
  496. fileSystems."/" =
  497. { device = "/dev/disk/by-uuid/2f548eb9-47ce-4280-950f-9c6d1d162852";
  498. fsType = "ext4";
  499. };
  500. fileSystems."/boot" =
  501. { device = "/dev/disk/by-uuid/5BC3-73F3";
  502. fsType = "vfat";
  503. };
  504. swapDevices =
  505. [ { device = "/dev/disk/by-uuid/bef7bf62-d26f-45b1-a1f8-1227c2f8b26a"; }
  506. ];
  507. powerManagement.powertop.enable = true;
  508. powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
  509. }
  510. #+END_SRC
  511. ** Raspberry
  512. The Raspberry Pi 400[fn:26] is your complete personal computer, built into a compact keyboard. It features a quad-core, 64-bit processor, 4GB of RAM, wireless networking, dual-display output, 4k video playback, as well as a 40-pin GPIO header. It's the most powerful Raspberry Pi computer yet.
  513. #+NAME: host-raspberry
  514. #+BEGIN_SRC nix :noweb yes
  515. raspberry = nixpkgs.lib.nixosSystem {
  516. system = "aarch64-linux";
  517. specialArgs = { inherit inputs; };
  518. modules = [
  519. ./hosts/raspberry
  520. <<module-x11>>
  521. <<module-ssh>>
  522. <<module-flakes>>
  523. <<module-cachix>>
  524. <<module-home-manager>>
  525. ];
  526. };
  527. #+END_SRC
  528. Deploy this configuration with ~sudo nixos-rebuild switch --flake /etc/dotfiles/#raspberry~.
  529. #+BEGIN_SRC nix :noweb yes :tangle hosts/raspberry/default.nix
  530. # <<file-warning>>
  531. { ... }:
  532. {
  533. imports = [
  534. ./configuration.nix
  535. ./hardware.nix
  536. ];
  537. }
  538. #+END_SRC
  539. *** Configuration
  540. #+BEGIN_SRC nix :noweb yes :tangle hosts/raspberry/configuration.nix
  541. # <<file-warning>>
  542. { config, pkgs, ... }:
  543. {
  544. time.timeZone = "America/Toronto";
  545. networking.hostName = "raspberry";
  546. networking.firewall.enable = false;
  547. networking.networkmanager.enable = true;
  548. networking.interfaces.eth0.useDHCP = true;
  549. networking.interfaces.wlan0.useDHCP = true;
  550. <<host-config-home>>
  551. <<host-config-ssh>>
  552. environment.systemPackages = [
  553. pkgs.libraspberrypi
  554. pkgs.raspberrypi-eeprom
  555. ];
  556. programs.fish.enable = true;
  557. programs.gnupg.agent.enable = true;
  558. users.users.chris = {
  559. shell = pkgs.fish;
  560. isNormalUser = true;
  561. extraGroups = [ "wheel" "networkmanager" ];
  562. };
  563. }
  564. #+END_SRC
  565. *** Hardware
  566. This section is very much a work in progress. I have struggled to get this device to boot according to the NixOS documentation / wiki on the subject. It seems that when running with the vendored kernel there's an issue booting from the SD card. Nevertheless, the issue is avoided by using the standard kernel.
  567. #+BEGIN_SRC nix :noweb yes :tangle hosts/raspberry/hardware.nix
  568. # <<file-warning>>
  569. { config, pkgs, lib, inputs, ... }:
  570. {
  571. # imports = [
  572. # inputs.nixos-hardware.nixosModules.raspberry-pi-4
  573. # ];
  574. # boot.kernelPackages = pkgs.linuxPackages_rpi4;
  575. boot.tmpOnTmpfs = true;
  576. boot.initrd.availableKernelModules = [ "usbhid" "usb_storage" ];
  577. boot.kernelParams = [
  578. "8250.nr_uarts=1"
  579. "console=ttyAMA0,115200"
  580. "console=tty1"
  581. "cma=128M"
  582. ];
  583. boot.loader.grub.enable = false;
  584. boot.loader.generic-extlinux-compatible.enable = true;
  585. boot.loader.raspberryPi = {
  586. enable = true;
  587. version = 4;
  588. firmwareConfig = ''
  589. hdmi_drive=2
  590. hdmi_force_hotplug=1
  591. dtparam=sd_poll_once=on
  592. dtparam=audio=on
  593. '';
  594. };
  595. # FIXME: Requires GPU support.
  596. services.xserver.videoDrivers = [ "fbdev" ];
  597. sound.enable = true;
  598. hardware.pulseaudio.enable = true;
  599. hardware.enableRedistributableFirmware = true;
  600. # hardware.raspberry-pi."4".fkms-3d.enable = true;
  601. fileSystems = {
  602. "/" = {
  603. device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888";
  604. fsType = "ext4";
  605. options = [ "noatime" ];
  606. };
  607. };
  608. powerManagement.cpuFreqGovernor = "ondemand";
  609. }
  610. #+END_SRC
  611. ** Homecloud
  612. The Raspberry Pi Model B-8GB[fn:27] is the latest product in the popular Raspberry Pi range of computers. It offers groundbreaking increases in processor speed, multimedia performance, memory, and connectivity compared to the prior generation. On NixOS[fn:4], the Raspberry Pi family is /only/ supported on the =AArch64= platform, although there is community support for =armv6l= and =armv7l=.
  613. #+NAME: host-homecloud
  614. #+BEGIN_SRC nix :noweb yes
  615. homecloud = nixpkgs.lib.nixosSystem {
  616. system = "aarch64-linux";
  617. specialArgs = { inherit inputs; };
  618. modules = [
  619. ./hosts/homecloud
  620. <<module-ssh>>
  621. <<module-flakes>>
  622. <<module-cachix>>
  623. ];
  624. };
  625. #+END_SRC
  626. Deploy this configuration with ~sudo nixos-rebuild switch --flake /etc/dotfiles/#homecloud~.
  627. #+BEGIN_SRC nix :noweb yes :tangle hosts/homecloud/default.nix
  628. # <<file-warning>
  629. { ... }:
  630. {
  631. imports = [
  632. ./configuration.nix
  633. ./hardware.nix
  634. ];
  635. }
  636. #+END_SRC
  637. *** Configuration
  638. #+BEGIN_SRC nix :noweb yes :tangle hosts/homecloud/configuration.nix
  639. # <<file-warning>>
  640. { config, pkgs, ... }:
  641. {
  642. time.timeZone = "America/Toronto";
  643. networking.hostName = "homecloud";
  644. networking.firewall.enable = false;
  645. networking.networkmanager.enable = true;
  646. networking.interfaces.eth0.useDHCP = true;
  647. networking.interfaces.wlan0.useDHCP = true;
  648. <<host-config-wifi>>
  649. <<host-config-home>>
  650. <<host-config-ssh>>
  651. environment.systemPackages = [
  652. pkgs.libraspberrypi
  653. pkgs.raspberrypi-eeprom
  654. ];
  655. programs.fish.enable = true;
  656. programs.mtr.enable = true;
  657. users.users.chris = {
  658. shell = pkgs.fish;
  659. isNormalUser = true;
  660. extraGroups = [ "wheel" "networkmanager" ];
  661. };
  662. }
  663. #+END_SRC
  664. *** Hardware
  665. #+BEGIN_SRC nix :noweb yes :tangle hosts/homecloud/hardware.nix
  666. # <<file-warning>>
  667. { config, pkgs, lib, inputs, ... }:
  668. {
  669. # imports = [
  670. # inputs.nixos-hardware.nixosModules.raspberry-pi-4
  671. # ];
  672. # boot.kernelPackages = pkgs.linuxPackages_rpi4;
  673. boot.tmpOnTmpfs = true;
  674. boot.initrd.availableKernelModules = [ "usbhid" "usb_storage" ];
  675. boot.kernelParams = [
  676. "8250.nr_uarts=1"
  677. "console=ttyAMA0,115200"
  678. "console=tty1"
  679. "cma=128M"
  680. ];
  681. boot.loader.grub.enable = false;
  682. boot.loader.generic-extlinux-compatible.enable = true;
  683. boot.loader.raspberryPi = {
  684. enable = true;
  685. version = 4;
  686. firmwareConfig = ''
  687. hdmi_drive=2
  688. hdmi_force_hotplug=1
  689. dtparam=sd_poll_once=on
  690. dtparam=audio=on
  691. '';
  692. };
  693. # hardware.raspberry-pi."4".fkms-3d.enable = true;
  694. fileSystems = {
  695. "/" = {
  696. device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888";
  697. fsType = "ext4";
  698. options = [ "noatime" ];
  699. };
  700. };
  701. powerManagement.cpuFreqGovernor = "ondemand";
  702. }
  703. #+END_SRC
  704. ** Android
  705. This is my Samsung Galaxy S10+[fn:28] running Nix On Droid[fn:10] with the experimental support for Flakes being used to manage the configuration.
  706. #+NAME: host-android
  707. #+BEGIN_SRC nix
  708. android = (inputs.nix-on-droid.lib.aarch64-linux.nix-on-droid {
  709. config = ./hosts/android/nix-on-droid.nix;
  710. }).activationPackage;
  711. #+END_SRC
  712. Build the activation package with ~nix build .#android --impure~, and activate it with =result/activate=.
  713. #+BEGIN_SRC nix :noweb yes :tangle hosts/android/nix-on-droid.nix
  714. # <<file-warning>>
  715. { pkgs, ... }:
  716. {
  717. environment.packages = [
  718. pkgs.git
  719. pkgs.vim
  720. pkgs.pass
  721. pkgs.gnupg
  722. pkgs.openssh
  723. ];
  724. }
  725. #+END_SRC
  726. * Module Definitions
  727. Modules are files combined by NixOS[fn:4] to produce the full system configuration. Modules wre introduced to allow extending NixOS[fn:4] without modifying its source code. They also allow splitting up =configuration.nix=, making the system configuration easier to maintain and use.
  728. ** X11
  729. #+NAME: module-x11
  730. #+BEGIN_SRC nix
  731. ./modules/x11.nix
  732. #+END_SRC
  733. X11, or X[fn:29] is the generic name for the X Window System Display Server. All graphical GNU/Linux[fn:1] applications connect to an X-Window[fn:29] (or Wayland[fn:30]) 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.
  734. #+BEGIN_SRC nix :noweb yes :tangle modules/x11.nix
  735. # <<file-warning>>
  736. { config, pkgs, ... }:
  737. {
  738. services.xserver.enable = true;
  739. services.xserver.layout = "us";
  740. services.xserver.libinput.enable = true;
  741. services.xserver.displayManager.startx.enable = true;
  742. environment = {
  743. variables = {
  744. XDG_DESKTOP_DIR = "$HOME/";
  745. XDG_CACHE_HOME = "$HOME/.cache";
  746. XDG_CONFIG_HOME = "$HOME/.config";
  747. XDG_DATA_HOME = "$HOME/.local/share";
  748. XDG_BIN_HOME = "$HOME/.local/bin";
  749. };
  750. systemPackages = with pkgs; [
  751. pkgs.sqlite
  752. pkgs.pfetch
  753. pkgs.cmatrix
  754. pkgs.asciiquarium
  755. ];
  756. extraInit = ''
  757. export XAUTHORITY=/tmp/Xauthority
  758. export xserverauthfile=/tmp/xserverauth
  759. [ -e ~/.Xauthority ] && mv -f ~/.Xauthority "$XAUTHORITY"
  760. [ -e ~/.serverauth.* ] && mv -f ~/.serverauth.* "$xserverauthfile"
  761. '';
  762. };
  763. services.picom.enable = true;
  764. services.printing.enable = true;
  765. fonts.fonts = with pkgs; [
  766. iosevka-bin
  767. emacs-all-the-icons-fonts
  768. ];
  769. }
  770. #+END_SRC
  771. ** SSH
  772. #+NAME: module-ssh
  773. #+BEGIN_SRC nix
  774. ./modules/ssh.nix
  775. #+END_SRC
  776. OpenSSH[fn:31] is a suite of secure networking utilities based on the Secure Shell Protocol, which provides a secure channel over an unsecured network in a client-server architecture. OpenSSH[fn:31] started as a fork of the free SSH program; later versions were proprietary software.
  777. Apply some configuration to the default settings:
  778. + Disable logging in as =root=
  779. + Disable password authentication
  780. #+BEGIN_SRC nix :noweb yes :tangle modules/ssh.nix
  781. # <<file-warning>>
  782. { config, pkgs, ... }:
  783. {
  784. services.openssh = {
  785. enable = true;
  786. permitRootLogin = "no";
  787. passwordAuthentication = false;
  788. };
  789. }
  790. #+END_SRC
  791. ** Hugo
  792. #+NAME: module-hugo
  793. #+BEGIN_SRC nix
  794. ./modules/hugo.nix
  795. #+END_SRC
  796. Hugo[fn:32] is one of the most popular open-source static site generators.
  797. #+BEGIN_SRC nix :noweb yes :tangle modules/hugo.nix
  798. # <<file-warning>>
  799. { config, pkgs, ... }:
  800. let
  801. myUpdateSite = pkgs.writeShellScriptBin "update-site" ''
  802. rsync -aP /etc/dotfiles/docs/public/ ubuntu@chrishayward.xyz:/var/www/chrishayward
  803. '';
  804. in {
  805. environment.systemPackages = [
  806. pkgs.hugo
  807. myUpdateSite
  808. ];
  809. }
  810. #+END_SRC
  811. ** Flakes
  812. #+NAME: module-flakes
  813. #+BEGIN_SRC nix
  814. ./modules/flakes.nix
  815. #+END_SRC
  816. Nix Flakes[fn:33] are an upcoming feature of the Nix package manager[fn:5]. 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[fn:33] 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[fn:33] are not available unless explicitly enabled.
  817. #+BEGIN_SRC nix :noweb yes :tangle modules/flakes.nix
  818. # <<file-warning>>
  819. { config, pkgs, inputs, ... }:
  820. {
  821. nix = {
  822. package = pkgs.nixUnstable;
  823. extraOptions = ''
  824. experimental-features = nix-command flakes
  825. '';
  826. };
  827. nixpkgs = {
  828. config = { allowUnfree = true; };
  829. overlays = [ inputs.emacs-overlay.overlay ];
  830. };
  831. }
  832. #+END_SRC
  833. ** Cachix
  834. #+NAME: module-cachix
  835. #+BEGIN_SRC nix
  836. ./modules/cachix.nix
  837. #+END_SRC
  838. Cachix[fn:34] is a Command line client for Nix[fn:5] 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.
  839. #+BEGIN_SRC nix :noweb yes :tangle modules/cachix.nix
  840. # <<file-warning>>
  841. { config, ... }:
  842. {
  843. nix = {
  844. binaryCaches = [
  845. "https://nix-community.cachix.org"
  846. ];
  847. binaryCachePublicKeys = [
  848. "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
  849. ];
  850. };
  851. }
  852. #+END_SRC
  853. ** Docker
  854. #+NAME: module-docker
  855. #+BEGIN_SRC nix
  856. ./modules/docker.nix
  857. #+END_SRC
  858. Docker [fn:20] is a set of platform as a service that uses 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.
  859. #+BEGIN_SRC nix :noweb yes :tangle modules/docker.nix
  860. { config, pkgs, ... }:
  861. {
  862. # Enable the docker virutalization platform.
  863. virtualisation.docker = {
  864. enable = true;
  865. enableOnBoot = true;
  866. autoPrune.enable = true;
  867. };
  868. # Required for the `docker' command.
  869. users.users.chris.extraGroups = [ "docker" ];
  870. }
  871. #+END_SRC
  872. ** NVIDIA
  873. #+NAME: module-nvidia
  874. #+BEGIN_SRC nix
  875. ./modules/nvidia.nix
  876. #+END_SRC
  877. Use the ~lspci~ command to determine the type of graphics card you have, following the guide on NVIDIA at the NixOS Wiki[fn:35].
  878. #+BEGIN_QUOTE
  879. + MXM / output-providing card (shows as VGA Controller in lspci), i.e. graphics card in desktop computer or in some laptops
  880. + muxless/non-MXM Optimus cards have no display outputs and show as 3D Controller in lspci output, seen in most modern consumer laptops
  881. MXM cards allow you to use the Nvidia card standalone, in Non-Optimus mode. Non-MXM cards require Optimus, Nvidia's integrated-vs-discrete GPU switching technology.
  882. #+END_QUOTE
  883. Your output should look something like this:
  884. #+BEGIN_EXAMPLE
  885. ...
  886. 00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630 (Mobile)
  887. Subsystem: Acer Incorporated [ALI] Device 1264
  888. Kernel driver in use: i915
  889. Kernel modules: i915
  890. ...
  891. 01:00.0 VGA compatible controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] (rev a1)
  892. Subsystem: Acer Incorporated [ALI] Device 1265
  893. Kernel driver in use: nouveau
  894. Kernel modules: nvidiafb, nouveau
  895. 01:00.1 Audio device: NVIDIA Corporation GP107GL High Definition Audio Controller (rev a1)
  896. Kernel driver in use: snd_hda_intel
  897. Kernel modules: snd_hda_intel
  898. ...
  899. #+END_EXAMPLE
  900. This reveals the information needed, which is the information about the two display cards in the laptop:
  901. + Intel UHD :: This is the dedicated graphics on the CPU
  902. + NVIDIA GP107M :: This is the /mobile/ version of the GTX 1050ti
  903. #+BEGIN_SRC nix :noweb yes :tangle modules/nvidia.nix
  904. { config, pkgs, ... }:
  905. let
  906. myIntelBusId = "PCI:0:2:0";
  907. myNvidiaBusId = "PCI:1:0:0";
  908. myNvidiaOffload = pkgs.writeShellScriptBin "nvidia-offload" ''
  909. export __NV_PRIME_RENDER_OFFLOAD=1
  910. export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
  911. export __GLX_VENDOR_LIBRARY_NAME=nvidia
  912. export __VK_LAYER_NV_optimus=NVIDIA_only
  913. exec -a "$0" "$@"
  914. '';
  915. in {
  916. # Add the offload script to the $PATH.
  917. environment.systemPackages = [ myNvidiaOffload ];
  918. # Configure XDG compliance.
  919. environment.variables = {
  920. __GL_SHADER_DISK_CACHE_PATH = "$XDG_CACHE_HOME/nv";
  921. CUDA_CACHE_PATH = "$XDG_CACHE_HOME/nv";
  922. };
  923. # Enable the NVIDIA drivers.
  924. services.xserver.videoDrivers = [ "nvidia" ];
  925. # Fix screen tearing.
  926. services.xserver.screenSection = ''
  927. Option "metamodes" "nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On}"
  928. Option "AllowIndirectGLXProtocol" "off"
  929. Option "TripleBuffer" "on"
  930. '';
  931. # Configure `offload-mode'.
  932. hardware.nvidia.prime = {
  933. offload.enable = true;
  934. intelBusId = myIntelBusId;
  935. nvidiaBusId = myNvidiaBusId;
  936. };
  937. }
  938. #+END_SRC
  939. ** Firefox
  940. #+NAME: module-firefox
  941. #+BEGIN_SRC nix
  942. ./modules/firefox.nix
  943. #+END_SRC
  944. Firefox Browser[fn:36], 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.
  945. #+BEGIN_SRC nix :noweb yes :tangle modules/firefox.nix
  946. # <<file-warning>>
  947. { pkgs, ... }:
  948. {
  949. # NOTE: Use the binary until module is developed.
  950. environment.systemPackages = [
  951. pkgs.firefox-bin
  952. ];
  953. }
  954. #+END_SRC
  955. ** Jellyfin
  956. #+NAME: module-jellyfin
  957. #+BEGIN_SRC nix
  958. ./modules/jellyfin.nix
  959. #+END_SRC
  960. Jellyfin[fn:37] is a suite of multimedia applications designed to organize, manage, and share digital media files to networked devices. It consists of a server application installed on a machine, and another application running as a client on devices such as Smartphones, Tablets, SmartTVs, Streaming Media Players, Game Consoles, or in a Web Browser. It can also serve media to DLNA and Chromecast enabled devices. It's free and open-source software fork of Emby.
  961. #+BEGIN_SRC nix :noweb yes :tangle modules/jellyfin.nix
  962. # <<file-warning>>
  963. { config, pkgs, ... }:
  964. {
  965. services.jellyfin = {
  966. enable = true;
  967. };
  968. }
  969. #+END_SRC
  970. ** Moonlight
  971. #+NAME: module-moonlight
  972. #+BEGIN_SRC nix
  973. ./modules/moonlight.nix
  974. #+END_SRC
  975. Moonlight[fn:38] is an open-source implementation of NVIDIA's GameStream Protocol. You can stream your collection of PC games from your GameStream-compatible PC to any supported device and play them remotely. Moonlight[fn:38] is perfect for gaming on the go (or on GNU/Linux[fn:1]) without sacrificing the graphics and game selection available for the PC.
  976. #+BEGIN_SRC nix :noweb yes :tangle modules/moonlight.nix
  977. # <<file-warning>>
  978. { pkgs, ... }:
  979. {
  980. environment.systemPackages = [
  981. pkgs.moonlight-qt
  982. ];
  983. }
  984. #+END_SRC
  985. ** Teamviewer
  986. #+NAME: module-teamviewer
  987. #+BEGIN_SRC nix
  988. ./modules/teamviewer.nix
  989. #+END_SRC
  990. The Teamviewer[fn:39] remote connectivity cloud platform enables secure remote access to any device, across platforms, from anywhere, anytime. Teamviewer[fn:39] connects computers, smartphones, servers, IoT devices, robots -- anything -- with fast, high performance connections through their global access network. It has been used in outer-space low-bandwidth environments.
  991. #+BEGIN_SRC nix :noweb yes :tangle modules/teamviewer.nix
  992. # <<file-warning>>
  993. { pkgs, ... }:
  994. {
  995. # NOTE: Neither of these are working!
  996. # services.teamviewer.enable = true;
  997. # environment.systemPackages = [
  998. # pkgs.teamviewer
  999. # ];
  1000. }
  1001. #+END_SRC
  1002. ** Home Manager
  1003. Home Manager[fn:7] 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.
  1004. #+NAME: module-home-manager
  1005. #+BEGIN_SRC nix :noweb yes
  1006. inputs.home-manager.nixosModules.home-manager {
  1007. home-manager.useGlobalPkgs = true;
  1008. home-manager.useUserPackages = true;
  1009. home-manager.users.chris = {
  1010. imports = [
  1011. <<module-git>>
  1012. <<module-gpg>>
  1013. <<module-vim>>
  1014. <<module-gtk>>
  1015. <<module-emacs>>
  1016. ];
  1017. };
  1018. }
  1019. #+END_SRC
  1020. *** Git
  1021. #+NAME: module-git
  1022. #+BEGIN_SRC nix
  1023. ./modules/git.nix
  1024. #+END_SRC
  1025. Git[fn:40] 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.
  1026. #+BEGIN_SRC nix :noweb yes :tangle modules/git.nix
  1027. # <<file-warning>>
  1028. { pkgs, ... }:
  1029. let
  1030. # Fix any corruptions in the local copy.
  1031. myGitFix = pkgs.writeShellScriptBin "git-fix" ''
  1032. if [ -d .git/objects/ ]; then
  1033. find .git/objects/ -type f -empty | xargs rm -f
  1034. git fetch -p
  1035. git fsck --full
  1036. fi
  1037. exit 1
  1038. '';
  1039. in {
  1040. home.packages = [ myGitFix ];
  1041. programs.git = {
  1042. enable = true;
  1043. userName = "Christopher James Hayward";
  1044. userEmail = "chris@chrishayward.xyz";
  1045. signing = {
  1046. key = "37AB1CB72B741E478CA026D43025DCBD46F81C0F";
  1047. signByDefault = true;
  1048. };
  1049. };
  1050. }
  1051. #+END_SRC
  1052. *** Gpg
  1053. #+NAME: module-gpg
  1054. #+BEGIN_SRC nix
  1055. ./modules/gpg.nix
  1056. #+END_SRC
  1057. GNU Privacy Guard[fn:41] 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.
  1058. #+BEGIN_SRC nix :noweb yes :tangle modules/gpg.nix
  1059. # <<file-warning>>
  1060. { pkgs, ... }:
  1061. {
  1062. services.gpg-agent = {
  1063. enable = true;
  1064. defaultCacheTtl = 1800;
  1065. enableSshSupport = true;
  1066. pinentryFlavor = "gtk2";
  1067. };
  1068. }
  1069. #+END_SRC
  1070. *** Vim
  1071. #+NAME: module-vim
  1072. #+BEGIN_SRC nix
  1073. ./modules/vim.nix
  1074. #+END_SRC
  1075. Neovim[fn:42] is a project that seeks to aggressively refactor Vim in order to:
  1076. + Simplify maintenance and encourage contributions
  1077. + Split the work between multiple developers
  1078. + Enable advanced UIs without core modification
  1079. + Maximize extensibility
  1080. #+BEGIN_SRC nix :noweb yes :tangle modules/vim.nix
  1081. # <<file-warning>>
  1082. { pkgs, ... }:
  1083. {
  1084. programs.neovim = {
  1085. enable = true;
  1086. viAlias = true;
  1087. vimAlias = true;
  1088. vimdiffAlias = true;
  1089. extraConfig = ''
  1090. set number relativenumber
  1091. set nobackup
  1092. '';
  1093. extraPackages = [
  1094. pkgs.nixfmt
  1095. ];
  1096. plugins = with pkgs.vimPlugins; [
  1097. vim-nix
  1098. vim-airline
  1099. vim-polyglot
  1100. ];
  1101. };
  1102. }
  1103. #+END_SRC
  1104. *** GTK
  1105. #+NAME: module-gtk
  1106. #+BEGIN_SRC nix
  1107. ./modules/gtk.nix
  1108. #+END_SRC
  1109. GTK[fn:43] is a free and open-source, cross-platform widget toolkit for graphical user interfaces. It's one of the most popular toolkits for the Wayland[fn:30] and X11[fn:29] windowing systems.
  1110. #+BEGIN_SRC nix :noweb yes :tangle modules/gtk.nix
  1111. # <<file-warning>>
  1112. { pkgs, ... }:
  1113. {
  1114. home.packages = [
  1115. pkgs.nordic
  1116. pkgs.arc-icon-theme
  1117. pkgs.lxappearance
  1118. ];
  1119. home.file.".gtkrc-2.0" = {
  1120. text = ''
  1121. # gtk-theme-name="Nordic-Polar"
  1122. gtk-theme-name="Nordic-darker"
  1123. gtk-icon-theme-name="Arc"
  1124. gtk-font-name="Sans 10"
  1125. gtk-cursor-theme-size=0
  1126. gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ
  1127. gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
  1128. gtk-button-images=0
  1129. gtk-menu-images=0
  1130. gtk-enable-event-sounds=1
  1131. gtk-enable-input-feedback-sounds=1
  1132. gtk-xft-antialias=1
  1133. gtk-xft-hinting=1
  1134. gtk-xft-hintstyle="hintmedium"
  1135. '';
  1136. };
  1137. }
  1138. #+END_SRC
  1139. * Emacs Configuration
  1140. #+NAME: module-emacs
  1141. #+BEGIN_SRC nix
  1142. ./modules/emacs.nix
  1143. #+END_SRC
  1144. GNU/Emacs[fn:2] is an extensible, customizable, free/libre text editor -- and more. At its core is an interpreter for Emacs Lisp[fn:41], a dialect of the Lisp programming language with extensions to support text editing. Other features include:
  1145. + Highly customizable
  1146. + Full Unicopde support
  1147. + Content-aware editing modes
  1148. + Complete built-in documentation
  1149. + Wide range of functionality beyond text editing
  1150. #+BEGIN_SRC nix :noweb yes :tangle modules/emacs.nix
  1151. # <<file-warning>>
  1152. { pkgs, ... }:
  1153. let
  1154. myEmacs = pkgs.emacsWithPackagesFromUsePackage {
  1155. config = ../README.org;
  1156. package = <<emacs-native-comp-package>>
  1157. alwaysEnsure = true;
  1158. alwaysTangle = true;
  1159. extraEmacsPackages = epkgs: [
  1160. # Required packages...
  1161. <<emacs-exwm-package>>
  1162. <<emacs-evil-package>>
  1163. <<emacs-general-package>>
  1164. <<emacs-which-key-package>>
  1165. # Optional packages.
  1166. <<emacs-org-package>>
  1167. <<emacs-org-roam-package>>
  1168. <<emacs-org-drill-package>>
  1169. <<emacs-pomodoro-package>>
  1170. <<emacs-writegood-package>>
  1171. <<emacs-http-package>>
  1172. <<emacs-hugo-package>>
  1173. <<emacs-reveal-package>>
  1174. <<emacs-pass-package>>
  1175. <<emacs-mu4e-package>>
  1176. <<emacs-dired-package>>
  1177. <<emacs-icons-package>>
  1178. <<emacs-emoji-package>>
  1179. <<emacs-eshell-package>>
  1180. <<emacs-vterm-package>>
  1181. <<emacs-magit-package>>
  1182. <<emacs-fonts-package>>
  1183. <<emacs-elfeed-package>>
  1184. <<emacs-nix-mode-package>>
  1185. <<emacs-projectile-package>>
  1186. <<emacs-lsp-package>>
  1187. <<emacs-company-package>>
  1188. <<emacs-ccls-package>>
  1189. <<emacs-golang-package>>
  1190. <<emacs-python-package>>
  1191. <<emacs-rustic-package>>
  1192. <<emacs-plantuml-package>>
  1193. <<emacs-protobuf-package>>
  1194. <<emacs-swiper-package>>
  1195. <<emacs-desktop-package>>
  1196. <<emacs-doom-themes-package>>
  1197. <<emacs-doom-modeline-package>>
  1198. ];
  1199. };
  1200. in {
  1201. home.packages = [
  1202. <<emacs-exwm-extras>>
  1203. <<emacs-pass-extras>>
  1204. <<emacs-mu4e-extras>>
  1205. <<emacs-aspell-extras>>
  1206. <<emacs-texlive-extras>>
  1207. <<emacs-desktop-extras>>
  1208. <<emacs-plantuml-extras>>
  1209. <<emacs-nix-mode-extras>>
  1210. ];
  1211. programs.emacs = {
  1212. enable = true;
  1213. package = myEmacs;
  1214. };
  1215. <<emacs-exwm-config>>
  1216. <<emacs-exwm-xinitrc>>
  1217. <<emacs-mu4e-config>>
  1218. }
  1219. #+END_SRC
  1220. 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.
  1221. #+BEGIN_SRC emacs-lisp :noweb yes :tangle ~/.emacs.d/init.el
  1222. ;; <<file-warning>>
  1223. ;; Required inputs.
  1224. <<emacs-exwm-elisp>>
  1225. <<emacs-evil-elisp>>
  1226. <<emacs-general-elisp>>
  1227. <<emacs-which-key-elisp>>
  1228. ;; Optional inputs.
  1229. <<emacs-org-elisp>>
  1230. <<emacs-org-roam-elisp>>
  1231. <<emacs-org-drill-elisp>>
  1232. <<emacs-org-agenda-elisp>>
  1233. <<emacs-pomodoro-elisp>>
  1234. <<emacs-writegood-elisp>>
  1235. <<emacs-aspell-elisp>>
  1236. <<emacs-eww-elisp>>
  1237. <<emacs-http-elisp>>
  1238. <<emacs-hugo-elisp>>
  1239. <<emacs-reveal-elisp>>
  1240. <<emacs-pass-elisp>>
  1241. <<emacs-erc-elisp>>
  1242. <<emacs-mu4e-elisp>>
  1243. <<emacs-dired-elisp>>
  1244. <<emacs-icons-elisp>>
  1245. <<emacs-emoji-elisp>>
  1246. <<emacs-eshell-elisp>>
  1247. <<emacs-vterm-elisp>>
  1248. <<emacs-magit-elisp>>
  1249. <<emacs-fonts-elisp>>
  1250. <<emacs-elfeed-elisp>>
  1251. <<emacs-projectile-elisp>>
  1252. <<emacs-lsp-elisp>>
  1253. <<emacs-company-elisp>>
  1254. <<emacs-golang-elisp>>
  1255. <<emacs-python-elisp>>
  1256. <<emacs-rustic-elisp>>
  1257. <<emacs-plantuml-elisp>>
  1258. <<emacs-desktop-elisp>>
  1259. ;; User interface.
  1260. <<emacs-swiper-elisp>>
  1261. <<emacs-transparency-elisp>>
  1262. <<emacs-doom-themes-elisp>>
  1263. <<emacs-doom-modeline-elisp>>
  1264. #+END_SRC
  1265. 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=.
  1266. #+BEGIN_SRC emacs-lisp :noweb yes :tangle ~/.emacs.d/early-init.el
  1267. ;; <<file-warning>>
  1268. <<emacs-disable-ui-elisp>>
  1269. <<emacs-native-comp-elisp>>
  1270. <<emacs-backup-files-elisp>>
  1271. <<emacs-shell-commands-elisp>>
  1272. #+END_SRC
  1273. ** Disable UI
  1274. Emacs[fn:2] 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.
  1275. #+NAME: emacs-disable-ui-elisp
  1276. #+BEGIN_SRC emacs-lisp
  1277. ;; Disable unwanted UI elements.
  1278. (tooltip-mode -1)
  1279. (menu-bar-mode -1)
  1280. (tool-bar-mode -1)
  1281. (scroll-bar-mode -1)
  1282. ;; Fix the scrolling behaviour.
  1283. (setq scroll-conservatively 101)
  1284. ;; Fix mouse-wheel scrolling behaviour.
  1285. (setq mouse-wheel-follow-mouse t
  1286. mouse-wheel-progressive-speed t
  1287. mouse-wheel-scroll-amount '(3 ((shift) . 3)))
  1288. ;; Start in fullscreen/maximized.
  1289. (add-to-list 'default-frame-alist '(fullscreen . maximized))
  1290. #+END_SRC
  1291. ** Native Comp
  1292. #+NAME: emacs-native-comp-package
  1293. #+BEGIN_SRC nix
  1294. pkgs.emacsGcc;
  1295. #+END_SRC
  1296. Native Comp, also known as GccEmacs, refers to the ~--with-native-compilation~ configuration option when building GNU/Emacs[fn:2]. It adds support for compiling 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.
  1297. #+NAME: emacs-native-comp-elisp
  1298. #+BEGIN_SRC emacs-lisp
  1299. ;; Silence warnings from packages that don't support `native-comp'.
  1300. (setq comp-async-report-warnings-errors nil ;; Emacs 27.2 ...
  1301. native-comp-async-report-warnings-errors nil) ;; Emacs 28+ ...
  1302. #+END_SRC
  1303. ** Backup Files
  1304. Emacs[fn:2] 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.
  1305. #+NAME: emacs-backup-files-elisp
  1306. #+BEGIN_SRC emacs-lisp
  1307. ;; Disable unwanted features.
  1308. (setq make-backup-files nil
  1309. create-lockfiles nil)
  1310. #+END_SRC
  1311. ** Shell Commands
  1312. Define some methods for interaction between GNU/Emacs[fn:2], and the systems underyling shell:
  1313. 1) Method to run an external process, launching any application on a new process without interferring with Emacs[fn:2]
  1314. 2) Method to apply commands to the curren call process, effecting the running instance of Emacs[fn:2]
  1315. #+NAME: emacs-shell-commands-elisp
  1316. #+BEGIN_SRC emacs-lisp
  1317. ;; Define a method to run an external process.
  1318. (defun dotfiles/run (cmd)
  1319. "Run an external process."
  1320. (interactive (list (read-shell-command "λ ")))
  1321. (start-process-shell-command cmd nil cmd))
  1322. ;; Define a method to run a background process.
  1323. (defun dotfiles/run-in-background (cmd)
  1324. (let ((command-parts (split-string cmd "[ ]+")))
  1325. (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))
  1326. #+END_SRC
  1327. ** Nix Mode
  1328. #+NAME: emacs-nix-mode-extras
  1329. #+BEGIN_SRC nix
  1330. pkgs.nixfmt
  1331. #+END_SRC
  1332. Nix-mode[fn:44] is an Emacs[fn:2] major mode for editing Nix[fn:5] expressions. This provides basic handling of =.nix= files. Syntax highlighting and indentation support using =SMIE= are provided.
  1333. #+NAME: emacs-nix-mode-package
  1334. #+BEGIN_SRC nix
  1335. epkgs.nix-mode
  1336. #+END_SRC
  1337. ** Evil Mode
  1338. Evil[fn:45] is an extensible VI layer for GNU/Emacs[fn:2]. It emulates the main features of Vim[fn:42], turning GNU/Emacs[fn:2] into a modal editor.
  1339. #+NAME: emacs-evil-package
  1340. #+BEGIN_SRC nix
  1341. epkgs.evil
  1342. epkgs.evil-collection
  1343. epkgs.evil-surround
  1344. epkgs.evil-nerd-commenter
  1345. #+END_SRC
  1346. The next time Emacs[fn:2] 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[fn:2] in general, Evil[fn:45] is extensible in Emacs Lisp[fn:41].
  1347. #+NAME: emacs-evil-elisp
  1348. #+BEGIN_SRC emacs-lisp
  1349. ;; Enable the Extensible VI Layer for Emacs.
  1350. (setq evil-want-integration t ;; Required for `evil-collection.'
  1351. evil-want-keybinding nil) ;; Same as above.
  1352. (evil-mode +1)
  1353. ;; Configure `evil-collection'.
  1354. (evil-collection-init)
  1355. ;; Configure `evil-surround'.
  1356. (global-evil-surround-mode +1)
  1357. ;; Configure `evil-nerd-commenter'.
  1358. (global-set-key (kbd "M-;") 'evilnc-comment-or-uncomment-lines)
  1359. #+END_SRC
  1360. ** EXWM
  1361. #+NAME: emacs-exwm-package
  1362. #+BEGIN_SRC nix
  1363. epkgs.exwm
  1364. #+END_SRC
  1365. EXWM (Emacs X Window Manager)[fn:24] is a full-featured tiling X window manager for GNU/Emacs[fn:2] built on-top of XELB. It features:
  1366. + Fully keyboard-driven operations
  1367. + Hybrid layout modes (tiling & stacking)
  1368. + Dynamic workspace support
  1369. + ICCM/EWMH compliance
  1370. #+NAME: emacs-exwm-extras
  1371. #+BEGIN_SRC nix
  1372. pkgs.nitrogen
  1373. pkgs.autorandr
  1374. #+END_SRC
  1375. 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 EXWM[fn:24].
  1376. #+NAME: emacs-exwm-config
  1377. #+BEGIN_SRC nix
  1378. xsession = {
  1379. enable = true;
  1380. windowManager.command = ''
  1381. ${pkgs.nitrogen}/bin/nitrogen --restore
  1382. ${myEmacs}/bin/emacs --daemon -f exwm-enable
  1383. ${myEmacs}/bin/emacsclient -c
  1384. '';
  1385. };
  1386. #+END_SRC
  1387. EXWM[fn:24] cannot make an X window manager by itself, this is by design; You must tell X to do it. Override the =~/.xinitrc= file to start the =xsession=.
  1388. #+NAME: emacs-exwm-xinitrc
  1389. #+BEGIN_SRC nix
  1390. home.file.".xinitrc" = {
  1391. text = ''
  1392. exec ./.xsession
  1393. '';
  1394. };
  1395. #+END_SRC
  1396. #+NAME: emacs-exwm-elisp
  1397. #+BEGIN_SRC emacs-lisp
  1398. ;; Configure `exwm'.
  1399. (setq exwm-worspace-show-all-buffers t)
  1400. (setq exwm-input-prefix-keys
  1401. '(?\M-x
  1402. ?\C-g
  1403. ?\C-\ ))
  1404. (setq exwm-input-global-keys
  1405. `(([?\s-r] . exwm-reset)
  1406. ,@(mapcar (lambda (i)
  1407. `(,(kbd (format "s-%d" i)) .
  1408. (lambda ()
  1409. (interactive)
  1410. (exwm-workspace-switch-create ,i))))
  1411. (number-sequence 0 9))))
  1412. ;; Configure `exwm-randr'.
  1413. (require 'exwm-randr)
  1414. (exwm-randr-enable)
  1415. ;; Configure custom hooks.
  1416. (setq display-time-day-and-date t)
  1417. (add-hook 'exwm-init-hook
  1418. (lambda ()
  1419. (display-battery-mode +1) ;; Display battery info (if available).
  1420. (display-time-mode +1))) ;; Display the time in the modeline.
  1421. ;; Setup buffer display names.
  1422. (add-hook 'exwm-update-class-hook
  1423. (lambda ()
  1424. (exwm-workspace-rename-buffer exwm-class-name))) ;; Use the system class name.
  1425. ;; Configure monitor hot-swapping.
  1426. (add-hook 'exwm-randr-screen-change-hook
  1427. (lambda ()
  1428. (dotfiles/run-in-background "autorandr --change --force"))) ;; Swap to the next screen config.
  1429. #+END_SRC
  1430. ** General
  1431. #+NAME: emacs-general-package
  1432. #+BEGIN_SRC nix
  1433. epkgs.general
  1434. #+END_SRC
  1435. General[fn:46] provides a more convenient method for binding keys in Emacs[fn:2], providing a unified interface for key definitions. Its primary purpose is to build on /existing/ functionality to make key definitions more clear and concise.
  1436. #+NAME: emacs-general-elisp
  1437. #+BEGIN_SRC emacs-lisp
  1438. ;; Use <SPC> as a leader key via `general.el'.
  1439. (general-create-definer dotfiles/leader
  1440. :states '(normal motion)
  1441. :keymaps 'override
  1442. :prefix "SPC"
  1443. :global-prefix "C-SPC")
  1444. ;; Find files with <SPC> <period> ...
  1445. ;; Switch buffers with <SPC> <comma> ...
  1446. (dotfiles/leader
  1447. "." '(find-file :which-key "File")
  1448. "," '(switch-to-buffer :which-key "Buffer")
  1449. "k" '(kill-buffer :which-key "Kill")
  1450. "c" '(kill-buffer-and-window :which-key "Close"))
  1451. ;; Add keybindings for executing shell commands.
  1452. (dotfiles/leader
  1453. "r" '(:ignore t :which-key "Run")
  1454. "rr" '(dotfiles/run :which-key "Run")
  1455. "ra" '(async-shell-command :which-key "Async"))
  1456. ;; Add keybindings for quitting Emacs.
  1457. (dotfiles/leader
  1458. "q" '(:ignore t :which-key "Quit")
  1459. "qq" '(save-buffers-kill-emacs :which-key "Save")
  1460. "qw" '(kill-emacs :which-key "Now")
  1461. "qf" '(delete-frame :which-key "Frame"))
  1462. ;; Add keybindings for toggles / tweaks.
  1463. (dotfiles/leader
  1464. "t" '(:ignore t :which-key "Toggle / Tweak"))
  1465. ;; Add keybindings for working with frames to replace
  1466. ;; the C-x <num> <num> method of bindings, which is awful.
  1467. (dotfiles/leader
  1468. "w" '(:ignore t :which-key "Windows")
  1469. "ww" '(window-swap-states :which-key "Swap")
  1470. "wc" '(delete-window :which-key "Close")
  1471. "wh" '(windmove-left :which-key "Left")
  1472. "wj" '(windmove-down :which-key "Down")
  1473. "wk" '(windmove-up :which-key "Up")
  1474. "wl" '(windmove-right :which-key "Right")
  1475. "ws" '(:ignore t :which-key "Split")
  1476. "wsj" '(split-window-below :which-key "Below")
  1477. "wsl" '(split-window-right :which-key "Right"))
  1478. #+END_SRC
  1479. ** Which Key
  1480. Which-key[fn:47] is a minor mode for Emacs[fn:2] that displays the key bindings following your currently entered incomplete command (prefix) in a popup or mini-buffer.
  1481. #+NAME: emacs-which-key-package
  1482. #+BEGIN_SRC nix
  1483. epkgs.which-key
  1484. #+END_SRC
  1485. #+NAME: emacs-which-key-elisp
  1486. #+BEGIN_SRC emacs-lisp
  1487. ;; Configure `which-key' to see keyboard bindings in the
  1488. ;; mini-buffer and when using M-x.
  1489. (setq which-key-idle-delay 0.0)
  1490. (which-key-mode +1)
  1491. #+END_SRC
  1492. ** EWW
  1493. The Emacs Web Wowser[fn:48] is a Web browser written in Emacs Lisp[fn:41] based on the ~shr.el~ library. It's my primary browser when it comes to text-based browsing.
  1494. + Use ~eww~ as the default browser
  1495. + Don't use any special fonts or colours
  1496. #+NAME: emacs-eww-elisp
  1497. #+BEGIN_SRC emacs-lisp
  1498. ;; Set `eww' as the default browser.
  1499. (setq browse-url-browser-function 'eww-browse-url)
  1500. ;; Configure the `shr' rendering engine.
  1501. (setq shr-use-fonts nil
  1502. shr-use-colors nil)
  1503. #+END_SRC
  1504. ** ERC
  1505. ERC[fn:49] is a powerful, modular, and extensible IRC client for GNU/Emacs[fn:2]. It's part of the GNU project, and included in Emacs.
  1506. #+NAME: emacs-erc-elisp
  1507. #+BEGIN_SRC emacs-lisp
  1508. ;; Configure `erc'.
  1509. (setq erc-autojoin-channels-alist '(("irc.libera.chat" "#emacs" "#nixos" "#org-mode" "#systemcrafters"))
  1510. erc-track-exclude-types '("JOIN" "NICK" "QUIT" "MODE")
  1511. erc-lurker-hide-list '("JOIN" "PART" "QUIT"))
  1512. ;; Configure `erc-fill-column'.
  1513. (add-hook 'window-configuration-change-hook
  1514. '(lambda ()
  1515. (setq erc-fill-column (- (window-width) 12))))
  1516. ;; Connect to IRC via `erc'.
  1517. (defun dotfiles/erc-connect ()
  1518. "Connected to IRC via `erc'."
  1519. (interactive)
  1520. (erc-tls :server "irc.libera.chat"
  1521. :port 6697
  1522. :nick "megaphone"
  1523. :password (password-store-get "megaphone@libera.chat")
  1524. :full-name "Chris Hayward"))
  1525. ;; Configure keybindings.
  1526. (dotfiles/leader
  1527. "i" '(dotfiles/erc-connect :which-key "Chat"))
  1528. #+END_SRC
  1529. ** Dired
  1530. #+NAME: emacs-dired-package
  1531. #+BEGIN_SRC nix
  1532. epkgs.dired-single
  1533. #+END_SRC
  1534. Dired[fn:50] shows a directory listing inside of an Emacs[fn:2] 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. Dired-Extra[fn:51] provides extra functionality for Dired[fn:50].
  1535. #+NAME: emacs-dired-elisp
  1536. #+BEGIN_SRC emacs-lisp
  1537. ;; Include `dired-x' for the `jump' method.
  1538. (require 'dired-x)
  1539. ;; Configure `dired-single' to support `evil' keys.
  1540. (evil-collection-define-key 'normal 'dired-mode-map
  1541. "h" 'dired-single-up-directory
  1542. "l" 'dired-single-buffer)
  1543. ;; Setup `all-the-icons' and the `dired' extension.
  1544. ;; Configure keybindings for `dired'.
  1545. (dotfiles/leader
  1546. "d" '(dired-jump :which-key "Dired"))
  1547. #+END_SRC
  1548. ** Icons
  1549. #+NAME: emacs-icons-package
  1550. #+BEGIN_SRC nix
  1551. epkgs.all-the-icons
  1552. epkgs.all-the-icons-dired
  1553. #+END_SRC
  1554. All The Icons[fn:52] is a utility package to collect various Icon Fonts and prioritize them within GNU/Emacs[fn:2].
  1555. #+NAME: emacs-icons-elisp
  1556. #+BEGIN_SRC emacs-lisp
  1557. ;; Setup `all-the-icons-dired'.
  1558. (add-hook 'dired-mode-hook 'all-the-icons-dired-mode)
  1559. ;; Display default font ligatures.
  1560. (global-prettify-symbols-mode +1)
  1561. #+END_SRC
  1562. ** Emojis
  1563. #+NAME: emacs-emoji-package
  1564. #+BEGIN_SRC nix
  1565. epkgs.emojify
  1566. #+END_SRC
  1567. Emojify[fn:53] is an Emacs[fn:2] 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.
  1568. #+NAME: emacs-emoji-elisp
  1569. #+BEGIN_SRC emacs-lisp
  1570. ;; Setup `emojify'.
  1571. (add-hook 'after-init-hook 'global-emojify-mode)
  1572. #+END_SRC
  1573. ** EShell
  1574. #+NAME: emacs-eshell-package
  1575. #+BEGIN_SRC nix
  1576. epkgs.eshell-prompt-extras
  1577. #+END_SRC
  1578. EShell [fn:54] is a shell-like command interpreter for GNU/Emacs[fn:2] implemented in Emacs Lisp[fn:41]. 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[fn:2].
  1579. #+NAME: emacs-eshell-elisp
  1580. #+BEGIN_SRC emacs-lisp
  1581. ;; Configure `eshell'.
  1582. (setq eshell-highlight-prompt nil
  1583. eshell-prefer-lisp-functions nil)
  1584. ;; Configure the lambda prompt.
  1585. (autoload 'epe-theme-lambda "eshell-prompt-extras")
  1586. (setq eshell-prompt-function 'epe-theme-lambda)
  1587. ;; Configure keybindings for `eshell'.
  1588. (dotfiles/leader
  1589. "e" '(eshell :which-key "EShell"))
  1590. #+END_SRC
  1591. ** VTerm
  1592. Emacs Libvterm (VTerm)[fn:55] is a fully-fledged terminal emulator inside GNU/Emacs[fn:2] based on Libvterm[fn:56], a blazing fast C library used in Neovim[fn:42]. As a result of using compiled code (instead of Emacs Lisp[fn:41]), VTerm[fn:55] is capable, fast, and it can seamlessly handle large outputs.
  1593. #+NAME: emacs-vterm-package
  1594. #+BEGIN_SRC nix
  1595. epkgs.vterm
  1596. #+END_SRC
  1597. #+NAME: emacs-vterm-elisp
  1598. #+BEGIN_SRC emacs-lisp
  1599. ;; Add keybindings for interacting with the shell(s).
  1600. (dotfiles/leader
  1601. "v" '(vterm :which-key "VTerm"))
  1602. #+END_SRC
  1603. ** Magit
  1604. Magit[fn:57] is an interface to the Git[fn:40] version control system, implemented as a GNU/Emacs[fn:2] package written in Elisp[fn:41]. It fills the glaring gap between the Git[fn:40] command line interface and various GUIs, letting you perform trivial as well as elaborate version control tasks within a few mnemonic key presses.
  1605. #+NAME: emacs-magit-package
  1606. #+BEGIN_SRC nix
  1607. epkgs.magit
  1608. #+END_SRC
  1609. #+NAME: emacs-magit-elisp
  1610. #+BEGIN_SRC emacs-lisp
  1611. ;; Add keybindings for working with `magit'.
  1612. (dotfiles/leader
  1613. "g" '(:ignore t :which-key "Git")
  1614. "gg" '(magit-status :which-key "Status")
  1615. "gc" '(magit-clone :which-key "Clone")
  1616. "gf" '(magit-fetch :which-key "Fetch")
  1617. "gp" '(magit-pull :which-key "Pull"))
  1618. #+END_SRC
  1619. ** Fonts
  1620. #+NAME: emacs-fonts-package
  1621. #+BEGIN_SRC nix
  1622. epkgs.hydra
  1623. #+END_SRC
  1624. #+NAME: emacs-fonts-elisp
  1625. #+BEGIN_SRC emacs-lisp
  1626. ;; Configure the font when running as `emacs-server'.
  1627. (custom-set-faces
  1628. '(default ((t (:inherit nil :height 120 :family "Iosevka")))))
  1629. ;; Set all three of Emacs' font faces.
  1630. ;; NOTE: This only works without `emacs-server'.
  1631. ;; (set-face-attribute 'default nil :font "Iosevka" :height 96)
  1632. ;; (set-face-attribute 'fixed-pitch nil :font "Iosevka" :height 96)
  1633. ;; (set-face-attribute 'variable-pitch nil :font "Iosevka" :height 96)
  1634. ;; Define a `hydra' function for scaling the text interactively.
  1635. (defhydra hydra-text-scale (:timeout 4)
  1636. "Scale text"
  1637. ("j" text-scale-decrease "Decrease")
  1638. ("k" text-scale-increase "Increase")
  1639. ("f" nil "Finished" :exit t))
  1640. ;; Create keybinding for calling the function.
  1641. (dotfiles/leader
  1642. "tf" '(hydra-text-scale/body :which-key "Font"))
  1643. #+END_SRC
  1644. ** Elfeed
  1645. #+NAME: emacs-elfeed-package
  1646. #+BEGIN_SRC nix
  1647. epkgs.elfeed
  1648. #+END_SRC
  1649. Elfeed[fn:58] is an extensible web feed reader for GNU/Emacs[fn:2], support both =Atom= and =RSS=. It requires =Emacs 24.3+= and is available for download from the standard repositories.
  1650. #+NAME: emacs-elfeed-elisp
  1651. #+BEGIN_SRC emacs-lisp
  1652. ;; Configure `elfeed'.
  1653. (setq elfeed-db-directory (expand-file-name "~/.cache/elfeed"))
  1654. ;; Add custom feeds for `elfeed' to fetch.
  1655. (setq elfeed-feeds (quote
  1656. (("https://hexdsl.co.uk/rss.xml")
  1657. ("https://lukesmith.xyz/rss.xml")
  1658. ("https://friendo.monster/rss.xml")
  1659. ("https://chrishayward.xyz/index.xml")
  1660. ("https://protesilaos.com/master.xml"))))
  1661. ;; Add custom keybindings for `elfeed'.
  1662. (dotfiles/leader
  1663. "l" '(:ignore t :which-key "Elfeed")
  1664. "ll" '(elfeed :which-key "Open")
  1665. "lu" '(elfeed-update :which-key "Update"))
  1666. #+END_SRC
  1667. ** Org Mode
  1668. #+NAME: emacs-org-package
  1669. #+BEGIN_SRC nix
  1670. epkgs.org
  1671. #+END_SRC
  1672. Org-mode[fn:59] is a document editing and organizing mode, designed for notes, planning, and authoring within the free software text editor GNU/Emacs[fn:2]. 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.
  1673. #+NAME: emacs-org-elisp
  1674. #+BEGIN_SRC emacs-lisp
  1675. ;; Configure `org-mode' source blocks.
  1676. (setq org-src-fontify-natively t ;; Make source blocks prettier.
  1677. org-src-tab-acts-natively t ;; Use TAB indents within source blocks.
  1678. org-src-preserve-indentation t ;; Stop `org-mode' from formatting blocks.
  1679. org-confirm-babel-evaluate nil) ;; Don't ask for confirmation to evaluate blocks.
  1680. ;; Add an `org-mode-hook'.
  1681. (add-hook 'org-mode-hook
  1682. (lambda ()
  1683. (org-indent-mode)
  1684. (visual-line-mode)))
  1685. ;; Remove the `Validate XHTML 1.0' message from HTML export.
  1686. (setq org-export-html-validation-link nil
  1687. org-html-validation-link nil)
  1688. ;; Configure the keywords in the TODO -> DONE sequence.
  1689. (setq org-todo-keywords '((sequence "TODO" "START" "WAIT" "DONE")))
  1690. ;; TODO: Configure default structure templates.
  1691. ;; (require 'org-tempo)
  1692. ;; Apply custom keybindings.
  1693. (dotfiles/leader
  1694. "o" '(:ignore t :which-key "Org")
  1695. "oe" '(org-export-dispatch :which-key "Export")
  1696. "ot" '(org-babel-tangle :which-key "Tangle")
  1697. "oi" '(org-toggle-inline-images :which-key "Images")
  1698. "of" '(:ignore t :which-key "Footnotes")
  1699. "ofn" '(org-footnote-normalize :which-key "Normalize"))
  1700. #+END_SRC
  1701. ** Org Roam
  1702. #+NAME: emacs-org-roam-package
  1703. #+BEGIN_SRC nix
  1704. epkgs.org-roam
  1705. epkgs.org-roam-server
  1706. #+END_SRC
  1707. Org Roam[fn:60] is a plain-text knowledge management system. It borrows principles from the Zettelkasten method[fn:61], providing a solution for non-hierarchical note-taking. It should also work as a plug-and-play solution for anyone already using Org Mode[fn:59] for their personal wiki (me). Org Roam Server[fn:62] is a Web application to visualize the Org Roam[fn:60] database. Although it should automatically reload if there's a change in the database, it can be done so manually by clicking the =reload= button on the Web interface.
  1708. #+NAME: emacs-org-roam-elisp
  1709. #+BEGIN_SRC emacs-lisp
  1710. ;; Setup `org-roam' hooks.
  1711. (add-hook 'after-init-hook
  1712. (lambda ()
  1713. (org-roam-mode)
  1714. (org-roam-server-mode)))
  1715. ;; Configure `org-roam'.
  1716. (setq org-roam-encrypt-files t
  1717. org-roam-directory (expand-file-name "/etc/dotfiles")
  1718. org-roam-capture-templates '()
  1719. org-roam-dailies-capture-templates '())
  1720. ;; Encrypt files with the public key.
  1721. (setq epa-file-select-keys 2
  1722. epa-file-encrypt-to "37AB1CB72B741E478CA026D43025DCBD46F81C0F"
  1723. epa-cache-passphrase-for-symmetric-encryption t)
  1724. ;; Define a new `title-to-slug' function to override the default `org-roam-title-to-slug' function.
  1725. ;; This is done to change the replacement character from "_" to "-".
  1726. (require 'cl-lib)
  1727. (defun dotfiles/title-to-slug (title)
  1728. "Convert TITLE to a filename-suitable slug."
  1729. (cl-flet* ((nonspacing-mark-p (char)
  1730. (eq 'Mn (get-char-code-property char 'general-category)))
  1731. (strip-nonspacing-marks (s)
  1732. (apply #'string (seq-remove #'nonspacing-mark-p
  1733. (ucs-normalize-NFD-string s))))
  1734. (cl-replace (title pair)
  1735. (replace-regexp-in-string (car pair) (cdr pair) title)))
  1736. (let* ((pairs `(("[^[:alnum:][:digit:]]" . "-") ;; Convert anything not alphanumeric.
  1737. ("--*" . "-") ;; Remove sequential dashes.
  1738. ("^-" . "") ;; Remove starting dashes.
  1739. ("-$" . ""))) ;; Remove ending dashes.
  1740. (slug (-reduce-from #'cl-replace (strip-nonspacing-marks title) pairs)))
  1741. (downcase slug))))
  1742. (setq org-roam-title-to-slug-function #'dotfiles/title-to-slug)
  1743. ;; Configure capture templates.
  1744. ;; Standard document.
  1745. (add-to-list 'org-roam-capture-templates
  1746. '("d" "Default" entry (function org-roam-capture--get-point)
  1747. "%?"
  1748. :file-name "docs/${slug}"
  1749. :unnarrowed t
  1750. :head
  1751. "
  1752. ,#+TITLE: ${title}
  1753. ,#+AUTHOR: Christopher James Hayward
  1754. ,#+EMAIL: chris@chrishayward.xyz
  1755. "))
  1756. ;; Course document.
  1757. (add-to-list 'org-roam-capture-templates
  1758. '("c" "Course" plain (function org-roam-capture--get-point)
  1759. "%?"
  1760. :file-name "docs/courses/${slug}"
  1761. :unnarrowed t
  1762. :head
  1763. "
  1764. ,#+TITLE: ${title}
  1765. ,#+SUBTITLE:
  1766. ,#+AUTHOR: Christopher James Hayward
  1767. ,#+EMAIL: chris@chrishayward.xyz
  1768. ,#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil
  1769. ,#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
  1770. "))
  1771. ;; Daily notes.
  1772. (add-to-list 'org-roam-dailies-capture-templates
  1773. '("d" "Default" entry (function org-roam-capture--get-point)
  1774. "* %?"
  1775. :file-name "docs/daily/%<%Y-%m-%d>"
  1776. :head
  1777. "
  1778. ,#+TITLE: %<%Y-%m-%d>
  1779. ,#+AUTHOR: Christopher James Hayward
  1780. ,#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil
  1781. ,#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
  1782. "))
  1783. ;; Apply custom keybindings.
  1784. (dotfiles/leader
  1785. "or" '(:ignore t :which-key "Roam")
  1786. "ori" '(org-roam-insert :which-key "Insert")
  1787. "orf" '(org-roam-find-file :which-key "Find")
  1788. "orc" '(org-roam-capture :which-key "Capture")
  1789. "orb" '(org-roam-buffer-toggle-display :which-key "Buffer"))
  1790. ;; Apply custom keybindings for dailies.
  1791. (dotfiles/leader
  1792. "ord" '(:ignore t :which-key "Dailies")
  1793. "ordd" '(org-roam-dailies-find-date :which-key "Date")
  1794. "ordt" '(org-roam-dailies-find-today :which-key "Today")
  1795. "ordm" '(org-roam-dailies-find-tomorrow :which-key "Tomorrow")
  1796. "ordy" '(org-roam-dailies-find-yesterday :which-key "Yesterday"))
  1797. #+END_SRC
  1798. ** Org Drill
  1799. #+NAME: emacs-org-drill-package
  1800. #+BEGIN_SRC nix
  1801. epkgs.org-drill
  1802. #+END_SRC
  1803. Org Drill[fn:63] is an extension for Org Mode[fn:59] that uses a spaced repition algorithm to conduct interactive /Drill Sessions/ using Org files as sources of facts to be memorized.
  1804. #+NAME: emacs-org-drill-elisp
  1805. #+BEGIN_SRC emacs-lisp
  1806. ;; Configure keybindings for `org-drill'.
  1807. (dotfiles/leader
  1808. "od" '(:ignore t :which-key "Drill")
  1809. "odd" '(org-drill :which-key "Drill")
  1810. "odc" '(org-drill-cram :which-key "Cram")
  1811. "odr" '(org-drill-resume :which-key "Resume"))
  1812. #+END_SRC
  1813. ** Org Agenda
  1814. The way Org Mode[fn:59] 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.
  1815. #+NAME: emacs-org-agenda-elisp
  1816. #+BEGIN_SRC emacs-lisp
  1817. ;; Configure `org-agenda' to use the project files.
  1818. (setq org-agenda-files '("/etc/dotfiles/"
  1819. "/etc/dotfiles/docs/"
  1820. "/etc/dotfiles/docs/courses/"
  1821. "/etc/dotfiles/docs/daily/"
  1822. "/etc/dotfiles/docs/notes/"
  1823. "/etc/dotfiles/docs/posts/"
  1824. "/etc/dotfiles/docs/slides/"))
  1825. ;; Include files encrypted with `gpg'.
  1826. (require 'org)
  1827. (unless (string-match-p "\\.gpg" org-agenda-file-regexp)
  1828. (setq org-agenda-file-regexp
  1829. (replace-regexp-in-string "\\\\\\.org" "\\\\.org\\\\(\\\\.gpg\\\\)?"
  1830. org-agenda-file-regexp)))
  1831. ;; Open an agenda buffer with SPC o a.
  1832. (dotfiles/leader
  1833. "oa" '(org-agenda :which-key "Agenda"))
  1834. #+END_SRC
  1835. ** Org Pomodoro
  1836. #+NAME: emacs-pomodoro-package
  1837. #+BEGIN_SRC nix
  1838. epkgs.org-pomodoro
  1839. #+END_SRC
  1840. Org Pomodoro[fn:64] adds basic support for the Pomodoro Technique[fn:65] in GNU/Emacs[fn:2]. 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.
  1841. #+NAME: emacs-pomodoro-elisp
  1842. #+BEGIN_SRC emacs-lisp
  1843. ;; Configure `org-pomodor' with the overtime workflow.
  1844. (setq org-pomodoro-manual-break t
  1845. org-pomodoro-keep-killed-time t)
  1846. ;; Configure keybindings.
  1847. (dotfiles/leader
  1848. "op" '(org-pomodoro :which-key "Pomodoro"))
  1849. #+END_SRC
  1850. ** Writegood Mode
  1851. #+NAME: emacs-writegood-package
  1852. #+BEGIN_SRC nix
  1853. epkgs.writegood-mode
  1854. #+END_SRC
  1855. Writegood Mode[fn:66] is an Emacs[fn:2] minor mode to aid in finding common writing problems. It highlights the text based on the following criteria:
  1856. + Weasel Words
  1857. + Passive Voice
  1858. + Duplicate Words
  1859. #+NAME: emacs-writegood-elisp
  1860. #+BEGIN_SRC emacs-lisp
  1861. ;; Configure `writegood-mode'.
  1862. (dotfiles/leader
  1863. "tg" '(writegood-mode :which-key "Grammar"))
  1864. #+END_SRC
  1865. ** Aspell
  1866. #+NAME: emacs-aspell-extras
  1867. #+BEGIN_SRC nix
  1868. pkgs.aspell
  1869. pkgs.aspellDicts.en
  1870. pkgs.aspellDicts.en-science
  1871. pkgs.aspellDicts.en-computers
  1872. #+END_SRC
  1873. GNU Aspell[fn:67] 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.
  1874. #+NAME: emacs-aspell-elisp
  1875. #+BEGIN_SRC emacs-lisp
  1876. ;; Use `aspell' as a drop-in replacement for `ispell'.
  1877. (setq ispell-program-name "aspell"
  1878. ispell-eextra-args '("--sug-mode=fast"))
  1879. ;; Configure the built-in `flyspell-mode'.
  1880. (dotfiles/leader
  1881. "ts" '(flyspell-mode :which-key "Spelling"))
  1882. #+END_SRC
  1883. ** TexLive
  1884. TeX Live[fn:68] 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/[fn:69]:
  1885. | Name | Derivation | Comment |
  1886. |---------+---------------------------------+------------------------------------------------------------|
  1887. | Full | texlive.combined.scheme-full | Contains every TeX Live package |
  1888. | Medium | texlive.combined.scheme-medium | Contains everything in small + more packages and languages |
  1889. | Small | texlive.combined.scheme-small | Contains everything in basic + xetex + metapost |
  1890. | Basic | texlive.combined.scheme-basic | Contains everything in the plain scheme but includes latex |
  1891. | Minimal | texlive.combined.scheme-minimal | Contains plain only |
  1892. #+NAME: emacs-texlive-extras
  1893. #+BEGIN_SRC nix
  1894. pkgs.texlive.combined.scheme-full
  1895. #+END_SRC
  1896. ** Http
  1897. #+NAME: emacs-http-package
  1898. #+BEGIN_SRC nix
  1899. epkgs.ob-http
  1900. #+END_SRC
  1901. It's possible to make HTTP requests from Org Mode buffers using ob-http[fn:70], this relies on Org Babel being present and configured properly.
  1902. #+NAME: emacs-http-elisp
  1903. #+BEGIN_SRC emacs-lisp
  1904. ;; Required to setup `ob-http'.
  1905. (org-babel-do-load-languages
  1906. 'org-babel-load-languages
  1907. '((http . t)))
  1908. #+END_SRC
  1909. ** Hugo
  1910. #+NAME: emacs-hugo-package
  1911. #+BEGIN_SRC nix
  1912. epkgs.ox-hugo
  1913. #+END_SRC
  1914. Ox-Hugo[fn:71] is an Org-Mode[fn:59] exporter for Hugo[fn:32] compabile markdown. I post nonsense on my Personal Blog[fn:72], and share my notes on various textbooks, articles, and software Here[fn:73].
  1915. #+NAME: emacs-hugo-elisp
  1916. #+BEGIN_SRC emacs-lisp
  1917. ;; Configure `ox-hugo' as an `org-mode-export' backend.
  1918. (require 'ox-hugo)
  1919. ;; Capture templates.
  1920. ;; Personal blog post.
  1921. (add-to-list 'org-roam-capture-templates
  1922. '("p" "Post" plain (function org-roam-capture--get-point)
  1923. "%?"
  1924. :file-name "docs/posts/${slug}"
  1925. :unnarrowed t
  1926. :head
  1927. "
  1928. ,#+TITLE: ${title}
  1929. ,#+AUTHOR: Christopher James Hayward
  1930. ,#+DATE: %<%Y-%m-%d>
  1931. ,#+OPTIONS: num:nil todo:nil tasks:nil
  1932. ,#+EXPORT_FILE_NAME: ${slug}
  1933. ,#+ROAM_KEY: https://chrishayward.xyz/posts/${slug}/
  1934. ,#+HUGO_BASE_DIR: ../
  1935. ,#+HUGO_AUTO_SET_LASTMOD: t
  1936. ,#+HUGO_SECTION: posts
  1937. ,#+HUGO_DRAFT: true
  1938. "))
  1939. ;; Shared notes.
  1940. (add-to-list 'org-roam-capture-templates
  1941. '("n" "Notes" plain (function org-roam-capture--get-point)
  1942. "%?"
  1943. :file-name "docs/notes/${slug}"
  1944. :unnarrowed t
  1945. :head
  1946. "
  1947. ,#+TITLE: ${title}
  1948. ,#+AUTHOR: Christopher James Hayward
  1949. ,#+OPTIONS: num:nil todo:nil tasks:nil
  1950. ,#+EXPORT_FILE_NAME: ${slug}
  1951. ,#+ROAM_KEY: https://chrishayward.xyz/notes/${slug}/
  1952. ,#+HUGO_BASE_DIR: ../
  1953. ,#+HUGO_AUTO_SET_LASTMOD: t
  1954. ,#+HUGO_SECTION: notes
  1955. ,#+HUGO_DRAFT: true
  1956. "))
  1957. #+END_SRC
  1958. ** Reveal
  1959. #+NAME: emacs-reveal-package
  1960. #+BEGIN_SRC nix
  1961. epkgs.ox-reveal
  1962. #+END_SRC
  1963. Reveal.js[fn:74] is an open source HTML presentation framework. It enables anyone with a web browser to create fully-featured and beautiful presentations for free. Presentations with Reveal.js[fn:74] are built on open web technologies. That means anything you can do on the web, you can do in your presentation. Ox Reveal[fn:75] is an Org Mode[fn:59] export backend.
  1964. #+NAME: emacs-reveal-elisp
  1965. #+BEGIN_SRC emacs-lisp
  1966. ;; Configure `ox-reveal' as an `org-mode-export' backend.
  1967. (require 'ox-reveal)
  1968. ;; Don't rely on any local software.
  1969. (setq org-reveal-root "https://cdn.jsdelivr.net/npm/reveal.js")
  1970. ;; Create a capture template.
  1971. (add-to-list 'org-roam-capture-templates
  1972. '("s" "Slides" plain (function org-roam-capture--get-point)
  1973. "%?"
  1974. :file-name "docs/slides/${slug}"
  1975. :unnarrowed t
  1976. :head
  1977. "
  1978. ,#+TITLE: ${title}
  1979. ,#+AUTHOR: Christopher James Hayward
  1980. ,#+EMAIL: chris@chrishayward.xyz
  1981. ,#+REVEAL_ROOT: https://cdn.jsdelivr.net/npm/reveal.js
  1982. ,#+REVEAL_THEME: serif
  1983. ,#+EXPORT_FILE_NAME: ${slug}
  1984. ,#+OPTIONS: reveal_title_slide:nil
  1985. ,#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil
  1986. ,#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
  1987. "))
  1988. #+END_SRC
  1989. ** Passwords
  1990. #+NAME: emacs-pass-extras
  1991. #+BEGIN_SRC nix
  1992. pkgs.pass
  1993. #+END_SRC
  1994. With Pass[fn:76], each password lives inside of an encrypted =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.
  1995. #+NAME: emacs-pass-package
  1996. #+BEGIN_SRC nix
  1997. epkgs.password-store
  1998. #+END_SRC
  1999. Configure keybindings for passwords behind =SPC p=:
  2000. #+NAME: emacs-pass-elisp
  2001. #+BEGIN_SRC emacs-lisp
  2002. ;; Set the path to the password store.
  2003. (setq password-store-dir (expand-file-name "~/.password-store"))
  2004. ;; Apply custom keybindings.
  2005. (dotfiles/leader
  2006. "p" '(:ignore t :which-key "Passwords")
  2007. "pp" '(password-store-copy :which-key "Copy")
  2008. "pr" '(password-store-rename :which-key "Rename")
  2009. "pg" '(password-store-generate :which-key "Generate"))
  2010. #+END_SRC
  2011. ** MU4E
  2012. #+NAME: emacs-mu4e-extras
  2013. #+BEGIN_SRC nix
  2014. pkgs.mu
  2015. pkgs.isync
  2016. #+END_SRC
  2017. #+NAME: emacs-mu4e-package
  2018. #+BEGIN_SRC nix
  2019. epkgs.mu4e-alert
  2020. #+END_SRC
  2021. #+NAME: emacs-mu4e-config
  2022. #+BEGIN_SRC nix
  2023. # Deploy the authinfo file.
  2024. home.file.".authinfo.gpg".source = ../config/authinfo.gpg;
  2025. # Deploy the isync configuration file.
  2026. home.file.".mbsyncrc" = {
  2027. text = ''
  2028. IMAPStore xyz-remote
  2029. Host mail.chrishayward.xyz
  2030. User chris@chrishayward.xyz
  2031. PassCmd "pass chrishayward.xyz/chris"
  2032. SSLType IMAPS
  2033. MaildirStore xyz-local
  2034. Path ~/.cache/mail/
  2035. Inbox ~/.cache/mail/inbox
  2036. SubFolders Verbatim
  2037. Channel xyz
  2038. Far :xyz-remote:
  2039. Near :xyz-local:
  2040. Patterns * !Archives
  2041. Create Both
  2042. Expunge Both
  2043. SyncState *
  2044. '';
  2045. };
  2046. #+END_SRC
  2047. #+BEGIN_SRC sh
  2048. mbsync -a
  2049. mu init --maildir="~/.cache/mail" --my-address="chris@chrishayward.xyz"
  2050. mu index
  2051. #+END_SRC
  2052. #+NAME: emacs-mu4e-elisp
  2053. #+BEGIN_SRC emacs-lisp
  2054. ;; Add the `mu4e' shipped with `mu' to the load path.
  2055. (add-to-list 'load-path "/etc/profiles/per-user/chris/share/emacs/site-lisp/mu4e/")
  2056. (require 'mu4e)
  2057. ;; Confiugure `mu4e'.
  2058. (setq mu4e-maildir "~/.cache/mail"
  2059. mu4e-update-interval (* 5 60)
  2060. mu4e-get-mail-command "mbsync -a"
  2061. mu4e-compose-format-flowed t
  2062. mu4e-change-filenames-when-moving t
  2063. mu4e-compose-signature (concat "Chris Hayward\n"
  2064. "chris@chrishayward.xyz"))
  2065. ;; Sign all outbound email with GPG.
  2066. (add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime)
  2067. (setq message-send-mail-function 'smtpmail-send-it
  2068. mml-secure-openpgp-signers '("37AB1CB72B741E478CA026D43025DCBD46F81C0F"))
  2069. ;; Setup `mu4e' accounts.
  2070. (setq mu4e-contexts
  2071. (list
  2072. ;; Main
  2073. ;; chris@chrishayward.xyz
  2074. (make-mu4e-context
  2075. :name "Main"
  2076. :match-func
  2077. (lambda (msg)
  2078. (when msg
  2079. (string-prefix-p "/Main" (mu4e-message-field msg :maildir))))
  2080. :vars
  2081. '((user-full-name . "Christopher James Hayward")
  2082. (user-mail-address . "chris@chrishayward.xyz")
  2083. (smtpmail-smtp-server . "mail.chrishayward.xyz")
  2084. (smtpmail-smtp-service . 587)
  2085. (smtpmail-stream-type . starttls)))))
  2086. ;; Setup `mu4e-alert'.
  2087. (setq mu4e-alert-set-default-style 'libnotify)
  2088. (mu4e-alert-enable-notifications)
  2089. (mu4e-alert-enable-mode-line-display)
  2090. ;; Open the `mu4e' dashboard.
  2091. (dotfiles/leader
  2092. "m" '(mu4e :which-key "Mail"))
  2093. #+END_SRC
  2094. ** Projectile
  2095. #+NAME: emacs-projectile-package
  2096. #+BEGIN_SRC nix
  2097. epkgs.projectile
  2098. #+END_SRC
  2099. Projectile[fn:77] is a project interaction library for GNU/Emacs[fn:2]. Its goal is to provide a nice set of features operating on a project level, without introducing external dependencies.
  2100. #+NAME: emacs-projectile-elisp
  2101. #+BEGIN_SRC emacs-lisp
  2102. ;; Configure the `projectile-project-search-path'.
  2103. (setq projectile-project-search-path '("~/.local/source"))
  2104. (projectile-mode +1)
  2105. #+END_SRC
  2106. ** LSP Mode
  2107. #+NAME: emacs-lsp-package
  2108. #+BEGIN_SRC nix
  2109. epkgs.lsp-mode
  2110. epkgs.lsp-ui
  2111. #+END_SRC
  2112. The Language Server Protocol (LSP)[fn:78] defines the protocol used between an Editor or IDE, and a language server that provides features like:
  2113. + Auto Complete
  2114. + Go To Defintion
  2115. + Find All References
  2116. #+NAME: emacs-lsp-elisp
  2117. #+BEGIN_SRC emacs-lisp
  2118. ;; Configure `lsp-mode'.
  2119. (setq lsp-idle-delay 0.5
  2120. lsp-prefer-flymake t)
  2121. ;; Configure `lsp-ui'.
  2122. (setq lsp-ui-doc-position 'at-point
  2123. lsp-ui-doc-delay 0.5)
  2124. #+END_SRC
  2125. ** CCLS
  2126. #+NAME: emacs-ccls-package
  2127. #+BEGIN_SRC nix
  2128. epkgs.ccls
  2129. #+END_SRC
  2130. Emacs CCLS[fn:79] is a client for CCLS, a C/C++/Objective-C language server supporting multi-million line C++ code bases, powered by libclang.
  2131. #+NAME: emacs-ccls-elisp
  2132. #+BEGIN_SRC emacs-lisp
  2133. ;; Configure `ccls' to work with `lsp-mode'.
  2134. (defun dotfiles/ccls-hook ()
  2135. (require 'ccls)
  2136. (lsp))
  2137. ;; Configure `ccls' mode hooks.
  2138. (add-hook 'c-mode-hook 'dotfiles/ccls-hook)
  2139. (add-hook 'c++-mode-hook 'dotfiles/ccls-hook)
  2140. (add-hook 'objc-mode-hook 'dotfiles/ccls-hook)
  2141. (add-hook 'cuda-mode-hook 'dotfiles/ccls-hook)
  2142. #+END_SRC
  2143. ** Company Mode
  2144. #+NAME: emacs-company-package
  2145. #+BEGIN_SRC nix
  2146. epkgs.company
  2147. #+END_SRC
  2148. Company[fn:80] is a text completion framework for GNU/Emacs[fn:2]. The name stands for =Complete Anything=. It uses pluggable back-ends and front-ends to retieve and display completion candidates.
  2149. #+NAME: emacs-company-elisp
  2150. #+BEGIN_SRC emacs-lisp
  2151. ;; Configure `company-mode'.
  2152. (setq company-backend 'company-capf
  2153. lsp-completion-provider :capf)
  2154. ;; Enable it globally.
  2155. (global-company-mode +1)
  2156. #+END_SRC
  2157. ** Go Mode
  2158. #+NAME: emacs-golang-package
  2159. #+BEGIN_SRC nix
  2160. epkgs.go-mode
  2161. #+END_SRC
  2162. Go Mode[fn:81] is a major mode for editing Golang[fn:12] source code in GNU/Emacs[fn:2].
  2163. #+NAME: emacs-golang-elisp
  2164. #+BEGIN_SRC emacs-lisp
  2165. ;; Configure `go-mode' to work with `lsp-mode'.
  2166. (defun dotfiles/go-hook ()
  2167. (add-hook 'before-save-hook #'lsp-format-buffer t t)
  2168. (add-hook 'before-save-hook #'lsp-organize-imports t t))
  2169. ;; Configure a custom `before-save-hook'.
  2170. (add-hook 'go-mode-hook #'dotfiles/go-hook)
  2171. #+END_SRC
  2172. ** Rustic
  2173. #+NAME: emacs-rustic-package
  2174. #+BEGIN_SRC nix
  2175. epkgs.rustic
  2176. #+END_SRC
  2177. Rustic[fn:80] is a fork of rust-mode that integrates well with the Language Server Protocol[fn:76]. Include the rust shell before launching GNU/Emacs[fn:2] to use this!
  2178. #+NAME: emacs-rustic-elisp
  2179. #+BEGIN_SRC emacs-lisp
  2180. ;; Configure `rustic' with `lsp-mode'.
  2181. (setq rustic-format-on-save t
  2182. rustic-lsp-server 'rls)
  2183. #+END_SRC
  2184. ** Python Mode
  2185. #+NAME: emacs-python-package
  2186. #+BEGIN_SRC nix
  2187. epkgs.pretty-mode
  2188. #+END_SRC
  2189. The built in Python Mode[fn:82] has a nice feature set for working with Python[fn:18] code in GNU/Emacs[fn:2]. It is complimented with the addition of an LSP[fn:78] server. These tools are included in the Development Shell[fn:11] for Python[fn:18].
  2190. #+NAME: emacs-python-elisp
  2191. #+BEGIN_SRC emacs-lisp
  2192. ;; Configure `pretty-mode' to work with `python-mode'.
  2193. (add-hook 'python-mode-hook
  2194. (lambda ()
  2195. (turn-on-pretty-mode)))
  2196. #+END_SRC
  2197. ** Protobuf Mode
  2198. #+NAME: emacs-protobuf-package
  2199. #+BEGIN_SRC nix
  2200. epkgs.protobuf-mode
  2201. #+END_SRC
  2202. ** PlantUML
  2203. #+NAME: emacs-plantuml-extras
  2204. #+BEGIN_SRC nix
  2205. pkgs.plantuml
  2206. #+END_SRC
  2207. PlantUML[fn:83] is an open-source tool allowing users to create diagrams from a plain-text language. Besides various UML diagrams, PlantUML[fn:83] has support for various other software developmented related formats, as well as visualizations of =JSON= and =YAML= files.
  2208. #+NAME: emacs-plantuml-package
  2209. #+BEGIN_SRC nix
  2210. epkgs.plantuml-mode
  2211. #+END_SRC
  2212. PlantUML Mode[fn:84] is a major mode for editing PlantUML[fn:83] sources in GNU/Emacs[fn:2].
  2213. #+NAME: emacs-plantuml-elisp
  2214. #+BEGIN_SRC emacs-lisp
  2215. ;; Configure `plantuml-mode'.
  2216. (add-to-list 'org-src-lang-modes '("plantuml" . plantuml))
  2217. (org-babel-do-load-languages 'org-babel-load-languages '((plantuml . t)))
  2218. (setq plantuml-default-exec-mode 'executable
  2219. org-plantuml-exec-mode 'plantuml)
  2220. #+END_SRC
  2221. ** Swiper
  2222. #+NAME: emacs-swiper-package
  2223. #+BEGIN_SRC nix
  2224. epkgs.ivy
  2225. epkgs.counsel
  2226. epkgs.ivy-rich
  2227. epkgs.ivy-posframe
  2228. epkgs.ivy-prescient
  2229. #+END_SRC
  2230. Ivy (Swiper)[fn:85] is a generic completion mechanism for GNU/Emacs[fn:2]. 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.
  2231. #+NAME: emacs-swiper-elisp
  2232. #+BEGIN_SRC emacs-lisp
  2233. ;; Configure `ivy'.
  2234. (setq counsel-linux-app-format-function
  2235. #'counsel-linux-app-format-function-name-only)
  2236. (ivy-mode +1)
  2237. (counsel-mode +1)
  2238. ;; Configure `ivy-rich'.
  2239. (ivy-rich-mode +1)
  2240. ;; Configure `ivy-posframe'.
  2241. (setq ivy-posframe-parameters '((parent-frame nil))
  2242. ivy-posframe-display-functions-alist '((t . ivy-posframe-display)))
  2243. (ivy-posframe-mode +1)
  2244. ;; Configure `ivy-prescient'.
  2245. (setq ivy-prescient-enable-filtering nil)
  2246. (ivy-prescient-mode +1)
  2247. #+END_SRC
  2248. ** Transparency
  2249. It's possible to control the frame opacity in GNU/Emacs[fn:2]. Unlike other transparency hacks, it's not merely showing the desktop background image, but is true transparency -- you can se other windows behind the Emacs[fn:2] window.
  2250. #+NAME: emacs-transparency-elisp
  2251. #+BEGIN_SRC emacs-lisp
  2252. ;; Configure the default frame transparency.
  2253. (set-frame-parameter (selected-frame) 'alpha '(95 . 95))
  2254. (add-to-list 'default-frame-alist '(alpha . (95 . 95)))
  2255. #+END_SRC
  2256. ** Desktop Environment
  2257. #+NAME: emacs-desktop-extras
  2258. #+BEGIN_SRC nix
  2259. pkgs.brightnessctl
  2260. #+END_SRC
  2261. The Desktop Environment[fn:86] package provides commands and a global minor mode for controlling your GNU/Linux[fn:1] desktop from within GNU/Emacs[fn:2].
  2262. #+NAME: emacs-desktop-package
  2263. #+BEGIN_SRC nix
  2264. epkgs.desktop-environment
  2265. #+END_SRC
  2266. 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.
  2267. #+NAME: emacs-desktop-elisp
  2268. #+BEGIN_SRC emacs-lisp
  2269. ;; Configure `desktop-environment'.
  2270. (require 'desktop-environment)
  2271. (desktop-environment-mode +1)
  2272. #+END_SRC
  2273. ** Doom Themes
  2274. #+NAME: emacs-doom-themes-package
  2275. #+BEGIN_SRC nix
  2276. epkgs.doom-themes
  2277. #+END_SRC
  2278. Doom Themes[fn:87] is a theme megapack for GNU/Emacs[fn:2], inspired by community favourites.
  2279. #+NAME: emacs-doom-themes-elisp
  2280. #+BEGIN_SRC emacs-lisp
  2281. ;; Include modern themes from `doom-themes'.
  2282. (setq doom-themes-enable-bold t
  2283. doom-themes-enable-italic t)
  2284. ;; Load the `doom-nord' and `doom-nord-light' themes.
  2285. ;; (load-theme 'doom-nord-light t)
  2286. (load-theme 'doom-nord t)
  2287. (doom-modeline-mode +1)
  2288. ;; Load a new theme with <SPC> t t.
  2289. (dotfiles/leader
  2290. "tt" '(counsel-load-theme :which-key "Theme"))
  2291. #+END_SRC
  2292. ** Doom Modeline
  2293. #+NAME: emacs-doom-modeline-package
  2294. #+BEGIN_SRC nix
  2295. epkgs.doom-modeline
  2296. #+END_SRC
  2297. Doom Modeline[fn:25] is a fancy and fast modeline inspired by minimalism design. It's integrated into Centaur Emacs, Doom Emacs, and Spacemacs.
  2298. #+NAME: emacs-doom-modeline-elisp
  2299. #+BEGIN_SRC emacs-lisp
  2300. ;; Add the `doom-modeline' after initialization.
  2301. (add-hook 'after-init-hook 'doom-modeline-mode)
  2302. (setq doom-modeline-height 16
  2303. doom-modeline-icon t)
  2304. #+END_SRC
  2305. * Footnotes
  2306. [fn:1] https://gnu.org
  2307. [fn:2] https://gnu.org/software/emacs/
  2308. [fn:3] https://literateprogramming.com/knuthweb.pdf
  2309. [fn:4] https://nixos.org/manual/nixos/stable
  2310. [fn:5] https://nixos.org/manual/nix/stable
  2311. [fn:6] https://nixos.org/manual/nixpkgs/stable
  2312. [fn:7] https://github.com/nix-community/home-manager
  2313. [fn:8] https://github.com/nix-community/emacs-overlay
  2314. [fn:9] https://github.com/nixos/nixos-hardware
  2315. [fn:10] https://github.com/t184256/nix-on-droid
  2316. [fn:11] https://nixos.org/manual/nix/unstable/command-ref/nix-shell.html
  2317. [fn:12] https://golang.org
  2318. [fn:13] https://rust-lang.org
  2319. [fn:14] https://nodejs.org
  2320. [fn:15] https://grpc.io
  2321. [fn:16] https://iso.org/standard/74528.html
  2322. [fn:17] https://en.wikipedia.org/wiki/C++/
  2323. [fn:18] https://python.org
  2324. [fn:19] https://docs.docker.com/compose/
  2325. [fn:20] https://docker.org
  2326. [fn:21] https://docs.docker.com/machine/
  2327. [fn:22] https://heroku.com
  2328. [fn:23] https://qemu.org
  2329. [fn:24] https://github.com/ch11ng/exwm
  2330. [fn:25] https://laptopmedia.com/laptop-specs/acer-nitro-5-an515-53-2
  2331. [fn:26] https://raspberrypi.org/products/raspberry-pi-400/
  2332. [fn:27] https://www.raspberrypi.org/products/raspberry-pi-4-model-b/
  2333. [fn:28] https://samsung.com/us/mobile/galaxy-s10/buy/
  2334. [fn:29] https://x.org/wiki/
  2335. [fn:30] https://wayland.freedesktop.org
  2336. [fn:31] https://openssh.com
  2337. [fn:32] https://gohugo.io
  2338. [fn:33] https://nixos.wiki/wiki/Flakes
  2339. [fn:34] https://nix-community.cachix.org
  2340. [fn:35] https://nixos.wiki/wiki/Nvidia
  2341. [fn:36] https://en.wikipedia.org/wiki/Firefox
  2342. [fn:37] https://jellyfin.org
  2343. [fn:38] https://moonlight-stream.org
  2344. [fn:39] https://teamviewer.com
  2345. [fn:40] https://git-scm.com
  2346. [fn:41] https://emacswiki.org/emacs/LearnEmacsLisp
  2347. [fn:42] https://neovim.io
  2348. [fn:43] https://gtk.org
  2349. [fn:44] https://github.com/nixos/nix-mode
  2350. [fn:45] https://evil.readthedocs.io/en/latest/overview.html
  2351. [fn:46] https://github.com/noctuid/general.el
  2352. [fn:47] https://github.com/justbur/emacs-which-key
  2353. [fn:48] https://emacswiki.org/emacs/eww
  2354. [fn:49] https://gnu.org/software/emacs/erc.html
  2355. [fn:50] https://emacswiki.org/emacs/DiredMode
  2356. [fn:51] https://emacswiki.org/emacs/DiredExtra#Dired_X
  2357. [fn:52] https://github.com/domtronn/all-the-icons.el
  2358. [fn:53] https://github.com/iqbalansari/emacs-emojify
  2359. [fn:54] https://gnu.org/software/emacs/manual/html_mono/eshell.html
  2360. [fn:55] https://github.com/akermu/emacs-libvterm
  2361. [fn:56] https://github.com/neovim/libvterm
  2362. [fn:57] https://magit.vc
  2363. [fn:58] https://github.com/skeeto/elfeed
  2364. [fn:59] https://orgmode.org
  2365. [fn:60] https://github.com/org-roam/org-roam
  2366. [fn:61] https://zettelkasten.de
  2367. [fn:62] https://github.com/org-roam/org-roam-server
  2368. [fn:63] https://orgmode.org/worg/org-contrib/org-drill.html
  2369. [fn:64] https://github.com/marcinkoziej/org-pomodoro
  2370. [fn:65] https://en.wikipedia.org/wiki/Pomodoro_Technique
  2371. [fn:66] https://github.com/bnbeckwith/writegood-mode
  2372. [fn:67] https://aspell.net
  2373. [fn:68] https://wikipedia.org/wiki/Tex_Live
  2374. [fn:69] https://nixos.wiki/wiki/TexLive
  2375. [fn:70] https://github.com/zweifisch/ob-http
  2376. [fn:71] https://oxhugo.scripter.co
  2377. [fn:72] https://chrishayward.xyz/posts/
  2378. [fn:73] https://chrishayward.xyz/notes/
  2379. [fn:74] https://revealjs.com
  2380. [fn:75] https://github.com/hexmode/ox-reveal
  2381. [fn:76] https://password-store.org
  2382. [fn:77] https://projectile.mx
  2383. [fn:78] https://microsoft.github.io/language-server-protocol
  2384. [fn:79] https://github.com/MaskRay/emacs-ccls
  2385. [fn:80] https://company-mode.github.io
  2386. [fn:81] https://emacswiki.org/emacs/GoMode
  2387. [fn:82] https://plantuml.com
  2388. [fn:83] https://github.com/skuro/plantuml-mode
  2389. [fn:84] https://github.com/abo-abo/swiper
  2390. [fn:85] https://github.com/DamienCassou/desktop-environment
  2391. [fn:86] https://github.com/hlissner/emacs-doom-themes
  2392. [fn:87] https://github.com/seagle0128/doom-modeline