Loading nixos/modules/programs/yazi.nix +16 −28 Original line number Diff line number Diff line Loading @@ -6,8 +6,6 @@ let settingsFormat = pkgs.formats.toml { }; files = [ "yazi" "theme" "keymap" ]; dirs = [ "plugins" "flavors" ]; in { options.programs.yazi = { Loading Loading @@ -41,20 +39,24 @@ in description = '' The init.lua for Yazi itself. ''; example = lib.literalExpression "./init.lua"; }; } // (lib.listToAttrs (map (name: lib.nameValuePair name (lib.mkOption { plugins = lib.mkOption { type = with lib.types; attrsOf (oneOf [ path package ]); default = { }; description = '' Lua plugins. See https://yazi-rs.github.io/docs/${name}/overview/ for documentation. See https://yazi-rs.github.io/docs/plugins/overview/ for documentation. ''; })) dirs) ); example = lib.literalExpression '' { foo = ./foo; bar = pkgs.bar; } ''; }; flavors = lib.mkOption { type = with lib.types; attrsOf (oneOf [ path package ]); Loading @@ -75,27 +77,13 @@ in }; config = lib.mkIf cfg.enable { environment = { systemPackages = [ cfg.package ]; variables.YAZI_CONFIG_HOME = "/etc/yazi/"; etc = (lib.attrsets.mergeAttrsList (map (name: lib.optionalAttrs (cfg.settings.${name} != { }) { "yazi/${name}.toml".source = settingsFormat.generate "${name}.toml" cfg.settings.${name}; }) files)) // (lib.attrsets.mergeAttrsList (map (dir: if cfg.${dir} != { } then (lib.mapAttrs' (name: value: lib.nameValuePair "yazi/${dir}/${name}" { source = value; }) cfg.${dir}) else { # Yazi checks the directories. If they don't exist it tries to create them and then crashes. "yazi/${dir}".source = pkgs.emptyDirectory; environment.systemPackages = [ (cfg.package.override { inherit (cfg) settings initLua plugins flavors; }) dirs)) // lib.optionalAttrs (cfg.initLua != null) { "yazi/init.lua".source = cfg.initLua; }; }; ]; }; meta = { maintainers = with lib.maintainers; [ linsui ]; }; Loading pkgs/by-name/ya/yazi-unwrapped/package.nix +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ rustPlatform.buildRustPackage rec { description = "Blazing fast terminal file manager written in Rust, based on async I/O"; homepage = "https://github.com/sxyazi/yazi"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ xyenon matthiasbeyer ]; maintainers = with lib.maintainers; [ xyenon matthiasbeyer linsui ]; mainProgram = "yazi"; }; } pkgs/by-name/ya/yazi/package.nix +43 −2 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ , makeWrapper , yazi-unwrapped , withRuntimeDeps ? true , withFile ? true , file , withJq ? true Loading @@ -21,10 +22,16 @@ , fzf , withZoxide ? true , zoxide , settings ? { } , formats , plugins ? { } , flavors ? { } , initLua ? null }: let runtimePaths = with lib; [ ] runtimePaths = with lib; [ ] ++ optional withFile file ++ optional withJq jq ++ optional withPoppler poppler_utils Loading @@ -34,7 +41,40 @@ let ++ optional withRipgrep ripgrep ++ optional withFzf fzf ++ optional withZoxide zoxide; settingsFormat = formats.toml { }; files = [ "yazi" "theme" "keymap" ]; configHome = if (settings == { } && initLua == null && plugins == { } && flavors == { }) then null else runCommand "YAZI_CONFIG_HOME" { } '' mkdir -p $out ${lib.concatMapStringsSep "\n" (name: lib.optionalString (settings ? ${name} && settings.${name} != { }) '' ln -s ${settingsFormat.generate "${name}.toml" settings.${name}} $out/${name}.toml '') files} mkdir $out/plugins ${lib.optionalString (plugins != { }) '' ${lib.concatMapStringsSep "\n" (lib.mapAttrsToList (name: value: "ln -s ${value} $out/plugins/${name}") plugins)} ''} mkdir $out/flavors ${lib.optionalString (flavors != { }) '' ${lib.concatMapStringsSep "\n" (lib.mapAttrsToList (name: value: "ln -s ${value} $out/flavors/${name}") flavors)} ''} ${lib.optionalString (initLua != null) "ln -s ${initLua} $out/init.lua"} ''; in if (!withRuntimeDeps && configHome == null) then yazi-unwrapped else runCommand yazi-unwrapped.name { inherit (yazi-unwrapped) pname version meta; Loading @@ -44,5 +84,6 @@ runCommand yazi-unwrapped.name mkdir -p $out/bin ln -s ${yazi-unwrapped}/share $out/share makeWrapper ${yazi-unwrapped}/bin/yazi $out/bin/yazi \ --prefix PATH : "${lib.makeBinPath runtimePaths}" ${lib.optionalString withRuntimeDeps "--prefix PATH : \"${lib.makeBinPath runtimePaths}\""} \ ${lib.optionalString (configHome != null) "--set YAZI_CONFIG_HOME ${configHome}"} '' Loading
nixos/modules/programs/yazi.nix +16 −28 Original line number Diff line number Diff line Loading @@ -6,8 +6,6 @@ let settingsFormat = pkgs.formats.toml { }; files = [ "yazi" "theme" "keymap" ]; dirs = [ "plugins" "flavors" ]; in { options.programs.yazi = { Loading Loading @@ -41,20 +39,24 @@ in description = '' The init.lua for Yazi itself. ''; example = lib.literalExpression "./init.lua"; }; } // (lib.listToAttrs (map (name: lib.nameValuePair name (lib.mkOption { plugins = lib.mkOption { type = with lib.types; attrsOf (oneOf [ path package ]); default = { }; description = '' Lua plugins. See https://yazi-rs.github.io/docs/${name}/overview/ for documentation. See https://yazi-rs.github.io/docs/plugins/overview/ for documentation. ''; })) dirs) ); example = lib.literalExpression '' { foo = ./foo; bar = pkgs.bar; } ''; }; flavors = lib.mkOption { type = with lib.types; attrsOf (oneOf [ path package ]); Loading @@ -75,27 +77,13 @@ in }; config = lib.mkIf cfg.enable { environment = { systemPackages = [ cfg.package ]; variables.YAZI_CONFIG_HOME = "/etc/yazi/"; etc = (lib.attrsets.mergeAttrsList (map (name: lib.optionalAttrs (cfg.settings.${name} != { }) { "yazi/${name}.toml".source = settingsFormat.generate "${name}.toml" cfg.settings.${name}; }) files)) // (lib.attrsets.mergeAttrsList (map (dir: if cfg.${dir} != { } then (lib.mapAttrs' (name: value: lib.nameValuePair "yazi/${dir}/${name}" { source = value; }) cfg.${dir}) else { # Yazi checks the directories. If they don't exist it tries to create them and then crashes. "yazi/${dir}".source = pkgs.emptyDirectory; environment.systemPackages = [ (cfg.package.override { inherit (cfg) settings initLua plugins flavors; }) dirs)) // lib.optionalAttrs (cfg.initLua != null) { "yazi/init.lua".source = cfg.initLua; }; }; ]; }; meta = { maintainers = with lib.maintainers; [ linsui ]; }; Loading
pkgs/by-name/ya/yazi-unwrapped/package.nix +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ rustPlatform.buildRustPackage rec { description = "Blazing fast terminal file manager written in Rust, based on async I/O"; homepage = "https://github.com/sxyazi/yazi"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ xyenon matthiasbeyer ]; maintainers = with lib.maintainers; [ xyenon matthiasbeyer linsui ]; mainProgram = "yazi"; }; }
pkgs/by-name/ya/yazi/package.nix +43 −2 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ , makeWrapper , yazi-unwrapped , withRuntimeDeps ? true , withFile ? true , file , withJq ? true Loading @@ -21,10 +22,16 @@ , fzf , withZoxide ? true , zoxide , settings ? { } , formats , plugins ? { } , flavors ? { } , initLua ? null }: let runtimePaths = with lib; [ ] runtimePaths = with lib; [ ] ++ optional withFile file ++ optional withJq jq ++ optional withPoppler poppler_utils Loading @@ -34,7 +41,40 @@ let ++ optional withRipgrep ripgrep ++ optional withFzf fzf ++ optional withZoxide zoxide; settingsFormat = formats.toml { }; files = [ "yazi" "theme" "keymap" ]; configHome = if (settings == { } && initLua == null && plugins == { } && flavors == { }) then null else runCommand "YAZI_CONFIG_HOME" { } '' mkdir -p $out ${lib.concatMapStringsSep "\n" (name: lib.optionalString (settings ? ${name} && settings.${name} != { }) '' ln -s ${settingsFormat.generate "${name}.toml" settings.${name}} $out/${name}.toml '') files} mkdir $out/plugins ${lib.optionalString (plugins != { }) '' ${lib.concatMapStringsSep "\n" (lib.mapAttrsToList (name: value: "ln -s ${value} $out/plugins/${name}") plugins)} ''} mkdir $out/flavors ${lib.optionalString (flavors != { }) '' ${lib.concatMapStringsSep "\n" (lib.mapAttrsToList (name: value: "ln -s ${value} $out/flavors/${name}") flavors)} ''} ${lib.optionalString (initLua != null) "ln -s ${initLua} $out/init.lua"} ''; in if (!withRuntimeDeps && configHome == null) then yazi-unwrapped else runCommand yazi-unwrapped.name { inherit (yazi-unwrapped) pname version meta; Loading @@ -44,5 +84,6 @@ runCommand yazi-unwrapped.name mkdir -p $out/bin ln -s ${yazi-unwrapped}/share $out/share makeWrapper ${yazi-unwrapped}/bin/yazi $out/bin/yazi \ --prefix PATH : "${lib.makeBinPath runtimePaths}" ${lib.optionalString withRuntimeDeps "--prefix PATH : \"${lib.makeBinPath runtimePaths}\""} \ ${lib.optionalString (configHome != null) "--set YAZI_CONFIG_HOME ${configHome}"} ''