1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00
home-manager/modules/programs/granted.nix
Austin Horstman b8bb556ce5 maintainers: remove duplicate HM entries
We can remove duplicate entries and redirect to the nixpkgs entry.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2025-07-04 09:20:48 -05:00

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
'';
};
}