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

53 lines
2 KiB
Nix

{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.eboskma.programs.nushell;
nushell_plugin_formats = pkgs.callPackage ./plugin-formats.nix {
inherit (pkgs) stdenv lib rustPlatform;
inherit (pkgs.darwin.apple_sdk_11_0.frameworks) IOKit CoreFoundation;
nushell = config.programs.nushell.package;
};
in
{
options.eboskma.programs.nushell = { enable = mkEnableOption "nu shell"; };
config = mkIf cfg.enable {
programs.nushell = {
enable = true;
package = pkgs.nushell.override { additionalFeatures = p: p ++ [ "dataframe" ]; };
configFile.source = ./config.nu;
envFile.source = ./env.nu;
extraEnv = ''
let-env command_not_found_db = ${config.programs.command-not-found.dbPath}
let-env NIX_SYSTEM = "${pkgs.system}"
'';
# extraConfig = ''
# let-env config = ($env.config | update hooks ($env.config.hooks | default [] command_not_found))
# let-env config = ($env.config | update hooks.command_not_found ($env.config.hooks.command_not_found | append { |cmdname| (
# let candidates = (open ${config.programs.command-not-found.dbPath} | query db $"select package from Programs where system = '${pkgs.system}' and name = '($cmdname)'")
# if ($candidates | is-empty) {
# return null
# }
# let packages = ($candidates | each {|pkg| $"\tnix-shell -p ($pkg.package)" } | str join "\n")
# let multiple = if ($candidates | length) > 1 { " one of the following" } else { "" }
# (
# $"The program (ansi $env.config.color_config.shape_external)($cmdname)(ansi reset) " +
# $"is not in your PATH. You can make it available in an ephemeral shell by typing($multiple):\n" +
# $"($packages)"
# )
# )
# }
# )
# )
# '';
};
home.packages = with pkgs; [
carapace
nushellPlugins.query
nushell_plugin_formats
];
};
}