aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhongheng Liu <z.liu@outlook.com.gr>2024-12-07 19:22:53 +0200
committerZhongheng Liu <z.liu@outlook.com.gr>2024-12-07 19:22:53 +0200
commit583cdd7b00543f17c495aa618338365dc65262bd (patch)
tree7e4f3ff386f6c6da334580c3bcaad9cbf5ef07f9
parent03a2702281f06cd191698c75262279c4338f5ff9 (diff)
downloadnixos-configuration-583cdd7b00543f17c495aa618338365dc65262bd.tar.gz
nixos-configuration-583cdd7b00543f17c495aa618338365dc65262bd.tar.bz2
nixos-configuration-583cdd7b00543f17c495aa618338365dc65262bd.zip
feat: add nushell integration config
-rw-r--r--home-manager/stvnliu/shells/default.nix6
-rw-r--r--home-manager/stvnliu/shells/direnv.nix1
-rw-r--r--home-manager/stvnliu/shells/nushell/default.nix26
-rw-r--r--home-manager/stvnliu/shells/nushell/init/config.nu15
4 files changed, 46 insertions, 2 deletions
diff --git a/home-manager/stvnliu/shells/default.nix b/home-manager/stvnliu/shells/default.nix
index db6c054..02db324 100644
--- a/home-manager/stvnliu/shells/default.nix
+++ b/home-manager/stvnliu/shells/default.nix
@@ -10,6 +10,7 @@ in
imports = [
./zsh.nix
./fish
+ ./nushell
./zoxide.nix
./direnv.nix
./starship
@@ -22,8 +23,9 @@ in
config = {
myShells = {
zsh.enable = false;
- fish.enable = true;
- defaultShell = "fish";
+ fish.enable = false;
+ nushell.enable = true;
+ defaultShell = "${config.programs.nushell.package}/bin/nu";
prompts.starship.enable = true;
};
};
diff --git a/home-manager/stvnliu/shells/direnv.nix b/home-manager/stvnliu/shells/direnv.nix
index dd5b52f..6f6ebfb 100644
--- a/home-manager/stvnliu/shells/direnv.nix
+++ b/home-manager/stvnliu/shells/direnv.nix
@@ -2,6 +2,7 @@
programs = {
direnv = {
enable = true;
+ enableNushellIntegration = true;
nix-direnv.enable = true;
};
};
diff --git a/home-manager/stvnliu/shells/nushell/default.nix b/home-manager/stvnliu/shells/nushell/default.nix
new file mode 100644
index 0000000..059c68a
--- /dev/null
+++ b/home-manager/stvnliu/shells/nushell/default.nix
@@ -0,0 +1,26 @@
+{
+ pkgs,
+ config,
+ lib,
+ ...
+}: let
+ cfg = config.myShells.nushell;
+in
+ with lib; {
+ options = {
+ myShells.nushell = {enable = mkEnableOption "Enables nushell config";};
+ };
+ config = mkIf cfg.enable {
+ programs = {
+ nushell = {
+ enable = true;
+ configFile.source = ./init/config.nu;
+ shellAliases = import ../aliases/default.nix {inherit pkgs;};
+ };
+ carapace = {
+ enable = true;
+ enableNushellIntegration = true;
+ };
+ };
+ };
+ }
diff --git a/home-manager/stvnliu/shells/nushell/init/config.nu b/home-manager/stvnliu/shells/nushell/init/config.nu
new file mode 100644
index 0000000..afbcf84
--- /dev/null
+++ b/home-manager/stvnliu/shells/nushell/init/config.nu
@@ -0,0 +1,15 @@
+$env.config = {
+ show_banner: false,
+ hooks: {
+ pre_prompt: [{ ||
+ if (which direnv | is-empty) {
+ return
+ }
+
+ direnv export json | from json | default {} | load-env
+ if 'ENV_CONVERSIONS' in $env and 'PATH' in $env.ENV_CONVERSIONS {
+ $env.PATH = do $env.ENV_CONVERSIONS.PATH.from_string $env.PATH
+ }
+ }]
+ }
+}