diff options
| author | nzbr <mail@nzbr.de> | 2023-09-12 12:19:14 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-12 12:19:14 +0200 |
| commit | ff57c8dc58f707299379fd538c6b6ec77980f7cf (patch) | |
| tree | 1e29af88c893020fdd1dcb694c9303c6bf43d78b /modules/docker/native.nix | |
| parent | 212e2d6b0d820fc9f1e79f7b5feeea2824db51bb (diff) | |
Refactor (#291)
* move module imports to default.nix
* move docker modules to subdirectory
* add an otion for adding files to /bin. Fixes #279
* move recovery script to own module
* reorder options
* move systemd related code to separate modules
* move utils to repo root
* devShell -> devShells.default
* fix utils imports
* fix bashWrapper
Diffstat (limited to 'modules/docker/native.nix')
| -rw-r--r-- | modules/docker/native.nix | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/modules/docker/native.nix b/modules/docker/native.nix new file mode 100644 index 0000000..88f48d9 --- /dev/null +++ b/modules/docker/native.nix @@ -0,0 +1,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 + ]; + }; +} |
