nixos-config/home-manager/modules/nushell/default.nix
Erwin Boskma 406244fdcc
Some checks failed
/ check (push) Failing after 3m7s
nushell: Fix tree alias
2024-02-05 21:13:44 +01:00

72 lines
2 KiB
Nix

{
pkgs,
config,
lib,
...
}:
with lib;
let
cfg = config.eboskma.programs.nushell;
zoxideOptions = concatStringsSep " " config.programs.zoxide.options;
in
{
options.eboskma.programs.nushell = {
enable = mkEnableOption "nu shell";
};
config = mkIf cfg.enable {
programs.nushell = {
enable = true;
package = pkgs.nushellFull;
configFile.source = ./config.nu;
envFile.source = ./env.nu;
extraEnv = ''
$env.command_not_found_db = ${config.programs.command-not-found.dbPath}
$env.NIX_SYSTEM = "${pkgs.system}"
let zoxide_cache = "${config.xdg.cacheHome}/zoxide"
if not ($zoxide_cache | path exists) {
mkdir $zoxide_cache
}
${config.programs.zoxide.package}/bin/zoxide init nushell ${zoxideOptions} | save --force ${config.xdg.cacheHome}/zoxide/init.nu
# Temporary fix until zoxide releases new version
sed -i 's/def-env/def --env/g' ${config.xdg.cacheHome}/zoxide/init.nu
$env.NU_LIB_DIRS = ($env.NU_LIB_DIRS | append ${pkgs.nu_scripts}/share/nu_scripts)
'';
extraConfig = ''
alias vim = nvim
alias tree = ${pkgs.eza}/bin/eza -F -b --git --tree --icons
$env.LS_COLORS = (${pkgs.vivid}/bin/vivid generate gruvbox-dark | str trim)
register ${pkgs.nushellPlugins.query}/bin/nu_plugin_query
register ${pkgs.nushellPlugins.formats}/bin/nu_plugin_formats
register ${pkgs.nushellPlugins.net}/bin/nu_plugin_net
use kink.nu
# use ${pkgs.nu_scripts}/share/nu_scripts/themes/nu-themes/dracula.nu
use themes/nu-themes/dracula.nu
$env.config = ($env.config | merge { color_config: (dracula)})
source ${config.xdg.cacheHome}/zoxide/init.nu
'';
};
# Temporary until zoxide releases new version
programs.zoxide.enableNushellIntegration = false;
xdg.configFile."nushell/scripts" = {
source = ./scripts;
};
home.packages = with pkgs; [
carapace
nu_scripts
];
};
}