summaryrefslogtreecommitdiff
path: root/users/seth/module/shell/nu.nix
diff options
context:
space:
mode:
authorseth <[email protected]>2024-02-03 19:27:26 -0500
committerseth <[email protected]>2024-02-03 20:47:55 -0500
commitfcc60b84e5e3cc44986d40af63f5de488caae909 (patch)
tree45f4455c7dcbc63e59e62a9af79783e2e5509a2e /users/seth/module/shell/nu.nix
parentde003fa28e56b81a33e831099987cd94d2f53b39 (diff)
make everything a module
Diffstat (limited to 'users/seth/module/shell/nu.nix')
-rw-r--r--users/seth/module/shell/nu.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/users/seth/module/shell/nu.nix b/users/seth/module/shell/nu.nix
new file mode 100644
index 0000000..b5b1529
--- /dev/null
+++ b/users/seth/module/shell/nu.nix
@@ -0,0 +1,43 @@
+{
+ config,
+ lib,
+ inputs,
+ ...
+}: let
+ cfg = config.seth.shell.nushell;
+ theme = "catppuccin-${config.catppuccin.flavour}";
+in {
+ options.seth.shell.nushell = {
+ enable = lib.mkEnableOption "Nushell configuration";
+ };
+
+ config = lib.mkIf cfg.enable {
+ programs = {
+ nushell = {
+ enable = true;
+
+ configFile.text = ''
+ def "nixgc" [] {
+ sudo nix-collect-garbage -d; nix-collect-garbage -d
+ }
+ '';
+
+ envFile.text = ''
+ use ${inputs.nu-scripts}/themes/nu-themes/${theme}.nu
+ $env.config.color_config = (${theme})
+ '';
+
+ inherit (config.home) shellAliases;
+ };
+
+ bash.initExtra = lib.mkAfter ''
+ if [[ $(ps --no-header --pid=$PPID --format=comm) != "nu" && -z ''${BASH_EXECUTION_STRING} ]]; then
+ exec ${lib.getExe config.programs.nushell.package}
+ fi
+ '';
+
+ # builtin `ls` is good here!
+ eza.enable = lib.mkForce false;
+ };
+ };
+}