Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
* Dotfiles A bunch of junk you probably don't want to waste time with. Using [[https://zero-to-nix.com/][Nix]] + Flakes Bootstrap is still WIP. Don't actually try to use this. ** Setup 1. Install Nix: ~curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install~. Don't @ me. 2. Start a dev shell: ~nix develop github:webframp/dotfiles~ 3. Or if cloned locally, dev shell: ~nix develop .~ 4. Run ~nix run . switch -- --flake .#hostname~ and watch it do stuff. - Optionally use ~nix --debug run . switch -- --flake .~ to get verbose output. - Non-NixOS, home-manager only configs use ~home-manager switch --flake .#user@hostname~ ** Notes *** WSL Fix for "Unable to determine time zone: No such file or directory (os error 2)" #+begin_src sh sudo timedatectl set-timezone America/New_York sudo hwclock -s #+end_src #+begin_quote The Windows Subsystem for Linux kernel can be manually updated with 'wsl --update', but automatic updates cannot occur due to your system settings. To receive automatic kernel updates, please enable the Windows Update setting: 'Receive updates for other Microsoft products when you update Windows'. For more information please visit https://aka.ms/wsl2kernel. #+end_quote **** Windows pre-reqs: scoop Install #+begin_src powershell Set-ExecutionPolicy RemoteSigned -Scope CurrentUser irm get.scoop.sh | iex #+end_src Packages #+begin_src sh scoop bucket add extras scoop bucket add nerd-fonts scoop install 7zip audacity aws bat cpu-z dark discord dotnet-sdk firefox fzf git git-credential-manager go helm Inconsolata-NF-Mono Iosevka-NF-Mono jq less neofetch neovim powertoys quicklook ripgrep signal slack spotify starship steam teamviewer terraform vcredist2022 vscode win32yank zoom zoxide #+end_src Install powershell + profile #+begin_src winget install --id Microsoft.Powershell --source winget # restart terminal code $PROFILE #+end_src *** macOS ??? *** Ubuntu ??? ** SSH Keygen Use ed25519 already. #+begin_src sh ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "use@machine: detail" #+end_src ** Emacs TODO Setup doom #+begin_src sh git clone --depth 1 https://github.com/doomemacs/doomemacs ~/.config/emacs ~/.config/emacs/bin/doom install #+end_src ** Org docs Clone org repo into ~/org ** Password Store After GPG setup, clone password store repo from backup drive, run: #+begin_src sh chown -R $(whoami) ~/.gnupg/ find ~/.gnupg -type f -exec chmod 600 {} \; find ~/.gnupg -type d -exec chmod 700 {} \; #+end_src Super minimal .bash_profile that most uses nixos defaults #+begin_src sh #!/usr/bin/env bash # # ensure defaults are loaded if test -f /etc/bashrc; then . /etc/bashrc fi # Pass alias qp='pass -c "$(find -L "$HOME/.password-store" \( -name .git\* -o -name .gpg-id \) -prune -o $@ -print 2>/dev/null | sed -e "s#${HOME}/.password-store/\{0,1\}##" -e 's#\.gpg##'|sort|fzf)"' alias qpo='pass otp -c "$(find -L "$HOME/.password-store" \( -name .git\* -o -name .gpg-id \) -prune -o $@ -print 2>/dev/null | sed -e "s#${HOME}/.password-store/\{0,1\}##" -e 's#\.gpg##'|sort|fzf)"' alias qpe='EDITOR=vim pass edit "$(find -L "$HOME/.password-store" \( -name .git\* -o -name .gpg-id \) -prune -o $@ -print 2>/dev/null | sed -e "s#${HOME}/.password-store/\{0,1\}##" -e 's#\.gpg##'|sort|fzf)"' #+end_src ** Terminal and 24bit terminfo The 24bit color config depends on a custom terminfo file in this repo. Still need to find a way to build this for systemwide config with nix. Unclear if this is useful yet: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/config/terminfo.nix For now this is handled per user automatically using home-manager in ~home/sme/global/default.nix~ with: #+begin_src nix home.file.".xterm-24bit.terminfo" = { source = ./includes/xterm-24bit.terminfo; onChange = "tic -x -o ~/.terminfo ~/.xterm-24bit.terminfo"; }; #+end_src *** Manual setup #+begin_src sh /usr/bin/tic -x -o ~/.terminfo xterm-24bit.terminfo export TERM=xterm-24bit alias ssh="TERM=xterm-256color ssh" # maybe needed #+end_src Add to tmux config #+begin_src sh set -g default-terminal "xterm-24bit" set -g terminal-overrides ',xterm-24bit:Tc' #+end_src Also make sure locale vars are set correctly #+begin_src sh export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 export LANGUAGE=en_US.UTF-8 #+end_src ** Home-Manager Architecture *** Host Configurations | Host | Platform | Integration | Config File | |------|----------|-------------|-------------| | bluestreak | macOS arm64 | home-manager standalone | ~home/sme/bluestreak.nix~ | | galvatron-wsl | NixOS x86_64 | home-manager as NixOS module | ~home/sme/galvatron-wsl.nix~ | | ubuntu-wsl | Ubuntu x86_64 | home-manager standalone | ~home/sme/ubuntu-wsl.nix~ | | generic | Linux x86_64 | home-manager standalone | ~home/sme/generic.nix~ | *** Module Strategy Shared configuration lives in ~modules/home-manager/~. Host-specific files import these modules. **** Shared Modules (universal) - ~zsh.nix~ - Shell configuration, plugins, aliases, optimizations **** Per-Host Configuration (NOT extractable) These intentionally differ per host and should remain in host-specific files: - **SSH keys** - Different key IDs per machine identity - **GPG configuration** - Per-host signing keys and agent settings - **Keychain** - References host-specific SSH/GPG keys - **Git signing** - Uses host-specific GPG key - **Platform-specific packages** - macOS vs Linux binaries **** Legacy: ~home/sme/global/~ Currently used by ubuntu-wsl, galvatron-wsl, and generic as a shared base. NOT imported by bluestreak (parallel config). Goal: Either eliminate global by extracting all shared configs into modules, or make global truly universal (importable by all hosts including bluestreak). ** Zsh Configuration The zsh configuration is managed via a custom home-manager module at ~modules/home-manager/zsh.nix~. *** Content Ordering Home-manager's zsh module uses ~lib.mkOrder~ to control where content appears in the generated ~.zshrc~. Lower priority numbers appear earlier in the file. Key priorities: | Priority | Section | |----------|----------------------------| | 100 | p10k instant prompt | | 400 | zprof (profiling) | | 600-700 | paths, fpath, NIX_PROFILES | | 900 | plugins | | 950 | compinit | | 1000+ | user content | For p10k's instant prompt to work, it must be at the very top of ~.zshrc~ (before any output). We use ~lib.mkOrder 100~ to ensure this. See: nix-community/home-manager#6479 *** Startup Optimization The module includes optimizations for faster shell startup: - Powerlevel10k instant prompt (cached prompt display) - Daily compinit caching (only regenerates completions once per 24h) - Background zcompdump compilation on login Measure startup time with: ~make zsh-bench~ ** References - https://zero-to-nix.com/ - https://github.com/Misterio77/nix-starter-configs - https://github.com/nix-community/NixOS-WSL - https://www.chrisportela.com/posts/home-manager-flake/ - https://gvolpe.com/blog/nix-flakes/ - https://nix-community.github.io/home-manager/options.html - https://medium.com/risan/upgrade-your-ssh-key-to-ed25519-c6e8d60d3c54 - https://old.reddit.com/r/tmux/comments/mesrci/tmux_2_doesnt_seem_to_use_256_colors/ - https://github.com/syl20bnr/spacemacs/wiki/Terminal - [[https://discourse.nixos.org/t/nix-flakes-nix-store-source-no-such-file-or-directory/17836/9][a bug I also hit]] * Nix cleanup Some useful cleanup commands #+begin_src sh nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than 30d nix-collect-garbage #+end_src