nix-configuration/home-manager/common.nix

189 lines
3.9 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
lib,
pkgs,
...
}:
let
zshSourceCommon = ./zsh/common;
isDarwin = pkgs.stdenv.hostPlatform.isDarwin;
isLinux = pkgs.stdenv.hostPlatform.isLinux;
in
{
imports = [
(import ./nix-init-scripts.nix {
inherit lib pkgs;
})
];
home.packages = with pkgs; [
awscli2
kubectl
nixd
viu
];
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
programs.bat = {
enable = true;
};
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
programs.htop = {
enable = true;
};
programs.k9s = {
enable = true;
settings = {
k9s = {
refreshRate = 2;
ui = {
logoless = true;
headless = true;
skin = "darkerbg";
};
logger = {
tail = 1000;
sinceSeconds = 60 * 30;
fullScreen = true;
showtime = true;
};
};
};
skins = {
darkerbg = {
k9s = {
body = {
bgColor = "#333";
};
frame = {
title = {
bgColor = "#333";
};
};
views = {
table = {
bgColor = "#333";
header = {
bgColor = "#333";
};
};
logs = {
bgColor = "#333";
};
};
};
};
};
};
programs.jq = {
enable = true;
};
programs.vim = {
enable = true;
settings = {
number = lib.mkDefault true;
relativenumber = lib.mkDefault true;
};
};
programs.zsh = {
enable = true;
autocd = lib.mkDefault true;
shellAliases =
{
cat = lib.mkDefault "bat --paging=never";
nixfix = lib.mkDefault "nix fmt ./**/*.nix";
# use eval $(aws-export-credentials) to expose them to environment
aws-export-credentials = lib.mkDefault "aws configure export-credentials --format env --profile";
# use curl-aws --aws-sigv4 "aws:amz:region:service"
curl-aws = lib.mkDefault "curl -H \"X-Amz-Security-Token: $AWS_SESSION_TOKEN\" --user \"$AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY\"";
git-sync-remote = lib.mkDefault "git remote update origin --prune";
}
// (
if isDarwin then
{
hm-switch = lib.mkDefault "darwin-rebuild switch --flake ~/.config/nix";
}
else if isLinux then
{
hm-switch = lib.mkDefault "home-manager switch --flake ~/.config/nix";
}
else
{ }
);
initExtra = lib.mkBefore ''
for file in ${zshSourceCommon}/*.zsh; do
source "$file"
done
# [Ctrl-RightArrow] - move forward one word
bindkey '^[[1;3C' forward-word
# [Ctrl-LeftArrow] - move backward one word
bindkey '^[[1;3D' backward-word
'';
};
programs.starship = {
enable = true;
enableZshIntegration = true;
settings = {
format = lib.concatStrings [
"$username"
"$hostname"
"$directory"
"$character"
];
right_format = lib.concatStrings [
"$git_branch"
"$git_commit"
"$git_state"
"$git_metrics"
"$git_status"
"($cmd_duration)"
];
scan_timeout = 25;
add_newline = false;
continuation_prompt = "[ ](dimmed white)";
follow_symlinks = false;
directory = {
truncate_to_repo = false;
truncation_length = 20;
truncation_symbol = "/";
};
cmd_duration = {
min_time = 100;
show_milliseconds = true;
format = "took [$duration]($style) ";
style = "bold yellow";
};
character = {
success_symbol = "[](bold green)";
error_symbol = "[](bold red)";
};
};
};
}