diff options
Diffstat (limited to 'modules/common/shell/default.nix')
-rw-r--r-- | modules/common/shell/default.nix | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/modules/common/shell/default.nix b/modules/common/shell/default.nix index 4ae41d8..cacb411 100644 --- a/modules/common/shell/default.nix +++ b/modules/common/shell/default.nix @@ -5,14 +5,13 @@ this, ... }: -with lib; let cfg = config.nixfiles.modules.common.shell; in { - options.nixfiles.modules.common.shell.aliases = mkOption { + options.nixfiles.modules.common.shell.aliases = lib.mkOption { description = "An attribute set of shell aliases."; - type = with types; attrsOf str; + type = with lib.types; attrsOf str; default = { }; }; @@ -24,8 +23,8 @@ in initExtra = let - aliasCompletions = concatStringsSep "\n" ( - mapAttrsToList (name: _: "complete -F _complete_alias ${name}") cfg.aliases + aliasCompletions = lib.concatStringsSep "\n" ( + lib.mapAttrsToList (name: _: "complete -F _complete_alias ${name}") cfg.aliases ); in '' @@ -45,7 +44,7 @@ in source "${./functions.bash}" - source "${getExe' pkgs.complete-alias "complete_alias"}" + source "${lib.getExe' pkgs.complete-alias "complete_alias"}" ${aliasCompletions} # https://github.com/garabik/grc?tab=readme-ov-file#bash @@ -73,19 +72,18 @@ in ]; shellAliases = - listToAttrs ( + lib.listToAttrs ( map ( { name, value }: - nameValuePair name ( - with pkgs; + lib.nameValuePair name ( let pkg = if this.isHeadful then (pkgs.coreutils.overrideAttrs ( _: super: { patches = (super.patches or [ ]) ++ [ - (fetchpatch { + (pkgs.fetchpatch { url = "https://raw.githubusercontent.com/jarun/advcpmv/1e2b1c6b74fa0974896bf94604279a3f74b37a63/advcpmv-0.9-9.5.patch"; hash = "sha256-LRfb4heZlAUKiXl/hC/HgoqeGMxCt8ruBYZUrbzSH+Y="; }) @@ -93,24 +91,24 @@ in } )) else - coreutils; + pkgs.coreutils; in - "${getExe' pkg "coreutils"} --coreutils-prog=${value}" + "${lib.getExe' pkg "coreutils"} --coreutils-prog=${value}" ) ) ( let mkAlias = { - name ? head command, + name ? lib.head command, command, }: { inherit name; - value = concatStringsSep " " command; + value = lib.concatStringsSep " " command; }; - progressBar = optionalString this.isHeadful "--progress-bar"; + progressBar = lib.optionalString this.isHeadful "--progress-bar"; in [ (mkAlias { @@ -171,7 +169,7 @@ in ] ) ) - // (genAttrs [ + // (lib.genAttrs [ "grep" "egrep" "fgrep" |