My personal dotfiles, managed with nix flakes.
- nixos:
nixos-wsl
- nixos:
laptop
- home-manager:
ubuntu
Need to have a mac again to test ¯_(ツ)_/¯
-
Ensure 1Password beta is installed to use the 1Password SSH agent with WSL
-
In PowerShell:
wsl --import NixOS .\NixOS\ nixos-wsl.tar.gz --version 2
-
In NixOs:
sudo nix-channel --update
nix-shell -p git --command "git -c core.sshCommand=ssh.exe clone git@github.com:Chowlz/dotfiles.git ~/.dotfiles"
nix-shell -p git --command "cd ~/.dotfiles && git config user.email \"mail@charlescruz.dev\""
nix-shell -p git --command "cd ~/.dotfiles && git config user.name \"Charles Cruz\""
- Run the setup script:
~/.dotfiles/setup.sh --type nixos --configuration <configuration name>
-
In PowerShell:
wsl --terminate NixOS
-
Enjoy!
# From ~/.dotfiles/config/nixpkgs
sudo nixos-rebuild switch --flake path:$(pwd)#nixos-wsl
Some changes may require a restart. In a powershell:
wsl --terminate NixOS
Most likely the VPN at work will require certificate installation updating things with the internet.
-
Start NixOS in one window and start
wsl-vpnkit
as a wsl distro if needed to reach the internet through the VPN (some VPNs mess up the routes for WSL). -
Get root certificate into wsl.
-
sudo -i
andexport NIX_SSL_CERT_FILE=/cert/file/location
in order tonix-channel --update
. -
Add certificates as text in an array into
security.pki.certificates
in/etc/nixos/configuration.nix
. -
sudo nixos-rebuild switch
and then restart wsl withwsl --terminate NixOS
. -
Create a work
work
directory to hold work-specific nix configuration. Usework-ref
as a reference. -
Afterwards, follow the above instructions for setting up NixOS-WSL.
Use sudo nixos-rebuild switch --flake path:$(pwd)#<configuration name>
.
Run ./setup.sh --type home-manager --configuration <configuration name>
to setup dotfiles only.
error: getting status of '/nix/store/*': No such file or directory
nixos-rebuild
requires new files/directories are staged/committed in git.
fatal: cannot create an empty blob in the object database
error: program 'git' failed with exit code 128
A file or folder was commited to git using elevated permissions and now git can't modify those objects. Recursively force ownership of all files under .git:
sudo chown -R $(whoami) ~/.dotfiles/.git/*