feat(home): shellAbbrs module

This commit is contained in:
punkfairie 2024-11-15 17:59:32 -08:00
parent 6ef9ec385a
commit 35c4b54705
Signed by: punkfairie
GPG key ID: A509E8F77FB9D696

View file

@ -1,21 +1,20 @@
{
config,
lib,
...
}:
with lib;
{ config, lib, ... }:
let
inherit (lib)
types
mkOption
attrsets
literalExpression
mkIf
;
# https://github.com/nix-community/home-manager/blob/master/modules/programs/fish.nix
abbrModule = types.submodule {
options = {
expansion = mkOption {
type = with types; nullOr str;
default = null;
description = ''
The command expanded by an abbreviation.
'';
description = "The command expanded by an abbreviation.";
};
position = mkOption {
@ -23,9 +22,9 @@ let
default = null;
example = "anywhere";
description = ''
If the position is "command", the abbreviation expands only if
the position is a command. If it is "anywhere", the abbreviation
expands anywhere.
If the position is "command", the abbreviation expands only if the
position is a command. If it is "anywhere", the abbreviation expands
anywhere.
'';
};
@ -50,9 +49,7 @@ let
function = mkOption {
type = with types; nullOr str;
default = null;
description = ''
The fish function expanded instead of a literal string.
'';
description = "The fish function expanded instead of a literal string.";
};
};
};
@ -82,9 +79,9 @@ in
}
'';
description = ''
An attribute set that maps aliases (the top level attribute names
in this option) to abbreviations. Abbreviations are expanded with
the longer phrase after they are entered.
An attribute set that maps aliases (the top level attribute names in
this option) to abbreviations. Abbreviations are expanded with the
longer phrase after they are entered.
'';
};
};
@ -92,7 +89,7 @@ in
config =
let
fishCfg = config.programs.fish;
shellAbbrs = config.home.shellAbbrs;
inherit (config.home) shellAbbrs;
in
{
programs.fish.shellAbbrs = mkIf fishCfg.enable shellAbbrs;