mirror of
https://github.com/davegallant/nix-config
synced 2025-08-07 17:32:26 +00:00
Add updated wsl configuration
This commit is contained in:
38
machines/aether/nixos-wsl/modules/docker-desktop.nix
Normal file
38
machines/aether/nixos-wsl/modules/docker-desktop.nix
Normal 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-user-distro 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
|
||||
];
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user