nixos/virtualisation.docker.rootless: remove with lib;
This commit is contained in:
parent
dd7ab59690
commit
3cd35f7830
@ -1,7 +1,4 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
cfg = config.virtualisation.docker.rootless;
|
cfg = config.virtualisation.docker.rootless;
|
||||||
@ -15,8 +12,8 @@ in
|
|||||||
###### interface
|
###### interface
|
||||||
|
|
||||||
options.virtualisation.docker.rootless = {
|
options.virtualisation.docker.rootless = {
|
||||||
enable = mkOption {
|
enable = lib.mkOption {
|
||||||
type = types.bool;
|
type = lib.types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
This option enables docker in a rootless mode, a daemon that manages
|
This option enables docker in a rootless mode, a daemon that manages
|
||||||
@ -25,8 +22,8 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
setSocketVariable = mkOption {
|
setSocketVariable = lib.mkOption {
|
||||||
type = types.bool;
|
type = lib.types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
Point {command}`DOCKER_HOST` to rootless Docker instance for
|
Point {command}`DOCKER_HOST` to rootless Docker instance for
|
||||||
@ -34,7 +31,7 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
daemon.settings = mkOption {
|
daemon.settings = lib.mkOption {
|
||||||
type = settingsFormat.type;
|
type = settingsFormat.type;
|
||||||
default = { };
|
default = { };
|
||||||
example = {
|
example = {
|
||||||
@ -47,15 +44,15 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkPackageOption pkgs "docker" { };
|
package = lib.mkPackageOption pkgs "docker" { };
|
||||||
};
|
};
|
||||||
|
|
||||||
###### implementation
|
###### implementation
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
environment.systemPackages = [ cfg.package ];
|
environment.systemPackages = [ cfg.package ];
|
||||||
|
|
||||||
environment.extraInit = optionalString cfg.setSocketVariable ''
|
environment.extraInit = lib.optionalString cfg.setSocketVariable ''
|
||||||
if [ -z "$DOCKER_HOST" -a -n "$XDG_RUNTIME_DIR" ]; then
|
if [ -z "$DOCKER_HOST" -a -n "$XDG_RUNTIME_DIR" ]; then
|
||||||
export DOCKER_HOST="unix://$XDG_RUNTIME_DIR/docker.sock"
|
export DOCKER_HOST="unix://$XDG_RUNTIME_DIR/docker.sock"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user