mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
docker-cli: Improve docs, fix enviornment variable
(cherry picked from commit 26e33ea5c0)
This commit is contained in:
parent
7b5a978e00
commit
1e9c01bbbb
3 changed files with 11 additions and 12 deletions
|
|
@ -21,18 +21,18 @@ in
|
||||||
options.programs.docker-cli = {
|
options.programs.docker-cli = {
|
||||||
enable = mkEnableOption "management of docker client config";
|
enable = mkEnableOption "management of docker client config";
|
||||||
|
|
||||||
configPath = mkOption {
|
configDir = mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = ".docker/config.json";
|
default = ".docker";
|
||||||
description = ''
|
description = ''
|
||||||
Relative path to the user's home directory where the Docker CLI settings should be stored.
|
Folder relative to the user's home directory where the Docker CLI settings should be stored.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
settings = mkOption {
|
settings = mkOption {
|
||||||
type = jsonFormat.type;
|
type = jsonFormat.type;
|
||||||
default = { };
|
default = { };
|
||||||
example = ''
|
example = lib.literalExpression ''
|
||||||
{
|
{
|
||||||
"proxies" = {
|
"proxies" = {
|
||||||
"default" = {
|
"default" = {
|
||||||
|
|
@ -52,11 +52,11 @@ in
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home = {
|
home = {
|
||||||
sessionVariables = {
|
sessionVariables = {
|
||||||
DOCKER_CONFIG = "${config.home.homeDirectory}/${cfg.configPath}";
|
DOCKER_CONFIG = "${config.home.homeDirectory}/${cfg.configDir}";
|
||||||
};
|
};
|
||||||
|
|
||||||
file = {
|
file = {
|
||||||
"${cfg.configPath}" = {
|
"${cfg.configDir}/config.json" = {
|
||||||
source = jsonFormat.generate "config.json" cfg.settings;
|
source = jsonFormat.generate "config.json" cfg.settings;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,11 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
programs.docker-cli = {
|
programs.docker-cli = {
|
||||||
configPath = ".docker/empty.json";
|
configDir = ".docker2";
|
||||||
};
|
};
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
assertFileNotRegex home-path/etc/profile.d/hm-session-vars.sh 'DOCKER_CONFIG'
|
assertFileNotRegex home-path/etc/profile.d/hm-session-vars.sh 'DOCKER_CONFIG'
|
||||||
assertPathNotExists home-files/.docker/config.json
|
assertPathNotExists home-files/${cfgDocker.configDir}
|
||||||
assertPathNotExists home-files/${cfgDocker.configPath}
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
programs.docker-cli = {
|
programs.docker-cli = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
configPath = ".docker/config2.json";
|
configDir = ".docker2";
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
"proxies" = {
|
"proxies" = {
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
nmt.script =
|
nmt.script =
|
||||||
let
|
let
|
||||||
cfgDocker = config.programs.docker-cli;
|
cfgDocker = config.programs.docker-cli;
|
||||||
configTestPath = "home-files/${cfgDocker.configPath}";
|
configTestPath = "home-files/${cfgDocker.configDir}/config.json";
|
||||||
configHomePath = "/home/hm-user/${cfgDocker.configPath}";
|
configHomePath = "/home/hm-user/${cfgDocker.configDir}";
|
||||||
in
|
in
|
||||||
''
|
''
|
||||||
assertFileContains home-path/etc/profile.d/hm-session-vars.sh \
|
assertFileContains home-path/etc/profile.d/hm-session-vars.sh \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue