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
hyprland
andaerospace
. Meant to jump quickly between stable "activities" like coding, browsing, notes etc.alt + NUM
go to workspacealt + shift + NUM
move windows to workspacectrl + shift + h/j/k/l
move focusctrl + alt + shift + h/j/k/l
resize windowsctrl + alt + h/j/k/l
move windowsalt + [NUM]
move windows to workspace- pin applications to workspaces:
- 1: terminals (kitty)
- 2: browser (firefox)
- 3: notes
- 0: slack
neovim
as main editor living mostly in long livedtmux
sessions- pretty default settings (disabled arrow keys, line numbers, relative numbers)
- debugging support
ctrl + w + h/j/k/l
move between splitsctrl + w + v/s
split windows (vertical/horizontal)ctrl + w + o
close other windowsleader + c + g
for copying url to git code to share (works in both visual and normal mode)leader + f
for fuzzy finding filesleader + f + g
for grepping in filesleader + f + m
for fuzzy searching marksctrl + s
for accepting AI code completionsleader + c + f
copy relative file pathleader + c + t
copy file name- LSP shortcuts defined in lsp-config.lua
gd
for going to definitiongtd
for going to type definitiongr
for referencesgi
for implementationgds
/gws
for document/workspace symbolsleader + FF
for formattingleader + ca
for code actions]c
and[c
for next/previous diagnosticleader + rn
for renamingleader + l
for enabling inlay hints (useful for rust)
tmux
for managing terminalstmux new-session -c ~ -s main
for creating new sessionctrl + b + c
for creating new windowctrl + b + NUM
for moving between windows [1-9]ctrl + b + ,
for renaming windowctrl + b + %
for splitting windowctrl + b + h/j/k/l
for moving between splitsctrl + b + [h/j/k/l]
for resizing splitsctrl + b + z
for zooming in/outctrl + b + d
for detachingctrl + b + [
for scrollingctrl + b + r
for reloading configctrl + b + s/w
for quick switching between sessions/windows
- terminal emulator with
zsh
atuin
for magic history searchctrl + r
for searching history, press again to change search type (session, host etc)up
in zsh for history session in current session
zoxide
for jumping between directories. Writez pattern
to jump to directory containingpattern
starship
for nicer promptvim mode
inzsh
- press
esc
to enter normal mode - enter
v
in 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-pc
host - 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@192.168.0.102 --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@192.168.0.102 ./result
- Apply changes:
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 allow
If 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"