diff options
author | Alyssa Ross <hi@alyssa.is> | 2024-05-21 11:19:54 +0200 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2024-05-21 11:19:54 +0200 |
commit | 1f7ea1acad1207378e325dd0d6527a983d7192b5 (patch) | |
tree | 38c0985697418e959e9c872b1afde54f9e6880f2 /nixpkgs/pkgs/by-name/ya | |
parent | a4ffc889571c7100467c7aa1ccae5a4d8373089f (diff) | |
parent | 6c0b7a92c30122196a761b440ac0d46d3d9954f1 (diff) | |
download | nixlib-1f7ea1acad1207378e325dd0d6527a983d7192b5.tar nixlib-1f7ea1acad1207378e325dd0d6527a983d7192b5.tar.gz nixlib-1f7ea1acad1207378e325dd0d6527a983d7192b5.tar.bz2 nixlib-1f7ea1acad1207378e325dd0d6527a983d7192b5.tar.lz nixlib-1f7ea1acad1207378e325dd0d6527a983d7192b5.tar.xz nixlib-1f7ea1acad1207378e325dd0d6527a983d7192b5.tar.zst nixlib-1f7ea1acad1207378e325dd0d6527a983d7192b5.zip |
Merge remote-tracking branch 'nixpkgs/nixos-unstable'
Diffstat (limited to 'nixpkgs/pkgs/by-name/ya')
-rw-r--r-- | nixpkgs/pkgs/by-name/ya/yazi-unwrapped/package.nix | 2 | ||||
-rw-r--r-- | nixpkgs/pkgs/by-name/ya/yazi/package.nix | 45 |
2 files changed, 44 insertions, 3 deletions
diff --git a/nixpkgs/pkgs/by-name/ya/yazi-unwrapped/package.nix b/nixpkgs/pkgs/by-name/ya/yazi-unwrapped/package.nix index d0a0d77ecfec..77a9b9ad8b5b 100644 --- a/nixpkgs/pkgs/by-name/ya/yazi-unwrapped/package.nix +++ b/nixpkgs/pkgs/by-name/ya/yazi-unwrapped/package.nix @@ -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"; }; } diff --git a/nixpkgs/pkgs/by-name/ya/yazi/package.nix b/nixpkgs/pkgs/by-name/ya/yazi/package.nix index 134db023edd9..ee807645c3fd 100644 --- a/nixpkgs/pkgs/by-name/ya/yazi/package.nix +++ b/nixpkgs/pkgs/by-name/ya/yazi/package.nix @@ -3,6 +3,7 @@ , makeWrapper , yazi-unwrapped +, withRuntimeDeps ? true , withFile ? true , file , withJq ? true @@ -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 @@ -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; @@ -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}"} '' |