system/modules/home-manager/programs/dev-tools.nix

102 lines
2.6 KiB
Nix
Raw Normal View History

2024-04-16 02:51:46 +03:00
{ config, lib, pkgs, ... }:
let
cfg = config.local.programs.dev-tools;
in
{
options.local.programs.dev-tools = with lib; {
base.enable = mkEnableOption "base tools";
nix.enable = mkEnableOption "tools for nix developer";
web.enable = mkEnableOption "tools for web developer";
k8s.enable = mkEnableOption "k8s tools";
psql = {
enable = mkEnableOption "psql";
package = mkOption {
type = types.package;
default = pkgs.postgresql;
};
};
eza.enable = mkEnableOption "eza. ls replacement";
direnv.enable = mkEnableOption "direnv";
zoxide.enable = mkEnableOption "zoxide";
};
config = lib.mkMerge [
(lib.mkIf cfg.base.enable {
home.packages = with pkgs; [
gnumake
bat # a cat clone with syntax highlighting and git integration
fd # a simple, fast and user-friendly alternative to find
ripgrep # a fuzzy finder
libnotify # tool to send notifications via cli
];
})
(lib.mkIf cfg.eza.enable {
programs.eza = {
enable = true;
package = pkgs.unstable.eza.override { gitSupport = false; };
};
programs.zsh.shellAliases =
let
defaultArgs = "--icons --classify --group-directories-first --all";
bin = "${config.programs.eza.package}/bin/exa ${defaultArgs}";
in
lib.mkIf config.programs.zsh.enable {
ls = "${bin} --oneline";
lt = "${bin} --tree --level=3";
ll = "${bin} --long --header";
};
})
(lib.mkIf cfg.direnv.enable {
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
})
(lib.mkIf cfg.zoxide.enable {
programs.zoxide = {
enable = true;
enableZshIntegration = config.programs.zsh.enable;
};
})
(lib.mkIf cfg.web.enable {
home.packages = with pkgs.unstable; [
xh # friendly and fast tool for sending HTTP requests
deno
docker-compose
];
})
(lib.mkIf cfg.nix.enable {
home.packages = with pkgs.unstable; [
nixpkgs-fmt # nix formatter
nil # nix lsp server
];
})
(lib.mkIf cfg.k8s.enable {
home.packages = with pkgs; [
(google-cloud-sdk.withExtraComponents (
let gc = google-cloud-sdk.components; in [
gc.gke-gcloud-auth-plugin
gc.kubectl
]
))
];
programs.zsh.initExtra = ''
source <(kubectl completion zsh)
'';
2024-04-16 02:51:46 +03:00
})
(lib.mkIf cfg.psql.enable {
home.packages = [ cfg.psql.package ];
})
];
}