mirror of
https://github.com/librephoenix/nixos-config
synced 2025-07-06 06:52:13 +05:30
Got my NixOS flake to run under WSL!
This commit is contained in:
parent
e877fd63bc
commit
0a71232a56
18 changed files with 1063 additions and 10 deletions
40
profiles/wsl/nixos-wsl/modules/docker-native.nix
Executable file
40
profiles/wsl/nixos-wsl/modules/docker-native.nix
Executable file
|
@ -0,0 +1,40 @@
|
|||
{ 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) {
|
||||
nixpkgs.overlays = [
|
||||
(self: super: {
|
||||
docker = super.docker.override { iptables = pkgs.iptables-legacy; };
|
||||
})
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
docker
|
||||
docker-compose
|
||||
];
|
||||
|
||||
virtualisation.docker.enable = true;
|
||||
|
||||
users.groups.docker.members = lib.mkIf cfg.addToDockerGroup [
|
||||
config.wsl.defaultUser
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue