nixos-configs/modules/docker/default.nix

47 lines
938 B
Nix
Raw Normal View History

self: {
2024-07-24 15:49:31 -04:00
config,
lib,
pkgs,
...
}: let
inherit (lib) mkIf mkOption types;
cfg = config.roles.docker;
2024-07-24 15:49:31 -04:00
in {
imports = [self.inputs.docker-compose.nixosModules.default];
2024-07-24 15:49:31 -04:00
options.roles.docker = {
2024-09-05 08:53:54 -04:00
enable = mkOption {
default = cfg.compositions != {};
type = types.bool;
description = ''
Option to enable docker even without compositions.
'';
};
storageDriver = mkOption {
default = "btrfs"; # I use BTRFS on all my servers
type = types.str;
};
2024-07-24 15:49:31 -04:00
};
config = mkIf cfg.enable {
2024-07-24 15:49:31 -04:00
virtualisation = {
docker = {
enable = true;
storageDriver = cfg.storageDriver;
daemon.settings.dns = ["8.8.8.8" "1.1.1.1"];
2024-07-24 15:49:31 -04:00
};
};
# Script for updating the images of a compose.nix file
environment.systemPackages = [
(pkgs.callPackage ./updateImage.nix {})
2024-07-24 15:49:31 -04:00
];
};
# For accurate stack trace
_file = ./default.nix;
2024-07-24 15:49:31 -04:00
}