Current Status: Using it, [`amitu/home-manager`]( Planning to use it for all projects now.

25th June 2023

Today I start with watching this video:
In this video Paul uses home-manager and per project nix setup without nix-darwin, and uses flakes. So it appears there is a new flake way of doing things, and the old "channel" way of doing things. In channel way you had to pick a channel, stable or unstable, and it was not quite great to have to pick channel. You could mix and match as well, but it was kind of complex. In flake way you have flake lock files, so everywhere you get the right versions. Am going to start with uninstalling nix-darwin for now.
nix-build -A uninstaller
Nothing was yet installed through nix-darwin so hopefully I have not borked my system. It did undo the zsh configuration that installing it brought. Am going to follow "3.2. Standalone setup" instructions on to try to install nix. I have verified that the "3.1. Prerequisites" are already satisfied, my `/etc/nix/nix.conf` already contains `experimental-features = nix-command flakes`, I suppose newer installations of nix come with `flakes` enabled by default.
nix run home-manager/master -- init --switch
I am using the unstable release, sticking with master for now, so I am trying the following to install `home-manager`. It created a bunch of files for me:
Creating /Users/amitu/.config/home-manager/home.nix...
Creating /Users/amitu/.config/home-manager/flake.nix...

Creating initial Home Manager generation...

warning: creating lock file '/Users/amitu/.config/home-manager/flake.lock'
As per the guide I have to run `home-manager switch` to update my system after I make changes to `~/.config/home-manager/*.nix` files. I added `bottom` (an alternative to `top`) to test it out:
home.packages = [
Running `home-manager switch` installed `btm`.

Config Path

Wondering where the path is stored. The guide mentioned you can run `nix run home-manager/$branch -- init --switch ~/hmconf` to use a different path, and which case you would have to run `home-manager switch --flake ~/hmconf` to tell `home-manager` where to find the conf files. I guess path is not stored anywhere and is communicated by CLI flag only. Which may make it sound like the path should be left alone, to default value, so we can use the `home-manager switch` without using options, but as we saw in the video, we will still have to pass the hostname flag, if you intend to use the same configuration on more than one hosts. So you will have to provide more args to `home-manager` and it's probably best to create a shell alias `hm` to something that passes whatever parameter you want.

Managing Project Files

The recommendation is to do home management, which includes what all programs you want installed globally, shell scripts, and the dot files, through `home-manager`, and put a `flakes.nix` (and the corresponding `flakes.lock`) file in each of your project folders. And to use direnv to ensure if you `cd` into any of the project folders the corresponding environment is created. This way you can share project specific flakes file with everyone working on that project.

Managing Dot Files

So I am now going to try to manage all my dot files and programs etc using home manager, and am intentionally keeping my home manager not in my `~/.config` as I am expecting other files in `~/.config` are going to be generated by `nix` or `home-manager`. Or since it is a separate folder, I can keep it there, one less folder to think about, but put only the `~/.config/home-manager` in a git repo, [`amitu/home-manager`](

24th June 2023

Trying to installing nix-darwin on my mac. Followed instructions from
nix-build -A installer
Failed with lots of errors. First time I tried without modifying the file as `` suggested. Tried with following instruction as well, got same error. Nix maybe old. Trying to update. Following, running:
sudo -i sh -c 'nix-channel --update
&& nix-env --install --attr nixpkgs.nix'
&& launchctl remove org.nixos.nix-daemon
&& launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist'
It went from `replacing old 'nix-2.13.3', installing 'nix-2.15.1'`. Ended with an error: `Load failed: 37: Operation already in progress`. Running each command individually worked tho. Retrying darwin-installer. When it asked me to edit file, the extra lines were already there. Not sure if its because they have updated the upstream config, or it somehow read my last edit and is using that. Said yes to all prompts. Got errors:
error: not linking environment.etc."nix/nix.conf" because /etc/nix/nix.conf already exists, skipping...
existing file has unknown content eecd27dc7a70fb90fb375319ac84d43226fb0df49e14231e1f749a23e0b97105, move and activate again to apply
Process exited with exit code zero. It advised me:
Open '/Users/amitu/.nixpkgs/darwin-configuration.nix' to get started.
See the README for more information:

Don't forget to start a new shell or source /etc/static/bashrc.
Starting a new shell changed my zsh configuration! Not sure where it came from, maybe the default `zsh` of `nix`? But I have not added `zsh` in my `darwin-configuration.nix` yet. Ran `darwin-rebuild changelog` a few times, did not output anything. It's odd! I thought it's not doing anything because I have not changed `darwin-configuration.nix`, but even if I edit nothing happens. I even introduced syntax errors and nothing happened. Calling it a day for now.