nix-home
nix-home copied to clipboard
My Nix dotfiles on MacOS/NixOS
#+TITLE: My nix-darwin/NixOS configuration
[[https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgarnix.io%2Fapi%2Fbadges%2Fyuanw%2Fnix-home]]
[[https://github.com/yuanw/nix-home/actions/workflows/ci.yml/badge.svg]]
[[https://builtwithnix.org/badge.svg]]
[[./screenshots/macos.png]]
The goal for this repo is to declaratively configure MacOS and Linux system using nixos/[[https://github.com/LnL7/nix-darwin][nix-darwin]] and [[https://github.com/nix-community/home-manager][home-manger]].
feel free to take what you like.
-
Current MacOS setup | Shell | zsh + starship | | WM | yabai + skhd + sketchybar | | Terminal | Alacritty + tmux | | Editor | Emacs + helix | | Browser | Firefox (shyfox) |
-
Current Nixos setup | Shell | zsh + starship | | WM | xmonad + xmobar | | Terminal | Alacritty + tmux | | Editor | Emacs + helix | | Browser | Firefox (shyfox) |
-
Inspirations
https://github.com/stars/yuanw/lists/nix-home/
- MacOS ** Install
**** Install Nix (with daemon) with official script ~sh <(curl -L https://nixos.org/nix/install)~ or using https://github.com/DeterminateSystems/nix-installer
~curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install~ **** Turn on flake edit ~/etc/nix/nix.conf~ ~experimental-features = nix-command flakes~
**** Install nix-darwin
https://github.com/LnL7/nix-darwin#install #+begin_src shell nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer ./result/bin/darwin-installer #+end_src
**** install xcode **** Install brew there are lots of GUI programs, we cannot install nicely using pure nix. There is brew-module in nix-darwin. ~/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)~ What is benefits of this ? we can install/uninstall applications using nix don't forget to do ~brew analytics off~
**** import gpg keys (airdrop) ~gpg --list-secret-keys~ or ~gpg --list-secret-keys [email protected]~
#+begin_src shell pub 4096R/ABC12345 2020-01-01 [expires: 2025-12-31] uid Your Name [email protected] sub 4096R/DEF67890 2020-01-01 [expires: 2025-12-31] #+end_src
ID of your key (second column e.g "ABC12345")
~gpg --export-secret-keys YOUR_ID_HERE > private.key~ **** install font
font
** Import
~gpg --import private.key~ ** ssh file
.ssh/config #+begin_src Host * IgnoreUnknown UseKeychain AddKeysToAgent yes UseKeychain yes IdentityFile ~/.ssh/id_ed25519
#+end_src
** [[https://github.com/LnL7/nix-darwin#updating][Update]]
#+BEGIN_SRC shell nix flake update --recreate-lock-file #+END_SRC
** build on macos? ~nix build .#yuan-mac~ *** switch ? ~./result/sw/bin/darwin-rebuild switch --flake .~ ** How to rollback (require sudo) ~darwin-rebuild --rollback~ or ~darwin-rebuild --list-generations~ ~darwin-rebuild --switch-generation XX~
-
Nixos ~$ nixos-rebuild switch --flake '.#' -user-remote-sudo~
-
Caveats ** Exclude Nix directory from Spotlight index ** nix-darwin permission issue ~sudo chown -R whoami:staff /nix/store~