2024-11-26 17:15:31 -08:00
|
|
|
{
|
2024-12-22 22:26:41 -08:00
|
|
|
inputs,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
cfg = config.liminalOS.wsl;
|
|
|
|
in
|
|
|
|
{
|
2024-12-22 23:26:13 -08:00
|
|
|
imports = [
|
|
|
|
inputs.${cfg.wslName}.nixosModules.default
|
2024-11-26 17:15:31 -08:00
|
|
|
];
|
|
|
|
|
2024-12-22 22:26:41 -08:00
|
|
|
options = {
|
2024-12-22 23:26:13 -08:00
|
|
|
enable = lib.mkEnableOption "WSL";
|
|
|
|
wslName = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
|
|
|
default = "nixos-wsl";
|
2024-12-22 22:26:41 -08:00
|
|
|
description = ''
|
2024-12-22 23:26:13 -08:00
|
|
|
Name of the NixOS WSL module in your flake inputs. You should define `inputs.nixos-wsl.url = "github:nixos-community/nixos-wsl", and set `liminalOS.wsl.wslName` if you did not call it `nixos-wsl`.
|
2024-12-22 22:26:41 -08:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config.wsl = lib.mkIf cfg.enable {
|
2024-11-26 17:15:31 -08:00
|
|
|
enable = true;
|
2024-12-22 22:26:41 -08:00
|
|
|
defaultUser = config.liminalOS.username;
|
2024-11-26 17:15:31 -08:00
|
|
|
useWindowsDriver = true;
|
|
|
|
};
|
2024-12-22 23:26:13 -08:00
|
|
|
assertions = [
|
|
|
|
{
|
|
|
|
assertion = builtins.hasAttr cfg.wslName inputs;
|
|
|
|
message = ''You enabled WSL but did not add the WSL module to your flake inputs, or did not set `liminalOS.theming.wslName` to the name of your NixOS WSL input, if it is not `nixos-wsl`. Please set `inputs.nixos-wsl.url = "github:nix-community/nixos-wsl"` or set the wslName option to the name of your WSL flake input.'';
|
|
|
|
}
|
|
|
|
];
|
2024-11-26 17:15:31 -08:00
|
|
|
}
|