fork/home-manager
git clone https://git.julia.blue/fork/home-manager
55ce64c3
master
1{ config , lib , pkgs , ...} : 2with lib ; 3let cfg = config . programs . scmpuff ; 4in { 5meta . maintainers = [ maintainers . cpcloud ]; 6 7options . programs . scmpuff = { 8enable = mkEnableOption '' 9scmpuff, a command line tool that allows you to work quicker with Git by 10substituting numeric shortcuts for files'' ; 11 12package = mkOption { 13type = types . package ; 14default = pkgs . scmpuff ; 15defaultText = literalExpression "pkgs.scmpuff" ; 16description = "Package providing the {command}`scmpuff` tool." ; 17}; 18 19enableBashIntegration = mkOption { 20default = true ; 21type = types . bool ; 22description = '' 23Whether to enable Bash integration. 24'' ; 25}; 26 27enableZshIntegration = mkOption { 28default = true ; 29type = types . bool ; 30description = '' 31Whether to enable Zsh integration. 32'' ; 33}; 34 35enableFishIntegration = mkOption { 36default = true ; 37type = types . bool ; 38description = '' 39Whether to enable fish integration. 40'' ; 41}; 42 43enableAliases = mkOption { 44default = true ; 45type = types . bool ; 46description = '' 47Whether to enable aliases (e.g. gs, ga, gd, gco). 48'' ; 49}; 50}; 51 52config = mkIf cfg . enable ( let 53mkArgs = shell : 54concatStringsSep " " ([ "--shell= ${ shell } " ] 55++ optional ( ! cfg . enableAliases ) "--aliases=false" ); 56in { 57home . packages = [ cfg . package ]; 58 59programs . bash . initExtra = mkIf cfg . enableBashIntegration '' 60eval "$( ${ cfg . package } /bin/scmpuff init ${ mkArgs "bash" } )" 61'' ; 62 63programs . zsh . initExtra = mkIf cfg . enableZshIntegration '' 64eval "$( ${ cfg . package } /bin/scmpuff init ${ mkArgs "zsh" } )" 65'' ; 66 67programs . fish . interactiveShellInit = mkIf cfg . enableFishIntegration 68( mkAfter '' 69${ cfg . package } /bin/scmpuff init ${ mkArgs "fish" } | source 70'' ); 71}); 72}