mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36:05 +01:00
We can remove duplicate entries and redirect to the nixpkgs entry. Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
40 lines
976 B
Nix
40 lines
976 B
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.programs.granted;
|
|
in
|
|
{
|
|
meta.maintainers = [ lib.maintainers.wcarlsen ];
|
|
|
|
options.programs.granted = {
|
|
enable = lib.mkEnableOption "granted";
|
|
|
|
package = lib.mkPackageOption pkgs "granted" { };
|
|
|
|
enableZshIntegration = lib.hm.shell.mkZshIntegrationOption { inherit config; };
|
|
|
|
enableFishIntegration = lib.hm.shell.mkFishIntegrationOption { inherit config; };
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
home.packages = [ cfg.package ];
|
|
|
|
programs.zsh.initContent = lib.mkIf cfg.enableZshIntegration ''
|
|
function assume() {
|
|
export GRANTED_ALIAS_CONFIGURED="true"
|
|
source ${cfg.package}/bin/assume "$@"
|
|
unset GRANTED_ALIAS_CONFIGURED
|
|
}
|
|
'';
|
|
|
|
programs.fish.functions.assume = lib.mkIf cfg.enableFishIntegration ''
|
|
set -x GRANTED_ALIAS_CONFIGURED "true"
|
|
source ${cfg.package}/share/assume.fish $argv
|
|
set -e GRANTED_ALIAS_CONFIGURED
|
|
'';
|
|
};
|
|
}
|