home-manager/modules/programs/just.nix

53 lines
1.2 KiB
Nix
Raw Normal View History

2022-02-19 01:57:35 +01:00
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.just;
in {
meta.maintainers = [ hm.maintainers.maximsmol ];
options.programs.just = {
enable = mkEnableOption
"just, a handy way to save and run project-specific commands";
package = mkOption {
type = types.package;
default = pkgs.just;
defaultText = literalExpression "pkgs.just";
description = "Package providing the <command>just</command> tool.";
};
enableBashIntegration = mkEnableOption "Bash integration" // {
default = true;
};
enableZshIntegration = mkEnableOption "Zsh integration" // {
default = true;
};
enableFishIntegration = mkEnableOption "Fish integration" // {
default = true;
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
source ${cfg.package}/share/bash-completion/completions/just.bash
'';
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
source ${cfg.package}/share/zsh/site-functions/_just
'';
programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
source ${cfg.package}/share/fish/vendor_completions.d/just.fish
'';
};
}