Move ssh and starship config into own files

Add helper script ssh-keygen-defaults

starship: always enable hostname module, add octicon icon for package
module
This commit is contained in:
Evie Litherland-Smith 2024-05-20 09:35:15 +01:00
parent 1cccd418b5
commit 93d1867f5f
3 changed files with 156 additions and 145 deletions

View file

@ -5,6 +5,8 @@
}: { }: {
imports = [ imports = [
./git.nix ./git.nix
./ssh.nix
./starship.nix
./bottom.nix ./bottom.nix
./zellij.nix ./zellij.nix
]; ];
@ -42,151 +44,6 @@
changeDirWidgetCommand = "${pkgs.fd}/bin/fd --type d"; changeDirWidgetCommand = "${pkgs.fd}/bin/fd --type d";
fileWidgetCommand = "${pkgs.fd}/bin/fd --type f"; fileWidgetCommand = "${pkgs.fd}/bin/fd --type f";
}; };
ssh = {
enable = true;
forwardAgent = true;
compression = true;
serverAliveInterval = 15;
serverAliveCountMax = 3;
controlMaster = "auto";
controlPersist = "10s";
extraConfig = ''
AddKeysToAgent=yes
SetEnv TERM=xterm-256color
'';
matchBlocks = {
"git*".user = "git";
"legion" = {
user = "pixelifytica";
hostname = "192.168.0.31";
};
"vanguard" = {
user = "pixelifytica";
hostname = "192.168.0.90";
};
"ionos" = {
user = "root";
hostname = "77.68.67.133";
};
"freia" = {
user = "elitherl";
hostname = "freia020.hpc.l";
forwardX11Trusted = true;
};
"heimdall" = {
user = "elitherl";
hostname = "heimdall003.jet.uk";
forwardX11Trusted = true;
};
};
};
starship = {
enable = true;
enableTransience = true;
settings = {
add_newline = false;
c = {symbol = " ";};
character = {
success_symbol = "[󰁔 ](bold green)";
error_symbol = "[󰁔 ](bold red)";
};
command_timeout = 2000;
container = {symbol = " ";};
directory = {
truncation_length = 2;
fish_style_pwd_dir_length = 1;
truncate_to_repo = false;
};
direnv = {disabled = false;};
git_branch = {
symbol = " ";
only_attached = true;
ignore_branches = ["master" "main"];
};
git_commit = {
format = "[ $hash | $tag]($style) ";
tag_symbol = " ";
tag_disabled = false;
};
git_metrics = {disabled = false;};
git_status = {
stashed = " ";
ahead = " ";
behind = " ";
up_to_date = "";
diverged = " ";
conflicted = " ";
deleted = " ";
renamed = " ";
modified = " ";
staged = " ";
untracked = " ";
typechanged = " ";
};
hostname = {
ssh_only = true;
ssh_symbol = "󰢹 ";
};
jobs = {symbol = "󰈏 ";};
line_break = {disabled = false;};
localip = {disabled = false;};
lua = {symbol = " ";};
memory_usage = {disabled = false;};
nodejs = {symbol = " ";};
os = {
disabled = false;
format = "on [$symbol]($style) ";
symbols = {
Alpine = " ";
Arch = " ";
Artix = " ";
CentOS = " ";
Debian = " ";
EndeavourOS = " ";
Fedora = " ";
FreeBSD = " ";
Gentoo = " ";
Illumos = " ";
Linux = " ";
Macos = " ";
Manjaro = " ";
Mint = " ";
NixOS = " ";
OpenBSD = " ";
openSUSE = " ";
Pop = " ";
Raspbian = " ";
Redhat = " ";
RedHatEnterprise = " ";
Solus = " ";
SUSE = " ";
Ubuntu = " ";
Unknown = " ";
Windows = " ";
};
};
python = {
python_binary = "python3";
symbol = " ";
};
shell = {
disabled = false;
format = "using [$indicator ]($style)";
};
status = {
disabled = false;
map_symbol = true;
pipestatus = true;
symbol = " ";
success_symbol = "";
not_executable_symbol = " ";
not_found_symbol = " ";
sigint_symbol = " ";
signal_symbol = " ";
};
sudo = {disabled = false;};
};
};
zsh = { zsh = {
enable = true; enable = true;
enableCompletion = true; enableCompletion = true;

44
programs/shell/ssh.nix Normal file
View file

@ -0,0 +1,44 @@
{pkgs, ...}: {
home.packages = with pkgs; [
(writeShellScriptBin "ssh-keygen-defaults"
''ssh-keygen -t ed25519 -C "$(whoami)@$(hostname)"'')
];
programs.ssh = {
enable = true;
forwardAgent = true;
compression = true;
serverAliveInterval = 15;
serverAliveCountMax = 3;
controlMaster = "auto";
controlPersist = "10s";
extraConfig = ''
AddKeysToAgent=yes
SetEnv TERM=xterm-256color
'';
matchBlocks = {
"git*".user = "git";
"legion" = {
user = "pixelifytica";
hostname = "192.168.0.31";
};
"vanguard" = {
user = "pixelifytica";
hostname = "192.168.0.90";
};
"ionos" = {
user = "root";
hostname = "77.68.67.133";
};
"freia" = {
user = "elitherl";
hostname = "freia020.hpc.l";
forwardX11Trusted = true;
};
"heimdall" = {
user = "elitherl";
hostname = "heimdall003.jet.uk";
forwardX11Trusted = true;
};
};
};
}

110
programs/shell/starship.nix Normal file
View file

@ -0,0 +1,110 @@
{...}: {
programs.starship = {
enable = true;
enableTransience = true;
settings = {
add_newline = false;
c = {symbol = " ";};
character = {
success_symbol = "[󰁔 ](bold green)";
error_symbol = "[󰁔 ](bold red)";
};
command_timeout = 2000;
container = {symbol = " ";};
directory = {
truncation_length = 2;
fish_style_pwd_dir_length = 1;
truncate_to_repo = false;
};
direnv = {disabled = false;};
git_branch = {
symbol = " ";
only_attached = true;
ignore_branches = ["master" "main"];
};
git_commit = {
format = "[ $hash | $tag]($style) ";
tag_symbol = " ";
tag_disabled = false;
};
git_metrics = {disabled = false;};
git_status = {
stashed = " ";
ahead = " ";
behind = " ";
up_to_date = "";
diverged = " ";
conflicted = " ";
deleted = " ";
renamed = " ";
modified = " ";
staged = " ";
untracked = " ";
typechanged = " ";
};
hostname = {
ssh_only = false;
ssh_symbol = "󰢹 ";
};
jobs = {symbol = "󰈏 ";};
line_break = {disabled = false;};
localip = {disabled = false;};
lua = {symbol = " ";};
memory_usage = {disabled = false;};
nodejs = {symbol = " ";};
os = {
disabled = false;
format = "on [$symbol]($style) ";
symbols = {
Alpine = " ";
Arch = " ";
Artix = " ";
CentOS = " ";
Debian = " ";
EndeavourOS = " ";
Fedora = " ";
FreeBSD = " ";
Gentoo = " ";
Illumos = " ";
Linux = " ";
Macos = " ";
Manjaro = " ";
Mint = " ";
NixOS = " ";
OpenBSD = " ";
openSUSE = " ";
Pop = " ";
Raspbian = " ";
Redhat = " ";
RedHatEnterprise = " ";
Solus = " ";
SUSE = " ";
Ubuntu = " ";
Unknown = " ";
Windows = " ";
};
};
package = {symbol = " ";};
python = {
python_binary = "python3";
symbol = " ";
};
shell = {
disabled = false;
format = "using [$indicator ]($style)";
};
status = {
disabled = false;
map_symbol = true;
pipestatus = true;
symbol = " ";
success_symbol = "";
not_executable_symbol = " ";
not_found_symbol = " ";
sigint_symbol = " ";
signal_symbol = " ";
};
sudo = {disabled = false;};
};
};
}