From 35c4b54705a4b3bb5e884694fe4b61b1c06d8147 Mon Sep 17 00:00:00 2001 From: punkfairie Date: Fri, 15 Nov 2024 17:59:32 -0800 Subject: [PATCH] feat(home): shellAbbrs module --- .../home/shellAbbrs/default.nix | 39 +++++++++---------- 1 file changed, 18 insertions(+), 21 deletions(-) rename old/modules/home/shellAbbrs.nix => modules/home/shellAbbrs/default.nix (79%) diff --git a/old/modules/home/shellAbbrs.nix b/modules/home/shellAbbrs/default.nix similarity index 79% rename from old/modules/home/shellAbbrs.nix rename to modules/home/shellAbbrs/default.nix index 0eb9beb..1e5f7f2 100644 --- a/old/modules/home/shellAbbrs.nix +++ b/modules/home/shellAbbrs/default.nix @@ -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;