Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions docs/README.nix.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ nix --extra-experimental-features 'nix-command flakes' run github:user3301/dotfi
the distribution's virtual disk; `nixos-anywhere` is intended to provision an
SSH target and normally repartition its disks.

This creates the `user3301` configuration, clones the repository to
`/home/user3301/dotfiles`, and activates the local checkout. Then run
`wsl --shutdown` from PowerShell and reopen the distribution.
This first creates `user3301` without activating Home Manager, clones the
repository to `/home/user3301/dotfiles`, and then activates the full
configuration from that checkout. It is safe to rerun after an interrupted
bootstrap. When it completes, run `wsl --shutdown` from PowerShell and reopen
the distribution.

### NixOS Native
```bash
Expand Down
19 changes: 12 additions & 7 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -137,20 +137,25 @@
specialArgs = { inherit inputs; };
};

wslSystemModules = [
nixos-wsl.nixosModules.wsl
./systems/wsl/configuration.nix
];

in
{
# NixOS Configurations
nixosConfigurations = {
# Minimal first-stage configuration used by the WSL bootstrap app.
nixos-wsl-bootstrap = mkSystem {
system = "x86_64-linux";
modules = wslSystemModules;
};

# NixOS WSL2 Configuration
nixos-wsl = mkSystem {
system = "x86_64-linux";
modules = [
# WSL-specific module
nixos-wsl.nixosModules.wsl

# System configuration
./systems/wsl/configuration.nix

modules = wslSystemModules ++ [
# Home Manager integration
home-manager.nixosModules.home-manager
{
Expand Down
4 changes: 4 additions & 0 deletions home/nixos-wsl.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
./modules/languages.nix
];

# During bootstrap there may be no active user session yet. Let the normal
# WSL login start sockets and services instead of starting them during switch.
systemd.user.startServices = "suggest";

home = {
# User information
username = "user3301";
Expand Down
2 changes: 1 addition & 1 deletion scripts/bootstrap-nixos-wsl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fi
export NIX_CONFIG="${NIX_CONFIG:-}"$'\nexperimental-features = nix-command flakes'

echo "Creating the ${target_user} NixOS configuration..."
sudo nixos-rebuild switch --flake "${flake_ref}#nixos-wsl"
sudo nixos-rebuild switch --flake "${flake_ref}#nixos-wsl-bootstrap"

if [[ -d "${target_repo}/.git" ]]; then
echo "Updating the existing checkout at ${target_repo}..."
Expand Down
Loading