Skip to content
Darrion Burgess edited this page Nov 20, 2023 · 1 revision

TOC This is the configuration Neorg Workspace. This Workspace is extra special because it will be the site of an experiment.

We are going to attempt something I have wanted to try but have never felt like I had the tooling required.

Specifically, we are going to leverage the tangling feature of neorg to actually write the various configuration files needed to keep the system running.

We have gotten to the point where the code is rather concise, but it would take allot of context to understand what is going on in each file and how each one connects with the other.

This is where tangling comes in. These neorg files will actually generate the data that we expect to use throught this work.

As far as the structure goes I'm still tinkering with it but for right now I think there will be a norg file for every normal file unless they are rather small so I can ensure that everything is kept tidy

Index

Bash

Index

Neovim

Powershell

  • Profile - the bashrc equivalent for powershell
  • Alt Profile - Alternative Powershell profile with template support

Scripts

Wezterm

  • Wezterm - configuration for wezs' terminal emulator

Shell Configuration

Here, we are going to walk through any configuration that is needed for the Shell in question, this will likely look largely the same, but with minor tweaks based on the OS or if it is a work machine but should otherwise remain minimal

Chezmoi

Chezmoi is the glue that is holding all of this together, and as such should be understood first only after Neovim itself Feel free to review the Chezmoi knowledge itself for further reference, here we are just going to define our chezmoi setup and why we made the decisions we did

Config File

We are opting to do the standard chezmoi TOML file

{{ if eq .chezmoi.os "windows" }}
[cd]
command = "pwsh"
{{ end }}

[diff]
command = "nvim"
args = "-d"

[edit]
command = "nvim"

[git]
autoCommit = true
  • windows has this annoying thing where it defaults to the cmd for most things so we need to just start it in powershell whenever we use the chezmoi cd command
  • for the diffing mechanism between chezmoi and the files, I use neovim's default diff mode
    • we do this by running neovim with the -d argument
      • However, in the future I still want to change this over to using the diffview plugin instead to improve the user experience and get them all in one go
  • We are using neovim whenever we do chezmoi edit
  • Finally we have autocommit set to true so that whenever we add a change to our config it autocommits the changes to the repo to make the process of updating the config more seamless

Ignore File

Another surprisingly import file, since this is one of the main mechanisms we use to control the different configuration variations between the different OSs

{{ if ne .chezmoi.os "windows" }}
AppData/
Documents/
*.ps1
{{ else }}
dot_ssh/config
dot_config/nvim/
*.sh
bin/
{{ end }}

literate_config/
wiki/
  • If we are not in windows, we are removing the AppData, Documents, and all PowerShell files from the .chezmoiscripts directory
    • These folders are a microsoft thing, and shouldn't make their way into linux directories
      • specifically, this is where the neovim config and powershell script are respectively.
  • Otherwise, we are removing the nvim folder from the .config file
    • so we don't conflict with the version that is used in windows
  • dont forget to ignore this folder!
    • because it is not intended to be copied to the machine's home directory, it is intended to serve as the brain of the repository itself and thus should never be included
  • we have a similar thing going on with the wiki folder. this is intended to be the main point that we use to just represent the exported directory

Git

The software that has enabled all of this is Chezmoi, a dotfile manager that can give users the ability to have a single configuration with minor edits to accomodate different OSs as well as different needs for different machines.

While this wont be the main place we talk about the inner workings of Chezmoi, I will leave that to the Chezmoi Knowledge Files

Instead, here we are going to define our chezmoi files and explain why we have made the decisions we did

Our git configuration file is one of the first places where we start leveraging the template abilities of chezmoi:

[user]
{{- if eq .chezmoi.hostname "USMINDARBURGES1" }}
email = darburgess@deloitte.com
{{ else }}
email = dargondab9@gmail.com
{{- end }}
name = Darrion Burgess

[core]
symlinks = true

[credential]
{{- if eq .chezmoi.os "windows" }}
helper = C:/Program\\ Files/Git/mingw64/bin/git-credential-manager
{{- else }}
helper = /mnt/c/Program\\ Files/Git/mingw64/bin/git-credential-manager.exe
{{- end}}
  • The main variation comes with the email that gets set for the git pieces
    • the work one just changes the email to my standard work email
    • While any other time we use the standard email associated with our personal GH account
  • Finally, we are using gits' built-in credential storing feature to store our PAT tokens within the local machine
    • While it is generally considered bad-practice to store secret in plaintext in a repo, we have avoided that in the credential file itself by outsourcing this work to the 1password CLI which you will see below
  • finally we need to put in this symlinks option to make this symlink hack we are relying on work between windows and linux per This discussion about symlinks between linux and windows
  • we also also make openSSH our agent on windows per This 1password tutorial

Git Credentials Using PAT Tokens

PAT Tokens are the recommended way to get this stuff done. we are going to use 1Password to get this all going but we are just trying to make this all work

Docker

One of the primary changes that have been made over this time is the need to control one level above and handle the docker work that is required to ensure an actally working environment.

Specifically, we are going to have two separate containers:

  • The presentation container
    • used to present the wiki
Clone this wiki locally