Skip to content

Commit

Permalink
docs: add nix example
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi committed Jul 8, 2024
1 parent e4b81c4 commit 5388f12
Showing 1 changed file with 69 additions and 1 deletion.
70 changes: 69 additions & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,75 @@ environment.systemPackages = with pkgs; [
];
```

You can also manage Yazi's configuration using [home-manager](https://nix-community.github.io/home-manager/options.xhtml#opt-programs.yazi.enable).
You can also manage Yazi's configuration using [home-manager](https://nix-community.github.io/home-manager/options.xhtml#opt-programs.yazi.enable), here is a configuration template example:

<details>
<summary>Demonstrate configuring Yazi with home-manager</summary>

```nix
{pkgs, ...}: let
plugins-repo = pkgs.fetchFromGitHub {
owner = "yazi-rs";
repo = "plugins";
rev = "8d1aa6c7839b868973e34f6160055d824bb8c399";
hash = "sha256-EuXkiK80a1roD6ZJs5KEvXELcQhhBtAH5VyfW9YFRc8=";
};
in {
programs.yazi = {
enable = true;
enableZshIntegration = true;
shellWrapperName = "y";
settings = {
manager = {
show_hidden = true;
};
preview = {
max_width = 1000;
max_height = 1000;
};
};
plugins = {
chmod = "${plugins-repo}/chmod.yazi";
hide-preview = "${plugins-repo}/hide-preview.yazi";
max-preview = "${plugins-repo}/max-preview.yazi";
starship = pkgs.fetchFromGitHub {
owner = "Rolv-Apneseth";
repo = "starship.yazi";
rev = "6197e4cca4caed0121654079151632f6abcdcae9";
sha256 = "sha256-oHoBq7BESjGeKsaBnDt0TXV78ggGCdYndLpcwwQ8Zts=";
};
};
initLua = ''
require("starship"):setup()
'';
keymap = {
manager.prepend_keymap = [
{
on = ["t"];
run = "plugin --sync hide-preview";
desc = "Switch the preview pane between hidden and shown";
}
{
on = ["T"];
run = "plugin --sync max-preview";
desc = "Maximize or restore the preview pane";
}
{
on = ["c" "m"];
run = "plugin chmod";
desc = "Chmod on selected files";
}
];
};
};
}
```

</details>

## Nix flakes

Expand Down

0 comments on commit 5388f12

Please sign in to comment.