blob: 88f48d98a82ae2b7d62ac335b369e9cebd299e82 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
{ config, lib, pkgs, ... }:
with builtins; with lib; {
options.wsl.docker-native = with types; {
enable = mkEnableOption "Native Docker integration in NixOS.";
addToDockerGroup = mkOption {
type = bool;
default = config.security.sudo.wheelNeedsPassword;
description = ''
Wether to add the default user to the docker group.
This is not recommended, if you have a password, because it essentially permits unauthenticated root access.
'';
};
};
config =
let
cfg = config.wsl.docker-native;
in
mkIf (config.wsl.enable && cfg.enable) {
environment.systemPackages = with pkgs; [
docker-compose
];
virtualisation.docker.package = (pkgs.docker.override { iptables = pkgs.iptables-legacy; });
virtualisation.docker.enable = true;
users.groups.docker.members = lib.mkIf cfg.addToDockerGroup [
config.wsl.defaultUser
];
};
}
|