Nix is a purely functional package manager. It is alternative to homebrew in MacOS, every folder has its own environment with the help of direnv, you can install any version of package on folder base.
Table Of Contents
- Getting Started
- Create nix config
.envrc
anddefault.nix
- "Hello World" Node API with Nix
Getting Started
- Install Nix
sh \
<(curl -L https://nixos.org/nix/install) \
--darwin-use-unencrypted-nix-store-volume
- NOTE: this are for who have intel MacBook
- Add nix profile in your favorite shell config
-
~/.zshrc
or~/.bashrc
- create if file not exist
-
. /Users/<your-user-name>/.nix-profile/etc/profile.d/nix.sh
source $HOME/.nix-profile/etc/profile.d/nix.sh
export NIX_PATH="nixpkgs=$HOME/.nix-defexpr/channels/nixpkgs"
- Close your terminal to reload
~/.zshrc
or~/.bashrc
file - For M1 or arm MacBook please see
https://nix.dev/tutorials/install-nix
- Open new terminal, then type:
nix-env --version
- Update all the channels link
nix-channel --update
- Install direnv
- is an extension for your shell. It augments existing shells with a new feature that can load and unload environment variables depending on the current directory.
nix-env -i direnv
- Add
direnv
hook to shell config Please see more...
eval "$(direnv hook zsh)"
Top comments (1)
I can't find ".nix-profile/etc" folder in mac, after installing NIX. how can I install like your instruction.