| name | installation |
| description | Step-by-step installation guide for Nix and dotfiles setup including nix.conf configuration, channel updates, home-manager, and nix-darwin |
Installation
This guide covers installation for both macOS (using nix-darwin) and NixOS.
macOS Installation:
NixOS Installation:
1. Craete a directory that matches the ghq root.
cd ~
mkdir -p git_repos/github.com/barleytea
cd git_repos/github.com/barleytea
git clone https://github.com/barleytea/dotfiles.git
2. Set up local nix.conf
mkdir -p "$HOME/.config/nix"
echo 'experimental-features = nix-command flakes' > "$HOME/.config/nix/nix.conf"
echo 'use-xdg-base-directories = true' >> "$HOME/.config/nix/nix.conf"
echo 'warn-dirty = false' >> "$HOME/.config/nix/nix.conf"
3. Install nix
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --no-confirm
source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
4. Set up global nix.conf
- edit /etc/nix/nix.conf
sudo vi /etc/nix/nix.conf
- add the following to the file
extra-trusted-users = miyoshi_s
use-xdg-base-directories = true
- restart nix-daemon
Determinate Systems の Nix は modern launchd で管理されるため、kickstart を使う(unload/load は非対応)。
sudo launchctl kickstart -k system/systems.determinate.nix-daemon
5. Update nix channel
nix-channel --add https://nixos.org/channels/nixpkgs-unstable
nix-channel --update
6. Apply home-manager config
cd ~/git_repos/github.com/barleytea/dotfiles/darwin
nix flake update
nix run nixpkgs#home-manager -- switch --flake .#home --impure
7. Launch zsh
zsh
8. Apply darwin config
cd ~/git_repos/github.com/barleytea/dotfiles
make nix-darwin-apply
NixOS Setup
For NixOS systems, the installation process is different as NixOS manages the entire system configuration.
1. Create dotfiles directory
cd ~
mkdir -p git_repos/github.com/barleytea
cd git_repos/github.com/barleytea
git clone https://github.com/barleytea/dotfiles.git
2. Set up local nix.conf
mkdir -p "$HOME/.config/nix"
echo 'experimental-features = nix-command flakes' > "$HOME/.config/nix/nix.conf"
echo 'use-xdg-base-directories = true' >> "$HOME/.config/nix/nix.conf"
echo 'warn-dirty = false' >> "$HOME/.config/nix/nix.conf"
3. Copy hardware configuration
cd ~/git_repos/github.com/barleytea/dotfiles/nixos
sudo nixos-generate-config --show-hardware-config > hardware-configuration.nix
4. Update system configuration
Edit nixos/configuration.nix and nixos/flake.nix to match your system.
5. Build and apply NixOS configuration
cd ~/git_repos/github.com/barleytea/dotfiles
sudo nixos-rebuild switch --flake ./nixos#desktop
This command applies both system and home-manager configurations.
6. Reboot
sudo reboot