# enable experimental features
mkdir -p ~/.config/nix
cat <<EOF > ~/.config/nix/nix.conf
experimental-features = flakes nix-command
EOF
# install nix package manager (assume done)
sudo nixos-rebuild switch --flake github:kuznero/dotfiles#devos --impure
nix run home-manager/master -- switch --flake github:kuznero/dotfiles#devos
# home-manager switch --flake github:kuznero/dotfiles#devos
sudo nixos-rebuild switch --flake github:kuznero/dotfiles#moon --impure
nix run home-manager/master -- switch --flake github:kuznero/dotfiles#moon
# home-manager switch --flake github:kuznero/dotfiles#moon
sudo nixos-rebuild switch --flake github:kuznero/dotfiles#sun --impure
nix run home-manager/master -- switch --flake github:kuznero/dotfiles#mac
# home-manager switch --flake github:kuznero/dotfiles#mac
To list all linux distributions currently installed, run the following PowerShell:
wsl -l -v
NixOS is not yet packaged as a official WSL distribution or on the Microsoft
store. Download the latest release of nixos-wsl.tar.gz
from the NixOS-WSL
Github page.
Import the WSL container using PowerShell:
wsl --import NixOS .\NixOS\ .\Downloads\nixos-wsl.tar.gz --version 2
Start it with PowerShell:
wsl -d NixOS
Make sure to update custom CA certificate according to your company settings.
cat <<EOF | sudo tee /etc/pki/tls/certs/ca-zscaler.crt
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
EOF
# add default CA certificates info new file
cat /etc/ssl/certs/ca-certificates.crt | \
sudo tee --append /etc/pki/tls/certs/ca-zscaler.crt
Then, change /etc/nixos/configuration.nix
file and ensure it has this line:
security.pki.certificateFiles = [ /etc/pki/tls/certs/ca-zscaler.crt ];
environment.variables = {
"NIX_SSL_CERT_FILE" = "/etc/pki/tls/certs/ca-zscaler.crt";
};
security.sudo.extraConfig = ''
Defaults env_keep += "NIX_SSL_CERT_FILE"
'';
run sudo -E NIX_SSL_CERT_FILE=/etc/pki/tls/certs/ca-zscaler.crt nixos-rebuild switch
command. It will produce some warnings in the begining, but if the
certificate is correct, it will complete the rebuild.
sudo nix-channel --update
After the above is done, and corporate proxy is well configured, proceed to the following:
sudo nixos-rebuild switch --flake github:kuznero/dotfiles#wsl --impure
nix run home-manager/master -- switch --flake github:kuznero/dotfiles#wsl
# home-manager switch --flake github:kuznero/dotfiles#wsl