Files
nixos/home-manager/base/terminal.nix

225 lines
5.2 KiB
Nix

{ lib, config, pkgs, ... }:
with lib;
{
imports = [
../development/helix.nix
];
options.terminal = {
nixUpdateLocation = mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
};
flakeUpdateLocation = mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
};
homeUpdateLocation = mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
};
};
config = {
home.packages = with pkgs;[
nerd-fonts.space-mono
];
programs = {
bash = {
enable = true;
initExtra = ''
if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]]
then
shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION=""
exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
fi
'';
};
fish = {
enable = true;
interactiveShellInit = ''
set fish_greeting # Disable greeting
'';
};
git = {
enable = true;
delta.enable = true;
extraConfig = {
credential = {
helper = [ "cache --timeout 21600" "${pkgs.git-credential-manager}/bin/git-credential-manager" "${pkgs.git-credential-oauth}/bin/git-credential-oauth" ];
credentialStore = "secretservice";
};
"credential \"https://dev.azure.com\"" = {
useHttpPath = true;
};
"credential \"https://git.worble.xyz\"" = {
provider = "generic";
};
# stealing from https://blog.gitbutler.com/how-git-core-devs-configure-git/
column = {
ui = "auto";
};
branch = {
sort = "-committerdate";
};
tag = {
sort = "version:refname";
};
diff = {
algorithm = "histogram";
colorMoved = "plain";
mnemonicPrefix = true;
renames = true;
};
push = {
followTags = true;
};
fetch = {
prune = true;
pruneTags = true;
all = true;
};
rebase = {
autoSquash = true;
autoStash = true;
updateRefs = true;
};
};
};
gitui = {
enable = true;
};
starship.enable = true;
atuin.enable = true;
zellij = {
enable = true;
enableBashIntegration = true;
enableFishIntegration = true;
settings = {
theme = "dracula";
show_startup_tips = false;
default_mode = "locked";
};
};
direnv = {
enable = true;
enableBashIntegration = true;
nix-direnv.enable = true;
};
helix = {
enable = true;
defaultEditor = true;
settings = {
theme = "dracula";
};
};
bat = {
enable = true;
};
eza = {
enable = true;
enableBashIntegration = true;
enableFishIntegration = true;
git = true;
extraOptions = [
"--color=auto"
"--icons=always"
"--group-directories-first"
"--header"
];
};
yazi = {
enable = true;
settings = {
mgr = {
sort_by = "natural";
show_hidden = true;
};
};
};
bottom = {
enable = true;
};
fd = {
enable = true;
};
ripgrep = {
enable = true;
};
topgrade = with config.terminal;{
enable = true;
settings = mkMerge [{
misc = {
assume_yes = true;
};
}
(mkIf (nixUpdateLocation != null) {
linux = {
nix_arguments = "--flake ${nixUpdateLocation}";
};
})
(mkIf (homeUpdateLocation != null) {
linux = {
home_manager_arguments = [ "--flake" homeUpdateLocation ];
};
})
(mkIf (flakeUpdateLocation != null) {
pre_commands = {
nix-flake-update = "${(pkgs.writeShellScriptBin "nix-flake-update" ''
git -C ${flakeUpdateLocation} pull --quiet
sudo nix flake update --flake ${flakeUpdateLocation}
git -C ${flakeUpdateLocation} diff-index --quiet HEAD flake.lock || git -C ${flakeUpdateLocation} commit --quiet flake.lock -m "update flake.lock"
'')}/bin/nix-flake-update";
};
})];
};
alacritty = {
enable = true;
package = pkgs.alacritty;
settings = {
font = {
normal = {
family = "SpaceMono Nerd Font";
style = "Regular";
};
size = 14;
};
};
};
# eh not feeling it
# ghostty = {
# enable = true;
# enableBashIntegration = true;
# settings = {
# "font-family" = "SpaceMono Nerd Font";
# "font-size" = 14;
# theme = "Dracula";
# };
# };
yt-dlp = {
enable = true;
};
};
};
}