fork/home-manager
git clone https://git.julia.blue/fork/home-manager
a4f45087
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6 7cfg = config . programs . jujutsu ; 8tomlFormat = pkgs . formats . toml { }; 9 10in { 11meta . maintainers = [ maintainers . shikanime ]; 12 13options . programs . jujutsu = { 14enable = 15mkEnableOption "a Git-compatible DVCS that is both simple and powerful" ; 16 17package = mkPackageOption pkgs "jujutsu" { }; 18 19settings = mkOption { 20type = tomlFormat . type ; 21default = { }; 22example = literalExpression '' 23{ 24user = { 25name = "John Doe"; 26email = "jdoe@example.org"; 27}; 28} 29'' ; 30description = '' 31Options to add to the {file}`.jjconfig.toml` file. See 32<https://github.com/martinvonz/jj/blob/main/docs/config.md> 33for options. 34'' ; 35}; 36 37enableBashIntegration = mkOption { 38type = types . bool ; 39default = true ; 40description = "Whether to enable Bash integration." ; 41}; 42 43enableZshIntegration = mkOption { 44type = types . bool ; 45default = true ; 46description = "Whether to enable Zsh integration." ; 47}; 48 49enableFishIntegration = mkOption { 50type = types . bool ; 51default = true ; 52description = "Whether to enable Fish integration." ; 53}; 54}; 55 56config = mkIf cfg . enable { 57home . packages = [ cfg . package ]; 58 59home . file . ".jjconfig.toml" = mkIf ( cfg . settings != { }) { 60source = tomlFormat . generate "jujutsu-config" cfg . settings ; 61}; 62 63programs . bash . initExtra = mkIf cfg . enableBashIntegration '' 64source <( ${ pkgs . jujutsu } /bin/jj util completion) 65'' ; 66 67programs . zsh . initExtra = mkIf cfg . enableZshIntegration '' 68source <( ${ pkgs . jujutsu } /bin/jj util completion --zsh) 69compdef _jj ${ pkgs . jujutsu } /bin/jj 70'' ; 71 72programs . fish . interactiveShellInit = mkIf cfg . enableFishIntegration '' 73${ pkgs . jujutsu } /bin/jj util completion --fish | source 74'' ; 75}; 76}