@weiland's nixy dotfiles and other nix configs
My old dotfiles (managed using gnu stow
for symlinking) can be found in the
dotfiles
branch.
Install nix as multi-user installation (using fish):
sh (curl -L https://nixos.org/nix/install | psub)
or when using zsh/bash:
sh <(curl -L https://nixos.org/nix/install)
In here we use ~/src/weiland/dotfiles
as destination for the dotfiles
and also as working directory.
Now, clone dotfiles:
mkdir -p ~/src/weiland
cd ~/src/weiland
git clone https://github.com/weiland/dotfiles.git ~/src/weiland/dotfiles
cd dotfiles
Get home-manager using the nix-command feature and flakes.
nix build --no-link .#homeConfigurations.pw.activationPackage --extra-experimental-features nix-command --extra-experimental-features flakes
"$(nix path-info ~/src/weiland/dotfiles#homeConfigurations.pw.activationPackage)"/activate
Activate home-manager:
home-manager switch --flake .#pw
append --show-trace
flag, if error occurs.
Nix is upgraded via home-manager.
nix flake update
then update home-manager
home-manager switch --flake .#pw
Nix garbage collection:
nix-collect-garbage --delete-older-than 30d
# or
nix-collect-garbage -d
# collect everything (also profile etc)
sudo nix-collect-garbage -d
Optimise nix store:
nix-store --optimise -v
When a drv failed (i.e. during home-manager switch)
nix-store --query --referrers /nix/store/...FULLPATH
alternatively, use nix why-depends
Select a previous home-manager generation:
# list generations
home-manager generations
# copy and paste a generation and append /activate to it i.e.
/nix/store/z0mdj491pf3mhcsv7zgi4c54wj38zxip-home-manager-generation/activate
The old way: https://nixos.org/manual/nix/unstable/installation/upgrading.html
cp config/macos/addssh.plist ~/Library/LaunchAgents/addssh.plist
chmod +x ~/Library/LaunchAgents/addssh.plist