1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-02 21:13:33 +02:00
home-manager/modules/programs/granted.nix
Willi Carlsen 48b0a30202
granted: add module
Signed-off-by: Willi Carlsen <carlsenwilli@gmail.com>
2023-11-01 22:20:17 +01:00

37 lines
717 B
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.granted;
package = pkgs.granted;
in {
meta.maintainers = [ hm.maintainers.wcarlsen ];
options.programs.granted = {
enable = mkEnableOption "granted";
enableZshIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Zsh integration.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ package ];
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
function assume() {
export GRANTED_ALIAS_CONFIGURED="true"
source ${package}/bin/.assume-wrapped "$@"
unset GRANTED_ALIAS_CONFIGURED
}
'';
};
}