change my prompt up

This commit is contained in:
Gabriel Fontes
2022-06-20 00:39:52 -03:00
parent 4aa294a8e9
commit c5ce2f13eb
3 changed files with 95 additions and 26 deletions
+81 -23
View File
@@ -1,47 +1,104 @@
{ pkgs, ... }:
let
nix-inspect = pkgs.writeShellScriptBin "nix-inspect" ''
read -ra EXCLUDED <<< "$@"
IFS=":" read -ra PATHS <<< "$PATH"
read -ra PROGRAMS <<< \
"$(printf "%s\n" "''${PATHS[@]}" | ${pkgs.gnugrep}/bin/grep "\/nix\/store" | ${pkgs.perl}/bin/perl -pe 's/^\/nix\/store\/\w{32}-((?:[^-\/]|-(?!(?:\d|unstable)))+)(?:-?([^\/]*))\/.*$/\1/' | ${pkgs.findutils}/bin/xargs)"
for to_remove in "''${EXCLUDED[@]}"; do
PROGRAMS=("''${PROGRAMS[@]/$to_remove}")
done
read -ra PROGRAMS <<< "''${PROGRAMS[@]}"
echo "''${PROGRAMS[@]}"
'';
in
{
programs.starship = {
enable = true;
settings = {
format = ''
$username$hostname$shlvl $cmd_duration
$directory$git_branch$git_commit$git_state$git_status$hg_branch$docker_context$package$cmake$dart$dotnet$elixir$elm$erlang$golang$helm$java$julia$kotlin$nim$nodejs$ocaml$perl$php$purescript$python$ruby$rust$swift$terraform$zig$nix_shell$conda$memory_usage$aws$gcloud$openstack$env_var$crystal
$jobs$character
'';
format =
let
git = "$git_branch$git_commit$git_state$git_status";
cloud = "$aws$gcloud$openstack";
in
''
$username$hostname( $shlvl)( $cmd_duration)
($nix_shell )''${custom.nix_inspect}
$directory( ${git})(- ${cloud})
$jobs$character
'';
# Core
username = {
show_always = true;
format = "[$user]($style)";
show_always = true;
};
hostname = {
ssh_only = false;
format = "[@$hostname]($style)";
ssh_only = false;
style = "bold green";
};
directory = { };
character = {
success_symbol = "[->>](bold green)";
error_symbol = "[~~>](bold red)";
vicmd_symbol = "[<<-](bold yellow)";
shlvl = {
format = "[$shlvl]($style)";
style = "bold cyan";
threshold = 2;
repeat = true;
};
aws = {
symbol = " ";
format = "on [$symbol$profile(\\($region\\))]($style) ";
cmd_duration = {
format = "took [$duration]($style)";
};
gcloud = {
symbol = " ";
format = "on [$symbol$active(/$project)(\\($region\\))]($style) ";
directory = {
format = "[$path]($style)( [$read_only]($read_only_style))";
};
nix_shell = {
format = "via [$symbol$state( $name)]($style)";
impure_msg = "";
pure_msg = "λ ";
symbol = "";
format = "via [$symbol$state( $name)]($style) ";
pure_msg = "λ";
};
custom = {
nix_inspect = {
disabled = false;
when = true;
command = "${nix-inspect}/bin/nix-inspect kitty imagemagick ncurses";
format = "[$symbol(\\($output\\))]($style)";
symbol = " ";
style = "bold cyan";
};
};
character = {
error_symbol = "[~~>](bold red)";
success_symbol = "[->>](bold green)";
vicmd_symbol = "[<<-](bold yellow)";
};
# Cloud
gcloud = {
format = "on [$symbol$active(/$project)(\\($region\\))]($style)";
};
aws = {
format = "on [$symbol$profile(\\($region\\))]($style)";
};
# Toggles \/
shlvl.disabled = false;
# Icon changes only \/
aws.symbol = " ";
conda.symbol = " ";
dart.symbol = " ";
directory.read_only = " ";
directory.read_only = " ";
docker_context.symbol = " ";
elixir.symbol = " ";
elm.symbol = " ";
gcloud.symbol = " ";
git_branch.symbol = " ";
golang.symbol = " ";
hg_branch.symbol = " ";
@@ -49,6 +106,7 @@
julia.symbol = " ";
memory_usage.symbol = " ";
nim.symbol = " ";
nix_shell.symbol = "";
nodejs.symbol = " ";
package.symbol = " ";
perl.symbol = " ";
@@ -57,7 +115,7 @@
ruby.symbol = " ";
rust.symbol = " ";
scala.symbol = " ";
shlvl.symbol = " ";
shlvl.symbol = "";
swift.symbol = "ﯣ ";
terraform.symbol = "行";
};
+8 -1
View File
@@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, pkgs, ... }:
let
homeDir = config.home.homeDirectory;
@@ -18,6 +18,13 @@ in
mount_template = "${sshfs} %r:${homeDir} %m";
unmount_template = "${fusermount} -u -z %m";
populate_root_command = listTailscaleDevices;
timeout = 300;
auto_unmount = true;
allow_root = true;
auto_cache = true;
remember = 10;
intr = true;
};
};
}
+6 -2
View File
@@ -16,7 +16,7 @@ let
toArgument = n: v: with builtins;
if null == v then ""
else if false == v then ""
else if true == v then "-o ${v}"
else if true == v then "-o ${n}"
else if isAttrs v then concatStringsSep " " (mapAttrsToList toArgument v)
else "-o ${n}=\"${toValue v}\"";
@@ -109,8 +109,12 @@ in
systemd.user.services.afuse = {
Unit.Description = "afuse automatic FUSE mounter";
Install.WantedBy = [ "default.target" ];
Service.ExecStart = replaceStrings ["%"] ["%%"] # Extra percent to escape afuses'
Service = {
# Make sure mountpoint exists
ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p ${cfg.mountpoint}";
ExecStart = replaceStrings ["%"] ["%%"] # Extra percent for escaping
"${cfg.package}/bin/afuse ${optionalString cfg.debug "-d"} ${cfg.mountpoint} ${afuseArguments.generate null cfg.settings} -f";
};
};
};
}