106 lines
3.5 KiB
Nix
106 lines
3.5 KiB
Nix
{ config, pkgs, ... }:
|
|
{
|
|
# enable bash completions
|
|
# even though we don't use bash as our shell, xonsh uses bash completion scripts
|
|
programs.bash.completion.enable = true;
|
|
|
|
programs.command-not-found.enable = false;
|
|
|
|
users.defaultUserShell = pkgs.xonsh;
|
|
programs.xonsh =
|
|
let
|
|
bashcfg = config.programs.bash;
|
|
#xontrib-cd = pkgs.callPackage ../packages/xontribs/xontrib-cd.nix { inherit pkgs; };
|
|
xontrib-clp = pkgs.callPackage ../packages/xontribs/xontrib-clp.nix { inherit pkgs; };
|
|
xontrib-direnv = pkgs.callPackage ../packages/xontribs/xontrib-direnv.nix { inherit pkgs; };
|
|
xontrib-sh = pkgs.callPackage ../packages/xontribs/xontrib-sh.nix { inherit pkgs; };
|
|
in
|
|
{
|
|
enable = true;
|
|
config = ''
|
|
$BASH_COMPLETIONS = ('${bashcfg.completion.package}/etc/profile.d/bash_completion.sh')
|
|
$UPDATE_OS_ENVIRON = True
|
|
$XONTRIB_CLP_ALIAS = 'shutil'
|
|
#xontrib load cd
|
|
xontrib load clp
|
|
xontrib load direnv
|
|
xontrib load sh
|
|
source-bash ${pkgs.nix-index}/etc/profile.d/command-not-found.sh
|
|
tmpfile = $(mktemp)
|
|
gh copilot alias -- bash > @(tmpfile)
|
|
source-bash @(tmpfile)
|
|
ulimit -n 4096 # This is so that Gauntlet is able to be built
|
|
'';
|
|
package = pkgs.xonsh.override {
|
|
extraPackages = ps: [
|
|
pkgs.python311Packages.rich
|
|
xontrib-clp
|
|
xontrib-direnv
|
|
xontrib-sh
|
|
];
|
|
};
|
|
};
|
|
|
|
#TODO: Submit a PR to nixpkgs to add xonsh support to the Starship module
|
|
# After that, we can remove this import and the disabledModules line
|
|
disabledModules = [ "programs/starship.nix" ];
|
|
imports = [ /bulk/home/cswimr/Projects/nixpkgs/nixos/modules/programs/starship.nix ];
|
|
|
|
# starship - a customizable prompt for any shell
|
|
programs.starship = {
|
|
enable = true;
|
|
# custom settings
|
|
settings = {
|
|
format = "[](bg:#1e1e2e fg:#a6e3a1)$username$hostname[](fg:#a6e3a1 bg:#89b4fa)$directory[](fg:#89b4fa bg:#cba6f7)$direnv[](fg:#cba6f7 bg:#f9e2af)$git_branch$git_status[](fg:#f9e2af bg:#1e1e2e)$character";
|
|
username = {
|
|
show_always = true;
|
|
format = "[ $user@]($style)";
|
|
style_user = "fg:#313244 bg:#a6e3a1";
|
|
style_root = "fg:#313244 bg:#a6e3a1";
|
|
};
|
|
hostname = {
|
|
ssh_only = false;
|
|
format = "[$hostname $ssh_symbol]($style)";
|
|
style = "fg:#313244 bg:#a6e3a1";
|
|
};
|
|
directory = {
|
|
format = "[ $path ]($style)";
|
|
style = "fg:#313244 bg:#89b4fa";
|
|
};
|
|
git_branch = {
|
|
format = "[ $symbol$branch(:$remote_branch) ]($style)";
|
|
symbol = " ";
|
|
style = "fg:#313244 bg:#f9e2af";
|
|
};
|
|
direnv = {
|
|
symbol = " ";
|
|
format = "[ $symbol$loaded/$allowed ]($style)";
|
|
disabled = false;
|
|
style = "fg:#313244 bg:#cba6f7";
|
|
};
|
|
git_status = {
|
|
format = "[$all_status]($style)";
|
|
style = "fg:#313244 bg:#f9e2af";
|
|
};
|
|
git_metrics = {
|
|
format = "([+$added]($added_style))[]($added_style)";
|
|
added_style = "fg:#313244 bg:#f9e2af";
|
|
deleted_style = "fg:bright-red bg:235";
|
|
disabled = false;
|
|
};
|
|
hg_branch = {
|
|
format = "[ $symbol$branch ]($style)";
|
|
symbol = " ";
|
|
};
|
|
cmd_duration = {
|
|
format = "[ $duration ]($style)";
|
|
style = "fg:bright-white bg:18";
|
|
};
|
|
character = {
|
|
success_symbol = "[ ](#a6e3a1) ";
|
|
error_symbol = "[ ✗](#f38ba8) ";
|
|
};
|
|
add_newline = false;
|
|
};
|
|
};
|
|
}
|