-
Download and install from: https://www.mozilla.org/en-US/firefox/new/
-
Open Firefox. Add to bar. Set as default browser. Login to FF sync. Hide bookmarks.
-
(macOS) disable Esc to exit fullscreen. Go to
about:config. Togglebrowser.fullscreen.exit_on_escape.
- In Terminal.app, just enter
$ git --helpA popup will appear asking if you want to install the macOS Xcode developer tools. Hit accept and install. This step will install some basic unix CLI tools, among other things.
$ ssh-keygen -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "phlip9@<hostname>"-
Note: don't use a password on Windows since the GUI password check doesn't seem to work for tty-less use (Obsidian Git)
-
Add the key to: https://github.com/settings/keys
-
Append the following to
~/.ssh/config:
Host *
UseKeychain yes
AddKeysToAgent yes
IdentityFile ~/.ssh/id_ed25519
# (OSX) Add private key to keychain
# EDIT: -A and -K are deprecated on macOS. need to do some experimenting here
$ ssh-add -AK ~/.ssh/id_ed25519$ mkdir ~/dev
$ cd ~/dev
$ git clone https://github.com/phlip9/dotfiles.git
$ cd dotfilesSee up-to-date version: https://github.com/DeterminateSystems/nix-installer/releases
$ curl --proto '=https' --tlsv1.2 -sSfL https://install.determinate.systems/nix/tag/v0.20.2 \
| bash -s -- install --diagnostic-endpoint ""
# Add these lines to /etc/nix/nix.conf
# According to <https://github.com/nix-community/nix-direnv#via-home-manager>,
# this helps protect our `nix develop` shell env from getting GC'd.
$ sudo cat >> /etc/nix/nix.conf << EOF
keep-derivations = true
keep-outputs = true
EOF
# (macOS) Also add these lines to /etc/nix/nix.conf
# TODO(phlip9): do we still need this with more recent nix version?
$ sudo cat >> /etc/nix/nix.conf << EOF
# lua-language-server seems to require this macOS system binary
extra-allowed-impure-host-deps = /usr/bin/ditto
extra-sandbox-paths = /usr/bin/ditto
EOFNOTE: this is using the unofficial DeterminateSystems nix installer.
First-time home-manager setup for a new machine:
# (if this is a new machine configuration)
$ cp ./home/phlipdesk.nix ./home/$(hostname -s).nix
# copy an existing home-manager config for the new host
$ nvim ./flake.nix
# Switch to the home-manager config for this host
$ nix run .#home-manager -- --flake .#$(hostname -s) switch
# (Linux)
# Set the login shell to the bash from nixpkgs
$ sudo usermod --shell /home/$USER/.nix-profile/bin/bash $USER
# (macOS)
$ chsh -s /Users/$USER/.nix-profile/bin/bash(macOS) Update /etc/profile to prefer nix path:
# (macOS) /etc/profile
# System-wide .profile for sh(1)
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi
if [ "$USER" == "phlip9" ] && [ -d /Users/phlip9/.nix-profile/bin ]; then
export PATH="/Users/phlip9/.nix-profile/bin:$PATH"
fi
if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fiLogout and log back in
Post initial setup, just use the alias to switch to a new home-manager config after changing one of the dotfiles:
$ hms# Generate a new ed25519 keypair
$ gpg --full-generate-key
Kind: (10) ECC (sign only)
Curve: (1) Curve25519
Expiration: 0 (none)
# The name and email must match the git config values exactly! Make sure comment
# is also empty!
Name: Philip Kannegaard Hayes
Email: [email protected]
Comment:
# List all local gpg keys that have a secret key
$ gpg --list-secret-keys --keyid-format=long
[keyboxd]
---------
sec ed25519/F93E285483EA5FD2 2024-09-13 [SC]
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
uid [ultimate] Philip Kannegaard Hayes <[email protected]>
# Copy the pubkey
$ gpg --armor --export F93E285483EA5FD2 | tee /dev/stderr | pbcopy
-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEZuOWThYJKwYBBAHaRw8BAQdAJLFRMDDy9y9KvazpZ+m56hhz+bhDU9LVp8bj
U3yKiEi0P1BoaWxpcCBLYW5uZWdhYXJkIEhheWVzIChwaGxpcHRvcC1tYnApIDxw
aGlsaXBoYXllczlAZ21haWwuY29tPoiTBBMWCgA7FiEEksZ3o5qzLB/XjoKH+T4o
VIPqX9IFAmbjlk4CGwMFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQ+T4o
VIPqX9K9OAEA/wiGADK53NUI7DZ7AXDyJNICWCekaoz6FOuaSrYUe6sBANn4BkYb
Y552/3BmTpqV0qCpW9rUMzHRb1MYPxCR2x0A
=7dDH
-----END PGP PUBLIC KEY BLOCK-----Add it to GitHub: https://github.com/settings/gpg/new
Repeat for all emails.
phlip9/dotfiles > nvim/README.md
Show hidden files by default in Finder
$ defaults write com.apple.Finder AppleShowAllFiles true- Install
interception-toolsandinterception-caps2esc
# These ppa's were out-of-date when I tried installing on a recent Pop!_OS 22.04
$ sudo add-apt-repository ppa:deafmute/interception
$ sudo apt install interception-tools interception-caps2esc- Install build pre-reqs
$ sudo apt install cmake libudev-dev libyaml-cpp-dev libevdev-dev libboost-dev- Build and install
interception-tools
$ git clone --depth 1 https://gitlab.com/interception/linux/tools.git \
interception-tools
$ cd interception-tools
$ cmake -B build -DCMAKE_BUILD_TYPE=Release
$ cmake --build build
$ sudo cmake --install build- Build and install
interception-caps2escplugin
$ git clone --depth 1 https://gitlab.com/interception/linux/plugins/caps2esc.git \
interception-caps2esc
$ cd interception-caps2esc
$ cmake -B build -DCMAKE_BUILD_TYPE=Release
$ cmake --build build
$ sudo cmake --install build- Create config dir
$ sudo mkdir -p /etc/interception/udevmon.d/- Create systemd service
# /etc/systemd/system/udevmon.service
[Unit]
Description=interception-tools udevmon service
Wants=systemd-udev-settle.service
After=systemd-udev-settle.service
Documentation=man:udev(7)
[Service]
ExecStart=/usr/local/bin/udevmon
Nice=-20
Restart=on-failure
OOMScoreAdjust=-1000
[Install]
WantedBy=multi-user.target- Enable and start udevmon service
$ sudo systemctl enable --now udevmon- Default config
# File: /etc/interception/udevmon.d/deafmute-ppa-caps2esc.yaml
- JOB: intercept -g $DEVNODE | caps2esc -m 1 | uinput -d $DEVNODE
DEVICE:
EVENTS:
EV_KEY: [KEY_CAPSLOCK, KEY_ESC]- Add
MOZ_USE_XINPUT2 DEFAULT=1to/etc/security/pam_env.confand then relog.
- Install build pre-reqs
# (Ubuntu/Debian/Pop!_OS)
$ sudo apt install cmake pkg-config libfreetype6-dev libfontconfig1-dev \
libxcb-xfixes0-dev libxkbcommon-dev- Build and install
$ git clone --filter=blob:none https://github.com/alacritty/alacritty.git
$ cd alacritty
# (Linux Wayland)
$ RUSTFLAGS="-C target-cpu=native" CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 \
cargo build \
--bin alacritty \
--release \
--no-default-features \
--features=wayland
# (Linux X11)
$ RUSTFLAGS="-C target-cpu=native" CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 \
cargo build \
--bin alacritty \
--release \
--no-default-features \
--features=x11
# (Linux) Install
$ sudo cp target/release/alacritty /usr/local/bin/
# (macOS) Build & Install
$ RUSTFLAGS="-C target-cpu=native" CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 \
make app
$ cp -r target/release/osx/Alacritty.app /Applications/- Post-build
# Install terminfo
$ sudo tic -xe alacritty,alacritty-direct extra/alacritty.info
# Install desktop entry
$ sudo cp extra/logo/alacritty-term.svg /usr/share/pixmaps/Alacritty.svg
$ sudo desktop-file-install extra/linux/Alacritty.desktop
$ sudo update-desktop-database
# Install bash completions
$ mkdir -p ~/.local/share/alacritty
$ cp extra/completions/alacritty.bash ~/.local/share/alacritty/alacritty.bash
$ chmod a+x ~/.local/share/alacritty/alacritty.bash$ sudo apt install wl-clipboard# (flatpak)
$ flatpak install flathub org.signal.Signal
# (Ubuntu/Debian)
$ curl --proto '=https' --tlsv1.3 -sL \
https://updates.signal.org/desktop/apt/keys.asc \
| gpg --dearmor \
| sudo tee /usr/share/keyrings/signal-desktop-keyring.gpg > /dev/null
$ echo "deb [arch=$(dpkg --print-architecture)" \
"signed-by=/usr/share/keyrings/signal-desktop-keyring.gpg]" \
"https://updates.signal.org/desktop/apt $(lsb_release -cs) main" \
| sudo tee /etc/apt/sources.list.d/signal-desktop.list
$ sudo apt update
$ sudo apt install signal-desktop$ systemctl --user stop tracker-miner-fs-3.service
$ systemctl --user mask tracker-miner-fs-3.service$ systemctl --user stop gnome-keyring-ssh.service
$ systemctl --user mask gnome-keyring-ssh.service
$ systemctl --user stop ssh-agent.service
$ systemctl --user mask ssh-agent.service
$ systemctl --user stop gpg-agent-ssh.service
$ systemctl --user mask gpg-agent-ssh.service- We'll update to a newer bash in a moment. For now this is nicer that dealing
with
zsh...
$ chsh -s /bin/bash- Then restart for this to take effect.
-
Download and install from: https://pqrs.org/osx/karabiner/index.html
-
Under "Complex Modifications", hit "+ Add Rule", then "Import more rules from internet"
-
Import the "Change caps_lock key (rev. 5)" rules
-
Unmap Escape
-
Remap Caps Lock -> Control when used as a modifier and Caps Lock -> Escape when hit alone
-
Download and install from: https://iterm2.com/downloads.html
-
View > Customize Touch Bar > Remove everything from the touchbar
-
Use
/bin/bashas the default shell overzsh. -
Import
onehalfdark.mod.itermcolors. Go to Preferences > Profiles > Default > Colors > Color Presets > Import. Select the file. Then make sure you actually enable the imported colorscheme in the dropdown.
$ /bin/bash -c "$(curl --proto '=https' --tlsv1.3 -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# disable analytics
$ /opt/homebrew/bin/brew analytics off$ brew install bash
# Add the brew-bash to set of acceptable login shells
$ echo "/opt/homebrew/bin/bash" | sudo tee -a /etc/shells
# Set our login shell
$ chsh -s /opt/homebrew/bin/bash$ brew install python3
# ensure your shell is reloaded with the brew python first in $PATH
# update pip stuff
$ python3 -m pip install --upgrade setuptools
$ python3 -m pip install --upgrade pip$ brew install tmux$ brew install wget htop jq$ brew install irssi$ mkdir ~/dev
$ cd ~/dev
$ git clone [email protected]:phlip9/dotfiles.git
$ python3 install.pysudo yum install autoconf automake- The default tmux version (2.2) is too old.
$ git clone [email protected]:tmux/tmux.git
$ cd tmux
$ git checkout 3.0
$ sudo yum install libevent-devel ncurses-devel
$ ./autogen.sh
$ ./configure
$ make && sudo make install- Open Control Panel > Network and Sharing Center > Change adapter settings
- Right click on the WAN-facing adapter ("Ethernet" in my case) and select "Properties"
- In the list, check "Internet Protocol Verstion 6 (TCP/IPv6)"
- Confirm with OK
- Settings > Network & Internet > Proxy > Automatically detect settings -> Off
-
Create two new rules in Windows Defender Firewall that block ports 135-139, 445 on TCP and UDP.
-
Enable > Run MSYS2 now
$ pacman --sync --refresh --sysupgrade- Run MSYS2 MSYS from the Start Menu
$ pacman --sync --sysupgrade-
Basic
pacmanreference (https://www.msys2.org/docs/package-management/) -
Add profile to Windows Terminal
settings.json
{
// ..
"profiles":
{
"list":
[
// ..
{
"closeOnExit": "always",
"commandline": "C:/msys64/msys2_shell.cmd -defterm -here -no-start -msys",
"guid": "{71160544-14d8-4194-af25-d05feeac7233}",
"icon": "C:/msys64/msys2.ico",
"name": "MSYS / MSYS2",
"startingDirectory": "C:/msys64/home/%USERNAME%"
}
],
// ..
}
}- In PowerShell
PS> Set-ExecutionPolicy RemoteSigned -scope CurrentUser
PS> iwr -useb get.scoop.sh | iex- Install mingit-busybox
PS> scoop install mingit-busybox
PS> scoop install openssh
PS> [environment]::setenvironmentvariable('GIT_SSH', (resolve-path (scoop which ssh)), 'USER')-
Install the Npcap drivers first, then nmap.
-
Remap "Special: Caps Lock" to "Special: Escape"
-
Write to Registry
-
Compile the following autohotkey script
; key_remaps.ahk
; Remap Escape -> Escape (when pressed alone)
; -> Ctrl (when pressed with other keys)
g_EscDown := 0
*Esc::
Send {Blind}{Ctrl Down}
g_EscDown := A_TickCount
Return
*Esc up::
; Modify the threshold time (in milliseconds) as necessary
If ((A_TickCount - g_EscDown) < 500 and A_PriorKey == "Escape")
Send {Blind}{Ctrl Up}{Esc}
Else
Send {Blind}{Ctrl Up}
Return
; Remap desktop switch commands
^Left::^#Left
^Right::^#Right
- Create a shortcut and add it to the Startup directory: "C:\Users\phlip9\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
-
Restart, enter BIOS, and enable Intel HyperV Virtualization
-
Open PowerShell as Admin
PS> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
PS> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart-
Restart
-
Open PowerShell as Admin
PS> wsl --set-default-version 2- Install Ubuntu 20.04 LTS (https://www.microsoft.com/store/apps/9n6svws3rx71)
Install "Cascadia Mono PL" font (https://github.com/microsoft/cascadia-code/releases)
- Install "ttf/Cascadia Mono PL.ttf" in the release zip
-
https://www.microsoft.com/en-us/p/windows-terminal-preview/9n8g5rfz9xk3
-
Open settings
-
Set "defaultProfile" to Ubuntu WSL profile's uuid
{
// ..
"confirmCloseAllTabs": false,
"alwaysShowTabs": false,
"showTabsInTitlebar": true,
"showTerminalTitleInTitlebar": true,
"theme": "dark",
"profiles": {
"defaults": {
"fontFace": "Cascadia Mode PL",
"colorScheme": "One Half Dark",
"fontSize": 10,
"padding": "16, 16, 16, 16",
"scrollbarState": "hidden"
},
"list": [ /* .. */ ],
},
// ..
}- Inside WSL, install
keychain, an ssh-agent frontend
$ sudo apt install keychainThen add AddKeysToAgent yes to ~/.ssh/config. Make sure it has the right
permissions too, chmod 644 ~/.ssh/config.
- Inside WSL install, follow "Debian|Ubuntu|WSL" setup
$ sudo apt install xdg-utils wslview
$ sudo ln -s "/mnt/c/Program Files/Mozilla Firefox/firefox.exe" /usr/local/bin/firefox$ git clone [email protected]:phlip9/notes-private.git notes- Use the
flatpakapp
# (flatpak)
$ flatpak install Obsidian- On other platforms, just download from their site: https://obsidian.md/
- Obsidian > Open folder as vault
If first time setup is already complete, then just:
$ hm switchIs your huge nix store filling up your root fs? You'll want to run nix garbage collection to clear out unused store paths.
Start by unpinning old home-manager generations:
$ hm generations
2024-05-29 11:15 : id 134 -> /nix/store/dwh7mqsji1671zy116znqiiqnvcsyh76-home-manager-generation
2024-05-28 09:07 : id 133 -> /nix/store/fxdjm1mzyaxyw575v8yn40500s22ijzv-home-manager-generation
...
$ hm expire-generations 2024-05-28Next unpin your old user profiles:
$ nix-env --delete-generations +1Unpin any old root user profiles:
$ sudo $(which nix-env) --delete-generations +1Finally run the garbage collector to actually delete all the store paths that are no longer pinned:
$ nix store gc
63704 store paths deleted, 76738.94 MiB freedThis is a good start. If you're still missing space, you'll want to clear out
any nix build ./result symlinks scattered around your fs. Nix will tell you
where they are (called GC roots):
phlip9@phlipdesk:~$ nix-store --gc --print-roots
removing stale link from '/nix/var/nix/gcroots/auto/g60p5vbf9rkyhsjqdfhp0ff2b8sw6y3q' to '/nix/var/nix/profiles/per-user/root/profile-3-link'
removing stale link from '/nix/var/nix/gcroots/auto/v73nmmh5d8van4ja5c8jn0gjlwhxbz3a' to '/nix/var/nix/profiles/per-user/root/profile-2-link'
removing stale link from '/nix/var/nix/gcroots/auto/lzjbmb2ry0z7lma2fvpqprb12921pnb5' to '/nix/var/nix/profiles/per-user/root/profile-1-link'
/home/phlip9/.cache/nix/flake-registry.json -> /nix/store/ypkhxink7miy8gw2mi88jlacl213cg4d-flake-registry.json
/home/phlip9/.local/state/home-manager/gcroots/current-home -> /nix/store/dwh7mqsji1671zy116znqiiqnvcsyh76-home-manager-generation
/home/phlip9/.local/state/nix/profiles/home-manager-133-link -> /nix/store/fxdjm1mzyaxyw575v8yn40500s22ijzv-home-manager-generation
/home/phlip9/.local/state/nix/profiles/home-manager-134-link -> /nix/store/dwh7mqsji1671zy116znqiiqnvcsyh76-home-manager-generation
/home/phlip9/.local/state/nix/profiles/profile-88-link -> /nix/store/b59q817jnxi3licvd5yjcya20j6g45ij-user-environment
/home/phlip9/.local/state/nix/profiles/profile-89-link -> /nix/store/x0dc62hgzbkjazgcj3c0wawr51gnldby-user-environment
/home/phlip9/dev/blockstream-electrs/result -> /nix/store/27zlpwjkwlykzry67cs2kcq6fgk969v4-electrs-aarch64-unknown-linux-gnu-0.4.1
/home/phlip9/dev/dotfiles/result -> /nix/store/9v3khc64b5mzfslh99hfahhdzlyx0zwg-dotenvy-0.15.7
...Then delete some and re-run the GC:
$ cd ~/dev
$ rm ./blockstream-electrs/result ./notes/result ./nix/result
$ nix store gc
4893 store paths deleted, 7355.03 MiB freed# Update `nix` cli and `nix-daemon` in the global default profile
$ sudo -i nix upgrade-nix --profile /nix/var/nix/profiles/default
# Reload systemd so it picks up the new `nix-daemon.service` unit
$ systemctl daemon-reload
# Restart nix-daemon
$ systemctl restart nix-daemon.service
# Check nix cli version
$ nix --version
# Check nix-daemon version
$ nix store info