723QWZKMMKC44ZAQQYSSOPCB65TKSORXU2D4PIHWOUEKICJGUBVAC
GNBPCTB7Z7DISLGV2ZGZTDKL3T6JGCFVSYDNS2ZKX6NQLK5RWJRAC
VXESMJDKIRYTNWV6PVDZUSECSP7ESMK5LZPEE72DFBUU5MH7GWLAC
A32NGEIBDOOKELILD6YPAGDCEDVVSYBSNJNS4RDXB7SHBQNIVNPQC
SBJS4CDALIHJCQFCV2EITKNK3RVMUGIQMJI3JBL7BAR4QOJNWQDQC
O64A6IJJGMWJYUDR6VUFGYFPWWPN222BEMMLFCMLKDEFO5OVRE4QC
WCNICOSNFZTSJ76LCYNRBHH6FX4B6DSWOV35FPIBCPCQ5PMPXZ5QC
QRSG7RJSX5R255Y2HHTLYBXMBR374QS3PV2UJDWK2ZPMG7V66SSAC
47GPXWYAN5HMMVVIWFEAY63MID4U2UHIBH4HNMDYWNQ2J6E2WX6AC
# Use a custom configuration.nix location.
# $ darwin-rebuild switch -I darwin-config=$HOME/.config/nixpkgs/darwin/configuration.nix
environment.darwinConfig = "$HOME/.config/nixpkgs/darwin/configuration.nix";
home-manager.users.christophercummings = { pkgs, ... }: {
imports = [ ../nixpkgs/home.nix ];
};
launchd.user.agents.syncemail = {
command = "${pkgs.isync}/bin/mbsync -a && mu ${pkgs.mu}/bin/mu index";
serviceConfig.StartInterval = 60 * 5;
};
# launchd.user.agents.syncemail = {
# command = "${pkgs.isync}/bin/mbsync -a && mu ${pkgs.mu}/bin/mu index";
# serviceConfig.StartInterval = 60 * 5;
# };
* [install nix](https://nixos.org "nixos")
* [install home-manager](https://github.com/nix-community/home-manager#installation)
* [install nix](https://nixos.org/download.html#nix-quick-install "nixos")
* NOTE: double check all the install commands if something goes wrong, things may have changed upstream
``` sh
sh <(curl -L https://nixos.org/nix/install)
```
* on recent versions of macos you'll need to add a special flag
``` sh
sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume
```
* [install nix-darwin](https://github.com/LnL7/nix-darwin#install "nix-darwin-install-instructions") if on macos
``` sh
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
./result/bin/darwin-installer
```
* [install home-manager](https://github.com/nix-community/home-manager#installation) follow the instructions at the link
* if on macos also follow the instructions for [integrating home-manager as a nix-darwin module](https://nix-community.github.io/home-manager/index.html#sec-install-nix-darwin-module "home-manager-nix-darwin-module")
* this is for local machine specific config like user name, directory and anything else
* if configuring email, edit `email/default.nix` to import the emails you want on this machine
* use `email/example-email.nix` as a guide
* run `ln -fs ~/dotfiles/nixpkgs ~/.config/` to create the symlink for home-manager config
* run `home-manager switch`
* start emacs and run
``` sh
cp ~/dotfiles/nixpkgs/localhome/example.nix ~/dotfiles/nixpkgs/localhome/default.nix
```
* modify `localhome/default.nix` according to the needs of the system (like choosing what to install and some PII info)
* symlink `~/dotfiles/nixpkgs` to `~/.config/`
``` sh
ln -fs ~/dotfiles/nixpkgs ~/.config/
```
* build the configuration
* for non-macos
* if on non-macos
``` sh
home-manager switch
```
* if on macos (only the first call to darwin-rebuild requires the darwin-config argument)
``` sh
darwin-rebuild switch -I "darwin-config=$HOME/.config/nixpkgs/darwin/configuration.nix"
```
* finish installing emacs dependencies by starting emacs and running the following functions
* to update to the latest packages run `nix-channel --update` before running `home-manager switch`
* Optionally run `stow $DIR -t ~` for any other $DIR in `~/dotfiles/stowed` to symlink the related configs
* to update to the latest packages run `nix-channel --update` before running `home-manager switch` or `darwin-rebuild`
### Troubleshooting
#### Start Over get rid of nix completely
* `rm -rf /nix`
* if you get an error on macos remove nix from `/synthetic.conf` and try again
* on macos use disk utility app to delete the `nix` apfs volume
* restart system
* nix is now gone completely so you can follow the install instructions to start over
#### After macos update / upgrade
* tl;dr; these can sometimes replace the changes necessary in `/etc/zprofile` and `/etc/zshrc` meaning we need to intervene manually.
``` sh
sudo mv /etc/zshrc /etc/zshrc.bak
sudo mv /etc/zprofile /etc/zprofile.bak
sudo /nix/var/nix/profiles/system/activate
exit # Start a new shell to reload the environment.
```