fork/home-manager
git clone https://git.julia.blue/fork/home-manager
75790441
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6 7cfg = config . programs . zellij ; 8yamlFormat = pkgs . formats . yaml { }; 9 10in { 11meta . maintainers = [ hm . maintainers . mainrs ]; 12 13options . programs . zellij = { 14enable = mkEnableOption "zellij" ; 15 16package = mkOption { 17type = types . package ; 18default = pkgs . zellij ; 19defaultText = literalExpression "pkgs.zellij" ; 20description = '' 21The zellij package to install. 22'' ; 23}; 24 25settings = mkOption { 26type = yamlFormat . type ; 27default = { }; 28example = literalExpression '' 29{ 30theme = "custom"; 31themes.custom.fg = "#ffffff"; 32} 33'' ; 34description = '' 35Configuration written to 36{file}`$XDG_CONFIG_HOME/zellij/config.yaml`. 37 38See <https://zellij.dev/documentation> for the full 39list of options. 40'' ; 41}; 42 43enableBashIntegration = mkEnableOption "Bash integration" // { 44default = false ; 45}; 46 47enableZshIntegration = mkEnableOption "Zsh integration" // { 48default = false ; 49}; 50 51enableFishIntegration = mkEnableOption "Fish integration" // { 52default = false ; 53}; 54}; 55 56config = mkIf cfg . enable { 57home . packages = [ cfg . package ]; 58 59# Zellij switched from yaml to KDL in version 0.32.0: 60# https://github.com/zellij-org/zellij/releases/tag/v0.32.0 61xdg . configFile . "zellij/config.yaml" = mkIf 62( cfg . settings != { } && ( versionOlder cfg . package . version "0.32.0" )) { 63source = yamlFormat . generate "zellij.yaml" cfg . settings ; 64}; 65 66xdg . configFile . "zellij/config.kdl" = mkIf 67( cfg . settings != { } && ( versionAtLeast cfg . package . version "0.32.0" )) { 68text = lib . hm . generators . toKDL { } cfg . settings ; 69}; 70 71programs . bash . initExtra = mkIf cfg . enableBashIntegration ( mkOrder 200 '' 72eval "$(zellij setup --generate-auto-start bash)" 73'' ); 74 75programs . zsh . initExtra = mkIf cfg . enableZshIntegration ( mkOrder 200 '' 76eval "$(zellij setup --generate-auto-start zsh)" 77'' ); 78 79programs . fish . interactiveShellInit = mkIf cfg . enableFishIntegration 80( mkOrder 200 '' 81eval (zellij setup --generate-auto-start fish | string collect) 82'' ); 83}; 84}