Skip to content

iawaknahc/dotfiles

Repository files navigation

Nix and shell initialization

nix-installer installs a shell script that is expected to be sourced:

These two scripts does not prevent being executed more than once. So we need to prevent that ourselves.

Apart from the sh version, a fish version is also available. For other shells like nushell and elvish, we need a way to source the sh version.

Shell initialization

  • bash
  • zsh
  • fish
    • In particular, fish reads XDG_DATA_DIRS and source the files there.
    • Some Nix packages is known to install fish snippets, such as fzf.
    • For these packages, sourcing of the snippets cannot be prevented.

Install nix with nix-installer

Download nix-installer at https://github.com/DeterminateSystems/nix-installer/releases and then run it.

Assume the installation IS NOT customized. So nix-command and flakes are assumed to be enabled.

nix-installer does a couple of things, some of those will be taken over by nix-darwin:

Install nix-darwin and home-manager

git clone git@github.com:iawaknahc/dotfiles.git ~/dotfiles

ln -s ~/dotfiles ~/.config/home-manager
sudo ln -s ~/dotfiles /etc/nix-darwin

nix run nix-darwin -- switch
nix run home-manager -- switch

Making changes

cd ~/dotfiles

# Make your changes.
# You cannot make changes directly to the managed files because
# they are symlinks to files in the nix store.

# Apply the changes.
home-manager switch

# Finally, use ordinary git commands to record the changes.
git add .
git commit

Uninstall home-manager

# Open Terminal.app and make sure the shell is /bin/zsh
# This is to ensure we are not running something that we are going to uninstall.

nix --extra-experimental-features "nix-command flakes" run home-manager -- uninstall

Uninstall nix-darwin

nix --extra-experimental-features "nix-command flakes" run nix-darwin#darwin-uninstaller

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •