Skip to content

Nix home manager dotfiles on non-NixOS

charliie-dev/dot.nix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nix Home-Manager dotfiles

Important

Make sure curl, openssl, zsh, age is already installed.

make age key

mkdir -p ~/.config/age
## gen age key
age-keygen -o ~/.config/age/keys.txt
## echo age pubkey
age-keygen -y ~/.config/age/keys.txt
## rekey on old machine
agenix -r -i ~/.config/age/keys.txt

create ~/.config/nix/nix.conf

mkdir -p ~/.config/nix
cat <<EOF >>~/.config/nix/nix.conf
experimental-features = nix-command flakes
use-xdg-base-directories = true
cores = 0 # use all available cores
max-jobs = 10
auto-optimise-store = true
warn-dirty = false
http-connections = 50
trusted-users = charles
use-case-hack = true # only for macOS
EOF

Install nix(DeterminateSystems/nix-installer)

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --determinate

add trusted-users

edit /etc/nix/nix.custom.conf:

trusted-users = charles

restart daemon:

on macOS:

sudo launchctl unload /Library/LaunchDaemons/systems.determinate.nix-daemon.plist
sudo launchctl load /Library/LaunchDaemons/systems.determinate.nix-daemon.plist

on Ubuntu:

sudo systemctl restart nix-daemon

and open another shell.

Check Nix XDG Location

Expand here
```bash
nix_state_home=${XDG_STATE_HOME-$HOME/.local/state}/nix

if [[! -d $nix_state_home]]; then
mkdir -p $nix_state_home
fi

if [[-f $HOME/.nix-profile]]; then
mv $HOME/.nix-profile $nix_state_home/profile
fi
if [[-f $HOME/.nix-defexpr]]; then
mv $HOME/.nix-defexpr $nix_state_home/defexpr
fi
if [[-f $HOME/.nix-channels]]; then
mv $HOME/.nix-channels $nix_state_home/channels
fi
```

Install home-manager

nix run home-manager/master -- init --switch
exit
# nix-channel --add https://nixos.org/channels/nixpkgs-unstable unstable
# nix-channel --update
# nix-env -iA unstable.git
git clone https://github.com/charliie-dev/dot.nix.git ~/.config/home-manager
# nix-env -e git
cd ~/.config/home-manager && nix build
# add `trusted-users `: trusted-users = charles in `/etc/nix/nix.conf`
rm ~/.config/nix/nix.conf
~/.config/home-manager/result/bin/home-manager switch --flake ~/.config/home-manager --impure
home-manager switch --impure # this will prevent current generations get clean up w/ gc`
determinate-nixd version

ref: https://github.com/ryantm/home-manager-template/blob/master/README.md

ref: https://github.com/the-argus/spicetify-nix/blob/master/home-manager-install.md

Update Flakes

nix flake update
home-manager switch --flake .

Upgrade Nix

  • On macOS:
sudo determinate-nixd upgrade
  • On Ubuntu:
sudo visudo
# add `/nix/var/nix/profiles/default/bin` to `Defaults secure_path=`
sudo nix upgrade-nix

Uninstall Nix

Resources

Shorthands

Documentations

About

Nix home manager dotfiles on non-NixOS

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •