mirror of
https://github.com/nix-community/home-manager
synced 2024-11-22 12:43:14 +00:00
fd: add module
This commit is contained in:
parent
ff1c364654
commit
ffc3600f40
3 changed files with 67 additions and 0 deletions
|
@ -1476,6 +1476,13 @@ in {
|
|||
A new module is available: 'programs.bun'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2024-04-18T22:30:49+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.fd'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@ let
|
|||
./programs/emacs.nix
|
||||
./programs/eww.nix
|
||||
./programs/eza.nix
|
||||
./programs/fd.nix
|
||||
./programs/feh.nix
|
||||
./programs/firefox.nix
|
||||
./programs/fish.nix
|
||||
|
|
59
modules/programs/fd.nix
Normal file
59
modules/programs/fd.nix
Normal file
|
@ -0,0 +1,59 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
with lib; {
|
||||
meta.maintainers = [ maintainers.uncenter ];
|
||||
|
||||
options.programs.fd = {
|
||||
enable = mkEnableOption
|
||||
"fd, a simple, fast and user-friendly alternative to {command}`find`";
|
||||
|
||||
ignores = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ ".git/" "*.bak" ];
|
||||
description = "List of paths that should be globally ignored.";
|
||||
};
|
||||
|
||||
hidden = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Search hidden files and directories ({option}`--hidden` argument).
|
||||
'';
|
||||
};
|
||||
|
||||
extraOptions = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "--no-ignore" "--absolute-path" ];
|
||||
description = ''
|
||||
Extra command line options passed to fd.
|
||||
'';
|
||||
};
|
||||
|
||||
package = mkPackageOption pkgs "fd" { };
|
||||
};
|
||||
|
||||
config = let
|
||||
cfg = config.programs.fd;
|
||||
|
||||
args = escapeShellArgs (optional cfg.hidden "--hidden" ++ cfg.extraOptions);
|
||||
|
||||
optionsAlias = { fd = "fd ${args}"; };
|
||||
in mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
programs.bash.shellAliases = optionsAlias;
|
||||
|
||||
programs.zsh.shellAliases = optionsAlias;
|
||||
|
||||
programs.fish.shellAliases = optionsAlias;
|
||||
|
||||
programs.ion.shellAliases = optionsAlias;
|
||||
|
||||
programs.nushell.shellAliases = optionsAlias;
|
||||
|
||||
xdg.configFile."fd/ignore" = mkIf (cfg.ignores != [ ]) {
|
||||
text = concatStringsSep "\n" cfg.ignores + "\n";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue