The why for this repo is to have a reproducible setup for my different machines. I have a linux machines and work macs. Since they cannot share all of the software like DMs I try to keep the configuration as close as possible to avoid context switching. It results in some overhead and strange key combinations but I think it is worth it.
My hardware setup is a ultra wide monitor with a kvm connected to two machines.
This is a set of very opinionated configurations. The mix of shortcuts is a result of fighting with different operating machines and picking the lowest common denominator.
- Window managment with
hyprlandandaerospace. Meant to jump quickly between stable "activities" like coding, browsing, notes etc.alt + NUMgo to workspacealt + shift + NUMmove windows to workspacectrl + shift + h/j/k/lmove focusctrl + alt + shift + h/j/k/lresize windowsctrl + alt + h/j/k/lmove windowsalt + [NUM]move windows to workspace- pin applications to workspaces:
- 1: terminals (kitty)
- 2: browser (firefox)
- 3: notes
- 0: slack
neovimas main editor living mostly in long livedtmuxsessions- pretty default settings (disabled arrow keys, line numbers, relative numbers)
- debugging support
ctrl + w + h/j/k/lmove between splitsctrl + w + v/ssplit windows (vertical/horizontal)ctrl + w + oclose other windowsleader + c + gfor copying url to git code to share (works in both visual and normal mode)leader + ffor fuzzy finding filesleader + f + gfor grepping in filesleader + f + mfor fuzzy searching marksctrl + sfor accepting AI code completionsleader + c + fcopy relative file pathleader + c + tcopy file name- LSP shortcuts defined in lsp-config.lua
gdfor going to definitiongtdfor going to type definitiongrfor referencesgifor implementationgds/gwsfor document/workspace symbolsleader + FFfor formattingleader + cafor code actions]cand[cfor next/previous diagnosticleader + rnfor renamingleader + lfor enabling inlay hints (useful for rust)
tmuxfor managing terminalstmux new-session -c ~ -s mainfor creating new sessionctrl + b + cfor creating new windowctrl + b + NUMfor moving between windows [1-9]ctrl + b + ,for renaming windowctrl + b + %for splitting windowctrl + b + h/j/k/lfor moving between splitsctrl + b + [h/j/k/l]for resizing splitsctrl + b + zfor zooming in/outctrl + b + dfor detachingctrl + b + [for scrollingctrl + b + rfor reloading configctrl + b + s/wfor quick switching between sessions/windows
- terminal emulator with
zshatuinfor magic history searchctrl + rfor searching history, press again to change search type (session, host etc)upin zsh for history session in current session
zoxidefor jumping between directories. Writez patternto jump to directory containingpatternstarshipfor nicer promptvim modeinzsh- press
escto enter normal mode - enter
vin normal mode to enter visual mode using default$EDITOR- useful for editing long commands - normal vim navigation works in normal mode
- press
- Clone repo into local dir
git clone git@github.com:FlakM/nix_dots.git - Develop ie on
amd-pchost - Switch nixos
sudo nixos-rebuild switch --flake ~/programming/flakm/nix_dots#amd-pc - Switch home manager
home-manager --flake ~/programming/flakm/nix_dots#flakm@amd-pc switch
- Build locally and send paths over ssh and switch
nixos-rebuild switch --target-host flakm@odroid --use-remote-sudo --flake ~/programming/flakm/nix_dots#odroid - Build locally home manager:
home-manager --flake ~/programming/flakm/nix_dots#flakm@odroid build - Ship over ssh:
nix copy --to ssh://flakm@odroid ./result - Commit & push changes
- Apply changes:
ssh flakm@odroid "home-manager --flake github:flakm/nix_dots#flakm@odroid switch"
- Clone repo into local dir
git clone git@github.com:FlakM/nix_dots.git - Follow instructions to install nix-darwin. To change the machine name:
sudo scutil --set ComputerName "air"
sudo scutil --set HostName "air"
sudo scutil --set LocalHostName "air"- Install changes
nix run nix-darwin -- switch --flake ~/programming/flakm/nix_dots
Add flake.nix to current directory:
{
description = "A simple devshell with cowsay";
# Flake inputs
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
# Outputs of our flake
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
in {
devShell = pkgs.mkShell {
buildInputs = [
pkgs.cowsay
];
shellHook = ''
echo "Welcome to the devshell!"
cowsay "Moo! I'm here to help you with your coding tasks!"
'';
};
});
}Activate direnv:
echo "use flake" >> .envrc && direnv allowIf you dont want to commit the flake files you might:
git add --intent-to-add flake.* -f
git update-index --assume-unchanged flake.*Just crane it!
# Start with a comprehensive suite of tests
nix flake init -t github:ipetkov/crane#quick-start- import gpg key
cat > ~/.ssh/id_rsa_yubikey.pub <<EOF
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDh6bzSNqVZ1Ba0Uyp/EqThvDdbaAjsJ4GvYN40f/p9Wl4LcW/MQP8EYLvBTqTluAwRXqFa6fVpa0Y9Hq4kyNG62HiMoQRjujt6d3b+GU/pq7NN8+Oed9rCF6TxhtLdcvJWHTbcq9qIGs2s3eYDlMy+9koTEJ7Jnux0eGxObUaGteQUS1cOZ5k9PQg+WX5ncWa3QvqJNxx446+OzVoHgzZytvXeJMg91gKN9wAhKgfibJ4SpQYDHYcTrOILm7DLVghrcU2aFqLKVTrHSWSugfLkqeorRadHckRDr2VUzm5eXjcs4ESjrG6viKMKmlF1wxHoBrtfKzJ1nR8TGWWeH9NwXJtQ+qRzAhnQaHZyCZ6q4HvPlxxXOmgE+JuU6BCt6YPXAmNEMdMhkqYis4xSzxwWHvko79NnKY72pOIS2GgS6Xon0OxLOJ0mb66yhhZB4hUBb02CpvCMlKSLtvnS+2IcSGeSQBnwBw/wgp1uhr9ieUO/wY5K78w2kYFhR6Iet55gutbikSqDgxzTmuX3Mkjq0L/MVUIRAdmOysrR2Lxlk692IrNYTtUflQLsSfzrp6VQIKPxjfrdFhHIfbPoUdfMf+H06tfwkGONgcej56/fDjFbaHouZ357wcuwDsuMGNRCdyW7QyBXF/Wi28nPq/KSeOdCy+q9KDuOYsX9n/5Rsw== cardno:000614320136
EOF
chmod 600 ~/.ssh/id_rsa_yubikey.pub
cat << EOF >> ~/.ssh/config
Host github.com
IdentitiesOnly yes
IdentityFile ~/.ssh/id_rsa_yubikey.pub
EOF
gpg --card-status
ssh git@github.com -vvv
gpg --recv 0x6B872E24F09A547E
export KEYID=0x6B872E24F09A547E
# trust completly
gpg --edit-key $KEYID
gpg --output public.pgp --armor --export maciej.jan.flak@gmail.com
Insert yubikey and run:
nix-shell -p sops --run "sops secrets/secrets.yaml"