summaryrefslogtreecommitdiff
path: root/modules/home
diff options
context:
space:
mode:
Diffstat (limited to 'modules/home')
-rw-r--r--modules/home/default.nix14
-rw-r--r--modules/home/nushell.nix50
2 files changed, 54 insertions, 10 deletions
diff --git a/modules/home/default.nix b/modules/home/default.nix
index bb2c753..743615a 100644
--- a/modules/home/default.nix
+++ b/modules/home/default.nix
@@ -5,6 +5,7 @@ in {
inputs.home-manager.nixosModules.home-manager
./mu.nix
./zen.nix
+ ./nushell.nix
];
config = mkIf cfg.default-user.enable {
home-manager = {
@@ -13,6 +14,7 @@ in {
useUserPackages = true;
users.leonardo = {
home = {
+ shell.enableNushellIntegration = true;
stateVersion = "23.05";
homeDirectory = "/home/leonardo";
packages = lib.optionals cfg.desktop-environment.enable (with pkgs; [
@@ -23,17 +25,9 @@ in {
]);
};
programs = {
- bash = {
+ direnv = {
enable = true;
- enableCompletion = true;
- initExtra = ''
- shopt -s -q autocd
- shopt -s no_empty_cmd_completion
- '';
- };
- fzf = {
- enable = true;
- enableBashIntegration = true;
+ nix-direnv.enable = true;
};
git = {
enable = true;
diff --git a/modules/home/nushell.nix b/modules/home/nushell.nix
new file mode 100644
index 0000000..771ab8e
--- /dev/null
+++ b/modules/home/nushell.nix
@@ -0,0 +1,50 @@
+{ config, lib, pkgs, ...}: with lib; let
+ cfg = config.santi-modules;
+in {
+ options.santi-modules.nushell.enable = mkEnableOption "Enable nushell as the default shell";
+ config = mkIf cfg.nushell.enable {
+ users.users.leonardo.shell = pkgs.nushell;
+ home-manager = {
+ users.leonardo = {
+ programs.direnv.enableNushellIntegration = true;
+ programs.nushell = {
+ enable = true;
+ settings = {
+ show_banner = false;
+ };
+ extraConfig = ''
+ module vprompt {
+ # Complete escape sequence based on environment
+ def complete-escape-by-env [
+ arg: string # argument to send
+ ] {
+ let tmux: string = (if ($env.TMUX? | is-empty) { '''''' } else { $env.TMUX })
+ let term: string = (if ($env.TERM? | is-empty) { '''''' } else { $env.TERM })
+ if $tmux =~ "screen|tmux" {
+ # tell tmux to pass the escape sequences through
+ $"\ePtmux;\e\e]($arg)\a\e\\"
+ } else if $term =~ "screen.*" {
+ # GNU screen (screen, screen-256color, screen-256color-bce)
+ $"\eP\e]($arg)\a\e\\"
+ } else {
+ $"\e]($arg)\e\\"
+ }
+ }
+ def create_left_prompt [] {
+ ${pkgs.starship}/bin/starship prompt --cmd-duration $env.CMD_DURATION_MS $'--status=($env.LAST_EXIT_CODE)'
+ }
+ # Output text prompt that vterm can use to track current directory
+ export def left-prompt-track-cwd [] {
+ $"(create_left_prompt)(complete-escape-by-env $'51;A(whoami)@(hostname):(pwd)')"
+ }
+ }
+ use vprompt
+ $env.PROMPT_COMMAND = {|| vprompt left-prompt-track-cwd }
+ $env.PROMPT_COMMAND_RIGHT = ""
+ $env.PROMPT_INDICATOR = ""
+ '';
+ };
+ };
+ };
+ };
+}