nixos-config/home-manager/modules/nushell/default.nix

63 lines
1.9 KiB
Nix
Raw Normal View History

{ 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;
2023-10-19 08:35:56 +02:00
package = pkgs.nushellFull;
configFile.source = ./config.nu;
envFile.source = ./env.nu;
2023-04-19 10:58:03 +02:00
extraEnv = ''
2023-08-19 19:38:39 +02:00
$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
2023-04-19 10:58:03 +02:00
'';
2023-04-24 08:26:09 +02:00
extraConfig = ''
alias vim = nvim
alias tree = ${pkgs.eza}/bin/eza -Fb --git --tree --icons
2023-04-25 09:48:32 +02:00
2023-08-19 19:38:39 +02:00
$env.LS_COLORS = (${pkgs.vivid}/bin/vivid generate gruvbox-dark | str trim)
2023-05-23 10:28:13 +02:00
2023-05-23 11:08:42 +02:00
register ${pkgs.nushellPlugins.query}/bin/nu_plugin_query
register ${pkgs.nushellPlugins.formats}/bin/nu_plugin_formats
register ${pkgs.nushellPlugins.net}/bin/nu_plugin_net
2023-05-30 15:35:45 +02:00
use kink.nu
use ${pkgs.nu_scripts}/share/nu_scripts/themes/nu-themes/dracula.nu
$env.config = ($env.config | merge { color_config: (dracula)})
source ${config.xdg.cacheHome}/zoxide/init.nu
2023-04-24 08:26:09 +02:00
'';
};
2023-04-03 14:34:21 +02:00
# Temporary until zoxide releases new version
programs.zoxide.enableNushellIntegration = false;
xdg.configFile."nushell/scripts" = {
source = ./scripts;
2023-05-30 15:35:45 +02:00
};
home.packages = with pkgs; [
carapace
nu_scripts
];
};
}