2024-08-02 22:32:29 -04:00
|
|
|
khepri: {
|
2024-07-24 15:49:31 -04:00
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: let
|
2024-09-05 08:48:42 -04:00
|
|
|
inherit (lib) mkIf mkOption types;
|
|
|
|
|
|
|
|
cfg = config.khepri;
|
2024-07-24 15:49:31 -04:00
|
|
|
in {
|
|
|
|
imports = [khepri.nixosModules.default];
|
|
|
|
|
|
|
|
options.khepri = {
|
2024-09-05 08:53:54 -04:00
|
|
|
enable = mkOption {
|
|
|
|
default = cfg.compositions != {};
|
|
|
|
type = types.bool;
|
|
|
|
description = ''
|
|
|
|
Option to enable docker even without compositions.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-07-24 15:49:31 -04:00
|
|
|
rwDataDir = mkOption {
|
|
|
|
default = "/var/lib/docker";
|
|
|
|
type = types.str;
|
|
|
|
description = ''
|
|
|
|
Directory to place persistent data in.
|
|
|
|
'';
|
|
|
|
};
|
2024-09-05 08:48:42 -04:00
|
|
|
|
|
|
|
storageDriver = mkOption {
|
|
|
|
default = "btrfs"; # I use BTRFS on all my servers
|
|
|
|
type = types.str;
|
|
|
|
};
|
2024-07-24 15:49:31 -04:00
|
|
|
};
|
|
|
|
|
2024-09-05 08:53:54 -04:00
|
|
|
config = mkIf (cfg.enable) {
|
2024-07-24 15:49:31 -04:00
|
|
|
virtualisation = {
|
|
|
|
docker = {
|
|
|
|
enable = true;
|
2024-09-05 08:48:42 -04:00
|
|
|
storageDriver = cfg.storageDriver;
|
2024-07-28 00:44:09 -04:00
|
|
|
|
|
|
|
package = pkgs.docker_27;
|
|
|
|
|
|
|
|
daemon.settings.dns = ["8.8.8.8" "1.1.1.1"];
|
2024-07-24 15:49:31 -04:00
|
|
|
};
|
2024-07-28 00:44:09 -04:00
|
|
|
|
2024-07-24 15:49:31 -04:00
|
|
|
# khepri uses oci-containers under the hood and it must be set to docker to work
|
|
|
|
oci-containers.backend = "docker";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Script for updating the images of all images of a compose.nix file
|
2024-08-31 19:16:06 -04:00
|
|
|
environment.systemPackages = [
|
|
|
|
(pkgs.callPackage ./updateImage.nix {})
|
2024-07-24 15:49:31 -04:00
|
|
|
];
|
|
|
|
};
|
2024-08-02 22:32:29 -04:00
|
|
|
|
|
|
|
# For accurate stack trace
|
|
|
|
_file = ./default.nix;
|
2024-07-24 15:49:31 -04:00
|
|
|
}
|