mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 03:29:45 +01:00
yazi: allow literal string for initLua
This commit is contained in:
parent
269cc18d94
commit
e915831472
3 changed files with 22 additions and 2 deletions
|
@ -141,7 +141,7 @@ in {
|
|||
};
|
||||
|
||||
initLua = mkOption {
|
||||
type = with types; nullOr path;
|
||||
type = with types; nullOr (either path lines);
|
||||
default = null;
|
||||
description = ''
|
||||
The init.lua for Yazi itself.
|
||||
|
@ -210,7 +210,12 @@ in {
|
|||
"yazi/theme.toml" = mkIf (cfg.theme != { }) {
|
||||
source = tomlFormat.generate "yazi-theme" cfg.theme;
|
||||
};
|
||||
"yazi/init.lua" = mkIf (cfg.initLua != null) { source = cfg.initLua; };
|
||||
"yazi/init.lua" = mkIf (cfg.initLua != null)
|
||||
(if builtins.isPath cfg.initLua then {
|
||||
source = cfg.initLua;
|
||||
} else {
|
||||
text = cfg.initLua;
|
||||
});
|
||||
} // (mapAttrs' (name: value:
|
||||
nameValuePair "yazi/flavors/${name}.yazi" { source = value; })
|
||||
cfg.flavors) // (mapAttrs' (name: value:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
yazi-settings = ./settings.nix;
|
||||
yazi-init-lua-string = ./init-lua-string.nix;
|
||||
yazi-bash-integration-enabled = ./bash-integration-enabled.nix;
|
||||
yazi-zsh-integration-enabled = ./zsh-integration-enabled.nix;
|
||||
yazi-fish-integration-enabled = ./fish-integration-enabled.nix;
|
||||
|
|
14
tests/modules/programs/yazi/init-lua-string.nix
Normal file
14
tests/modules/programs/yazi/init-lua-string.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{ ... }: {
|
||||
programs.yazi = {
|
||||
enable = true;
|
||||
|
||||
initLua = builtins.readFile ./init.lua;
|
||||
};
|
||||
|
||||
test.stubs.yazi = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent home-files/.config/yazi/init.lua \
|
||||
${./init.lua}
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue