43 lines
1.1 KiB
Nix
43 lines
1.1 KiB
Nix
{ config, lib, inputs, ... }:
|
|
let
|
|
cfg = config.niriwm;
|
|
in
|
|
{
|
|
options.dockerConfig = {
|
|
rootless = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
description = "Enable rootless Docker mode";
|
|
};
|
|
enableOnBoot = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
description = "Start Docker on boot";
|
|
};
|
|
useUnstable = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
description = "Use docker package from nixpkgs-unstable";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
virtualisation.docker = {
|
|
enable = true;
|
|
enableOnBoot = config.dockerConfig.enableOnBoot;
|
|
rootless = lib.mkIf config.dockerConfig.rootless {
|
|
enable = true;
|
|
setSocketVariable = true;
|
|
};
|
|
daemon.settings = lib.mkIf config.dockerConfig.rootless {
|
|
userland-proxy = false;
|
|
};
|
|
} // lib.optionalAttrs config.dockerConfig.useUnstable {
|
|
package = (import inputs.nixpkgs-unstable {
|
|
system = "x86_64-linux";
|
|
config.allowUnfree = true;
|
|
}).docker_25;
|
|
};
|
|
};
|
|
}
|