chore: refactor system modules
This commit is contained in:
3
system/dev/default.nix
Normal file
3
system/dev/default.nix
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
imports = [./docker.nix];
|
||||
}
|
||||
32
system/dev/docker.nix
Normal file
32
system/dev/docker.nix
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.system.dev.docker;
|
||||
in {
|
||||
options.system.dev.docker = {
|
||||
enable = mkEnableOption "Enable Docker";
|
||||
podman.enable = mkEnableOption "Enable Podman rather than Docker";
|
||||
nvidia.enable = mkEnableOption "Activate Nvidia support";
|
||||
autoprune.enable = mkEnableOption "Enable autoprune";
|
||||
};
|
||||
|
||||
config = {
|
||||
virtualisation = {
|
||||
docker = mkIf (cfg.enable && !cfg.podman.enable) {
|
||||
enable = true;
|
||||
enableNvidia = cfg.nvidia.enable;
|
||||
autoPrune.enable = cfg.autoprune.enable;
|
||||
};
|
||||
podman = mkIf cfg.podman.enable {
|
||||
enable = true;
|
||||
dockerCompat = cfg.enable;
|
||||
enableNvidia = cfg.nvidia.enable;
|
||||
dockerSocket.enable = cfg.enable;
|
||||
autoPrune.enable = cfg.autoprune.enable;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user