2023-10-24 15:49:09 +02:00
|
|
|
{ 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"
|
2024-10-23 14:07:07 +02:00
|
|
|
source ${package}/bin/assume "$@"
|
2023-10-24 15:49:09 +02:00
|
|
|
unset GRANTED_ALIAS_CONFIGURED
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|