mirror of
https://github.com/nix-community/home-manager
synced 2024-12-03 16:39:46 +01:00
lazydocker: add module
This commit is contained in:
parent
1a4f12ae0b
commit
5fa6274d0d
8 changed files with 106 additions and 0 deletions
|
@ -140,6 +140,7 @@ let
|
||||||
./programs/khard.nix
|
./programs/khard.nix
|
||||||
./programs/kitty.nix
|
./programs/kitty.nix
|
||||||
./programs/kodi.nix
|
./programs/kodi.nix
|
||||||
|
./programs/lazydocker.nix
|
||||||
./programs/lazygit.nix
|
./programs/lazygit.nix
|
||||||
./programs/ledger.nix
|
./programs/ledger.nix
|
||||||
./programs/less.nix
|
./programs/less.nix
|
||||||
|
|
62
modules/programs/lazydocker.nix
Normal file
62
modules/programs/lazydocker.nix
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
cfg = config.programs.lazydocker;
|
||||||
|
|
||||||
|
yamlFormat = pkgs.formats.yaml { };
|
||||||
|
|
||||||
|
inherit (pkgs.stdenv.hostPlatform) isDarwin;
|
||||||
|
|
||||||
|
in {
|
||||||
|
meta.maintainers = [ hm.maintainers.hausken ];
|
||||||
|
|
||||||
|
options.programs.lazydocker = {
|
||||||
|
enable = mkEnableOption
|
||||||
|
"lazydocker, a simple terminal UI for both docker and docker compose";
|
||||||
|
|
||||||
|
package = mkPackageOption pkgs "lazydocker" { };
|
||||||
|
|
||||||
|
settings = mkOption {
|
||||||
|
type = yamlFormat.type;
|
||||||
|
default = {
|
||||||
|
commandTemplates.dockerCompose =
|
||||||
|
"docker compose"; # Lazydocker uses docker-compose by default which will not work
|
||||||
|
};
|
||||||
|
example = literalExpression ''
|
||||||
|
{
|
||||||
|
gui.theme = {
|
||||||
|
activeBorderColor = ["red" "bold"];
|
||||||
|
inactiveBorderColor = ["blue"];
|
||||||
|
};
|
||||||
|
commandTemplates.dockerCompose = "docker compose compose -f docker-compose.yml";
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
Configuration written to
|
||||||
|
{file}`$XDG_CONFIG_HOME/lazydocker/config.yml`
|
||||||
|
on Linux or on Darwin if [](#opt-xdg.enable) is set, otherwise
|
||||||
|
{file}`~/Library/Application Support/jesseduffield/lazydocker/config.yml`.
|
||||||
|
See
|
||||||
|
<https://github.com/jesseduffield/lazydocker/blob/master/docs/Config.md>
|
||||||
|
for supported values.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
|
home.file."Library/Application Support/jesseduffield/lazydocker/config.yml" =
|
||||||
|
mkIf (cfg.settings != { } && (isDarwin && !config.xdg.enable)) {
|
||||||
|
source = yamlFormat.generate "lazydocker-config" cfg.settings;
|
||||||
|
};
|
||||||
|
|
||||||
|
xdg.configFile."lazydocker/config.yml" =
|
||||||
|
mkIf (cfg.settings != { } && !(isDarwin && !config.xdg.enable)) {
|
||||||
|
source = yamlFormat.generate "lazydocker-config" cfg.settings;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -96,6 +96,7 @@ in import nmtSrc {
|
||||||
./modules/programs/khard
|
./modules/programs/khard
|
||||||
./modules/programs/kitty
|
./modules/programs/kitty
|
||||||
./modules/programs/ledger
|
./modules/programs/ledger
|
||||||
|
./modules/programs/lazydocker
|
||||||
./modules/programs/less
|
./modules/programs/less
|
||||||
./modules/programs/lf
|
./modules/programs/lf
|
||||||
./modules/programs/lsd
|
./modules/programs/lsd
|
||||||
|
|
17
tests/modules/programs/lazydocker/custom-settings.nix
Normal file
17
tests/modules/programs/lazydocker/custom-settings.nix
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{ ... }: {
|
||||||
|
programs.lazydocker = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
commandTemplates.dockerCompose = "docker compose";
|
||||||
|
gui.theme = {
|
||||||
|
activeBorderColor = [ "red" "bold" ];
|
||||||
|
inactiveBorderColor = [ "blue" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.config/lazydocker/config.yml
|
||||||
|
assertFileContent home-files/.config/lazydocker/config.yml \
|
||||||
|
${./custom-settings.yml}
|
||||||
|
'';
|
||||||
|
}
|
9
tests/modules/programs/lazydocker/custom-settings.yml
Normal file
9
tests/modules/programs/lazydocker/custom-settings.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
commandTemplates:
|
||||||
|
dockerCompose: docker compose
|
||||||
|
gui:
|
||||||
|
theme:
|
||||||
|
activeBorderColor:
|
||||||
|
- red
|
||||||
|
- bold
|
||||||
|
inactiveBorderColor:
|
||||||
|
- blue
|
9
tests/modules/programs/lazydocker/default-settings.nix
Normal file
9
tests/modules/programs/lazydocker/default-settings.nix
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{ ... }: {
|
||||||
|
programs.lazydocker.enable = true;
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.config/lazydocker/config.yml
|
||||||
|
assertFileContent home-files/.config/lazydocker/config.yml \
|
||||||
|
${./default.yml}
|
||||||
|
'';
|
||||||
|
}
|
5
tests/modules/programs/lazydocker/default.nix
Normal file
5
tests/modules/programs/lazydocker/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
lazydocker-default-settings = ./default-settings.nix;
|
||||||
|
lazydocker-custom-settings = ./custom-settings.nix;
|
||||||
|
}
|
||||||
|
|
2
tests/modules/programs/lazydocker/default.yml
Normal file
2
tests/modules/programs/lazydocker/default.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
commandTemplates:
|
||||||
|
dockerCompose: docker compose
|
Loading…
Reference in a new issue