Add configuration for WSL2

This commit is contained in:
Dave Gallant
2022-07-02 22:56:20 +00:00
parent 920602e0fe
commit d74ec8f89b
21 changed files with 1101 additions and 14 deletions

View File

@@ -0,0 +1,38 @@
{
config,
lib,
pkgs,
...
}:
with builtins;
with lib; {
options.wsl.docker = with types; {
enable = mkEnableOption "Docker Desktop integration";
};
config = let
cfg = config.wsl.docker;
in
mkIf (config.wsl.enable && cfg.enable) {
environment.systemPackages = with pkgs; [
docker
docker-compose
];
systemd.services.docker-desktop-proxy = {
description = "Docker Desktop proxy";
script = ''
${config.wsl.automountPath}/wsl/docker-desktop/docker-desktop-proxy -docker-desktop-root ${config.wsl.automountPath}/wsl/docker-desktop
'';
wantedBy = ["multi-user.target"];
serviceConfig = {
Restart = "on-failure";
RestartSec = "30s";
};
};
users.groups.docker.members = [
config.wsl.defaultUser
];
};
}