Hi! 👋
This repository contains the definition of my machines using nix.
Important
Disclaimer: This is my personal configuration that works for me. I hope this helps you!
If you are new to dotfiles in general, I suggest a bare git solution to start with.
Hostname | CPU | RAM | Primary GPU | Secondary GPU | OS |
---|---|---|---|---|---|
laptop |
AMD Ryzen™ 7 7840HS | 32GB | AMD Radeon™ 780M | NVIDIA® GeForce RTX™ 4060 8GB | ❄️ |
work-macos |
Apple M2 Pro 8-core CPU | 16GB | Apple M2 Pro 10-core GPU | 🍏 |
Listing only the most relevant outputs. See the source-code for more details.
dotfiles
: Wrapper aroundnix
/nixos-rebuild
operations.project
: Customfzf
integration to quickly open projects withinPROJ_DIR
orXDG_DOCUMENTS_DIR
. Includesfish
widget.fzf-rg
:fzf
+ripgrep
. Includesfish
widget.fzf-fd
:fzf
+fd
. Includesfish
widget.preview
: Custom barebones terminal file previewer to together with the other widgets. I really likeyazi
previewer but can't use it in isolation.
Tryout using:
nix run github:bphenriques/dotfiles#{package}
Home Manager modules
programs-dotfiles
: Accompanies thedotfiles
package.programs-project
: Accompanies theproject
package.programs-fzf-fd
: Accompanies thefzf-fd
package.programs-fzf-rg
: Accompanies thefzf-rg
package.xdg-mime-apps
: Customxdg-mime-apps
module to abstract setting the common application for typical common text/images/audio/video mimes.
proton-run
:proton-ge-custom
runner using a global prefix for ad-hoc executions.services-input-solaar
:Solaar
service.boot-theme
: Custom boot configuration including plymouth-themes, settings to hide logs, and an OLED friendly Grub2 theme.
Nix Darwin modules
system-screencapture
: Ensures the the screencapture directory exists.system-desktop
: Sets a wallpaper on all desktops. Not perfect but good enough for me.
-
Create a bootable USB installer:
sudo fdisk -l sudo dd bs=4M if=<ISO> of=<PEN_DRIVE> status=progress oflag=sync
-
On the target machine, boot onto the NixOS's installer, set
nixos
's password usingpasswd
and obtain its IP. -
On the source machine, create a new host with the initial hardware configuration and disko set:
HOST=new-host TARGET_IP=192.168.68.58 ssh nixos@$TARGET_IP -- nixos-generate-config --no-filesystems --root /mnt --show-hardware-config > hosts/$HOST/hardware-configuration.nix
-
Boot onto the NixOS installer (see previous section).
-
On a NixOS source machine run:
HOST=new-host TARGET_IP=192.168.68.58 ./bin/nixos-remote-install.sh $HOST nixos@$TARGET_IP
-
On the target machine, run the following after the installation:
HOST=laptop BITWARDEN_EMAIL=... nix run --extra-experimental-features 'nix-command flakes' "github:bphenriques/dotfiles#dotfiles-install" -- $HOST $BITWARDEN_EMAIL
-
Install
nix
. -
Boostrap:
nix run --extra-experimental-features 'nix-command flakes' github:bphenriques/dotfiles#darwin-install
-
Setup the dotfiles repository:
HOST=work-macos BITWARDEN_EMAIL=... nix run --extra-experimental-features 'nix-command flakes' "github:bphenriques/dotfiles#dotfiles-install" -- laptop $BITWARDEN_EMAIL
-
Apply:
"$HOME"/.dotfiles/packages/dotfiles/dotfiles.sh sync
-
Reboot!
- Secrets:
sops-nix
. - Private information: private flake under
bphenriques/dotfiles-private
.
Adding new hosts requires:
- Generate key pair using:
nix-shell -p age --command "age-keygen"
. - Export the private key to
$HOME/.config/sops/age/keys.txt
and upload to Bitwarden using the formatsops-age-key-$HOST-$USER
with aprivate
field inside. - Add new host to
.sops.yaml
using the public key to.sops.yaml
and the correctpath_regex
.