main
 1{
 2  den.aspects.dev.yazi = {
 3    hjem = {pkgs, ...}: let
 4      auto-layout = pkgs.yaziPlugins.mkYaziPlugin {
 5        pname = "auto-layout.yazi";
 6        version = "unstable-25-07-30";
 7        src = pkgs.fetchFromGitHub {
 8          owner = "luccahuguet";
 9          repo = "auto-layout.yazi";
10          rev = "e24bee9f6dd15ff80eae1b3dc1a6b06ee7e66121";
11          hash = "sha256-4vRIGU/ArXhW9ervhyNhpfDN7UF4pqVYnxi6FExlgGk=";
12        };
13        meta = {
14          description = "Automatically change the column layout in yazi based on available window width";
15          homepage = "https://github.com/luccahuguet/auto-layout.yazi";
16          license = pkgs.lib.licenses.mit;
17        };
18      };
19    in {
20      packages = [pkgs.yazi];
21
22      files.".bashrc".text = ''
23        function yy() {
24          local tmp="$(mktemp -t "yazi-cwd.XXXXX")"
25          command yazi "$@" --cwd-file="$tmp"
26          if cwd="$(<"$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
27            builtin cd -- "$cwd"
28          fi
29          rm -f -- "$tmp"
30        }
31      '';
32
33      xdg.config.files = {
34        "yazi/plugins/auto-layout.yazi".source = auto-layout;
35        "yazi/plugins/git.yazi".source = pkgs.yaziPlugins.git;
36        "yazi/init.lua".text = ''
37          require("git"):setup()
38          require("auto-layout").setup()
39        '';
40
41        "yazi/yazi.toml" = {
42          generator = (pkgs.formats.toml {}).generate "yazi-settings.toml";
43          value = {
44            mgr = {
45              show_hidden = true;
46              sort_dir_first = true;
47            };
48            plugin.prepend_fetchers = [
49              {
50                url = "*";
51                run = "git";
52                group = "git";
53              }
54              {
55                url = "*/";
56                run = "git";
57                group = "git";
58              }
59            ];
60          };
61        };
62      };
63    };
64  };
65
66  den.aspects.dev.yazi.themes = {
67    catppuccin = {
68      hjem = {pkgs, ...}: let
69        catppuccin-yazi = pkgs.fetchurl {
70          url = "https://github.com/catppuccin/yazi/raw/baaf5d1c9427b836fbefd126aa855f9eab7a9d0d/themes/mocha/catppuccin-mocha-mauve.toml";
71          hash = "sha256-MaVO1ZSjxqULH00NoY9J6hEOw9QQA2vV6saN17WF9yE=";
72        };
73        catppuccin-syntax = pkgs.fetchurl {
74          name = "Catppuccin-Mocha.tmTheme";
75          url = "https://github.com/catppuccin/bat/raw/6810349b28055dce54076712fc05fc68da4b8ec0/themes/Catppuccin%20Mocha.tmTheme";
76          hash = "sha256-OVVm8IzrMBuTa5HAd2kO+U9662UbEhVT8gHJnCvUqnc=";
77        };
78      in {
79        xdg.config.files = {
80          "yazi/theme.toml".source = catppuccin-yazi;
81          "yazi/Catppuccin-mocha.tmTheme".source = catppuccin-syntax;
82        };
83      };
84    };
85  };
86}