generated from fastn-stack/fastn-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
205 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
amitu.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
-- my-ds.page: Nix | ||
|
||
Current Status: Using it, [`amitu/home-manager`](https://github.com/amitu/home-manager). | ||
|
||
Planning to use it for all projects now. | ||
|
||
-- ds.h1: 25th June 2023 | ||
|
||
Today I start with watching this video: | ||
|
||
|
||
-- ds.youtube: | ||
v: 1dzgVkgQ5mE | ||
|
||
-- ds.markdown: | ||
|
||
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. | ||
|
||
-- ds.code: | ||
lang: sh | ||
|
||
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A uninstaller | ||
./result/bin/darwin-uninstaller | ||
|
||
-- ds.markdown: | ||
|
||
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 | ||
https://nix-community.github.io/home-manager/index.html#ch-nix-flakes 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. | ||
|
||
-- ds.code: | ||
lang: sh | ||
|
||
nix run home-manager/master -- init --switch | ||
|
||
|
||
-- ds.markdown: | ||
|
||
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: | ||
|
||
-- ds.code: | ||
lang: txt | ||
|
||
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' | ||
|
||
-- ds.markdown: | ||
|
||
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: | ||
|
||
-- ds.code: | ||
lang: nix | ||
|
||
{ | ||
home.packages = [ | ||
pkgs.bottom | ||
]; | ||
} | ||
|
||
|
||
-- ds.markdown: | ||
|
||
Running `home-manager switch` installed `btm`. | ||
|
||
-- ds.h2: 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. | ||
|
||
-- ds.h2: 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. | ||
|
||
-- ds.h2: 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`](https://github.com/amitu/home-manager). | ||
|
||
|
||
-- ds.h1: 24th June 2023 | ||
|
||
Trying to installing nix-darwin on my mac. Followed instructions from | ||
https://dev.jmgilman.com/environment/tools/nix/nix-darwin/. | ||
|
||
-- ftd.code: | ||
lang: sh | ||
|
||
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer | ||
./result/bin/darwin-installer | ||
|
||
-- ds.markdown: | ||
|
||
Failed with lots of errors. First time I tried without modifying the file as | ||
`dev.jmgilman.com` suggested. Tried with following instruction as well, got | ||
same error. | ||
|
||
Nix maybe old. | ||
|
||
Trying to update. Following https://nixos.org/manual/nix/stable/installation/upgrading.html, | ||
running: | ||
|
||
-- ds.code: | ||
lang: sh | ||
|
||
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' | ||
|
||
-- ds.markdown: | ||
|
||
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: | ||
|
||
-- ds.code: | ||
lang: txt | ||
|
||
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 | ||
|
||
-- ds.markdown: | ||
|
||
Process exited with exit code zero. It advised me: | ||
|
||
-- ds.code: | ||
lang: txt | ||
|
||
Open '/Users/amitu/.nixpkgs/darwin-configuration.nix' to get started. | ||
See the README for more information: https://github.com/LnL7/nix-darwin/blob/master/README.md | ||
|
||
Don't forget to start a new shell or source /etc/static/bashrc. | ||
|
||
-- ds.markdown: | ||
|
||
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. | ||
|
||
-- end: my-ds.page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters