Commit 1220e38

HPCesia <me@hpcesia.com>
2026-08-01 14:34:42
Add flyline
1 parent 7303f7c
Changed files (10)
modules/core/shell/atuin.nix
@@ -1,50 +0,0 @@
-{lib, ...}: {
-  den.aspects.core.shell.atuin = {
-    includes = [
-      ({user, ...}: {
-        persistUser = {
-          directories = lib.optional (!(lib.elem "homeManager" user.classes)) ".local/share/atuin";
-        };
-        persistHome = {config, ...}: {
-          directories = ["${config.xdg.dataHome}/atuin"];
-        };
-      })
-    ];
-
-    nixos = {
-      programs.atuin = {
-        enable = true;
-        settings = {
-          style = "full";
-          inline_height = 32;
-          keymap_mode = "vim-normal";
-        };
-      };
-    };
-
-    homeManager = {
-      programs.atuin = {
-        enable = true;
-        enableBashIntegration = true;
-        enableFishIntegration = true;
-      };
-    };
-  };
-
-  den.aspects.core.shell.atuin.themes = {
-    catppuccin = {
-      homeManager = {pkgs, ...}: {
-        programs.atuin = {
-          settings.theme.name = "catppuccin-mocha-mauve";
-        };
-
-        xdg.configFile = {
-          "atuin/themes/catppuccin-mocha-mauve.toml".source = pkgs.fetchurl {
-            url = "https://github.com/catppuccin/atuin/raw/68aa64b77573c235044b614e752a781701af4eec/themes/mocha/catppuccin-mocha-mauve.toml";
-            hash = "sha256-X66L7YmWQ4ClPeQoFhXkkWXPrmpLwWfHcDNbvnc+K3g=";
-          };
-        };
-      };
-    };
-  };
-}
modules/core/shell/bash.nix
@@ -1,17 +0,0 @@
-{
-  den.aspects.core.shell.bash = {
-    nixos = {
-      programs.bash = {
-        enable = true;
-        completion.enable = true;
-      };
-    };
-
-    homeManager = {
-      programs.bash = {
-        enable = true;
-        enableCompletion = true;
-      };
-    };
-  };
-}
modules/core/shell/fish.nix
@@ -1,77 +0,0 @@
-{lib, ...}: {
-  den.aspects.core.shell.fish = {
-    includes = [
-      ({user, ...}: {
-        persistUser = {
-          files = lib.optional (!(lib.elem "homeManager" user.classes)) ".local/share/fish/fish_history";
-        };
-        persistHome = {config, ...}: {
-          files = ["${config.xdg.dataHome}/fish/fish_history"];
-        };
-      })
-    ];
-
-    nixos = {
-      programs.fish = {
-        enable = true;
-        useBabelfish = true;
-
-        shellInit = ''
-          set -U fish_greeting
-        '';
-      };
-    };
-
-    homeManager = {pkgs, ...}: {
-      programs.fish = {
-        enable = true;
-        generateCompletions = true;
-        plugins = with pkgs.fishPlugins; [
-          {
-            inherit (puffer) src;
-            name = "puffer";
-          }
-          {
-            inherit (autopair) src;
-            name = "autopair";
-          }
-        ];
-
-        shellInit = ''
-          set -U fish_greeting
-        '';
-      };
-    };
-  };
-
-  den.aspects.core.shell.fish.themes = {
-    catppuccin = {
-      homeManager = {pkgs, ...}: {
-        programs.fish = {
-          shellInit = ''
-            fish_config theme choose catppuccin-mocha
-          '';
-        };
-        xdg.configFile."fish/themes/catppuccin-mocha.theme".source = pkgs.fetchurl {
-          pname = "fish-theme-catppuccin-mocha.theme";
-          url = "https://github.com/catppuccin/fish/raw/5fc5ae9c2ec22eb376cb03ce76f0d262a38960f3/themes/static/catppuccin-mocha.theme";
-          hash = "sha256-sAn4eJy6tmloWbN0p+mBdku3CK5TUeKVtVsaH/CBnGk=";
-        };
-      };
-    };
-  };
-
-  den.aspects.core.shell.fish.bashOverlay = {
-    nixos = {config, ...}: {
-      programs.bash = {
-        interactiveShellInit = ''
-          # "check if parent process is not fish" && "make nested shells work properly"
-          if grep -qv fish /proc/$PPID/comm && [[ $SHLVL == [12] ]]; then
-              # set $SHELL for better integration with programs like nix shell, tmux, etc.
-              SHELL=${config.programs.fish.package}/bin/fish exec fish
-          fi
-        '';
-      };
-    };
-  };
-}
modules/core/shell/starship.nix
@@ -1,11 +0,0 @@
-{
-  den.aspects.core.shell.starship = {
-    nixos = {
-      programs.starship = {
-        enable = true;
-        interactiveOnly = true;
-        presets = ["pure-preset"];
-      };
-    };
-  };
-}
modules/core/shell.nix
@@ -0,0 +1,64 @@
+{
+  den.aspects.core.shell = {
+    nixos = {pkgs, ...}: let
+      flyline-src = pkgs.fetchFromGitHub {
+        owner = "HalFrgrd";
+        repo = "flyline";
+        rev = "c9e54bfeea1123dc3f8f76423af47a3e0f2317dd";
+        hash = "sha256-K9qAkCXXpJ5/W/NZRSEcyj4bBFH8fenJXJzw2JEdI8k=";
+      };
+      flyline = (pkgs.callPackage "${flyline-src}/nix/package.nix" {}).overrideAttrs {
+        cargoDeps = pkgs.rustPlatform.importCargoLock {
+          lockFile = "${flyline-src}/Cargo.lock";
+          outputHashes = {
+            "ansi-to-tui-8.0.1" = "sha256-/aVhjfUtm/HPrSkL6cyTgyHsaFx2uJx09IdL1QgQOhY=";
+            "flash-0.0.6" = "sha256-GG5Boro95idL2HRhcFF7TXG8zzDj7yJI61LveE4q1Kw=";
+            "flycomp-1.1.2" = "sha256-ipOFG1ZSro5OyWzCu28AYd2+eAuSW7vRDHOT5PuxDPA=";
+            "ratatui-0.30.2" = "sha256-vdgspdMepBIE/7hieg22THDbmYl3xz3Sd/0q9ZQ+D1c=";
+            "skim-4.6.0" = "sha256-cUSiXwEWUDZccbl3sts2DG4ZNzYExD9ra/VESv2u+Zs=";
+            "termina-0.3.3" = "sha256-N+sN7ARyJXbKQ6DXPFMVxMWQPW2n1ISsjuXoIj4V20I=";
+          };
+        };
+      };
+    in {
+      environment.systemPackages = [flyline];
+
+      programs.bash = {
+        enable = true;
+        completion.enable = true;
+        interactiveShellInit = ''
+          enable -f ${flyline}/lib/libflyline.so flyline
+        '';
+        promptInit = ''
+          # Provide a nice prompt if the terminal supports it.
+          if [ "$TERM" != "dumb" ] || [ -n "$INSIDE_EMACS" ]; then
+            PROMPT_COLOR="1;31m"
+            ((UID)) && PROMPT_COLOR="1;32m"
+            # Show the hostname only when connected via SSH.
+            SSH_HOST=""
+            [ -n "$SSH_CONNECTION" ] && SSH_HOST="@$HOSTNAME"
+            if [ -n "$INSIDE_EMACS" ]; then
+              # Emacs term mode doesn't support xterm title escape sequence (\e]0;)
+              PS1="\[\033[$PROMPT_COLOR\]\u$SSH_HOST\[\033[0m\]: \[\033[1;34m\]\w\[\033[0m\]\n\[\033[$PROMPT_COLOR\]\\$\[\033[0m\] "
+            else
+              PS1="\[\033[$PROMPT_COLOR\]\u$SSH_HOST\[\033[0m\]: \[\033[1;34m\]\w\[\033[0m\]\n\[\033[$PROMPT_COLOR\]\\$\[\033[0m\] "
+              PS1="\[\e]0;\u@\h: \w\a\]$PS1"
+            fi
+            if test "$TERM" = "xterm"; then
+              PS1="\[\033]2;\h:\u:\w\007\]$PS1"
+            fi
+            # Final (transient) prompt: replace the two-line prompt in scrollback.
+            PS1_FINAL="\[\033[$PROMPT_COLOR\]\u@\h\\$\[\033[0m\] "
+          fi
+        '';
+      };
+    };
+
+    homeManager = {
+      programs.bash = {
+        enable = true;
+        enableCompletion = true;
+      };
+    };
+  };
+}
modules/desktop/terminal/ghostty.nix
@@ -21,7 +21,6 @@
       programs.ghostty = {
         enable = true;
         enableBashIntegration = true;
-        enableFishIntegration = true;
 
         settings = {
           font-family = lib.concatMap (f: f.name) (fontsCfg.monospace.name ++ fontsCfg.emoji.name);
modules/develop/yazi.nix
@@ -20,7 +20,6 @@
       programs.yazi = {
         enable = true;
         enableBashIntegration = true;
-        enableFishIntegration = true;
         shellWrapperName = "yy";
         plugins = {
           git = pkgs.yaziPlugins.git;
modules/develop/zoxide.nix
@@ -10,7 +10,6 @@
       programs.zoxide = {
         enable = true;
         enableBashIntegration = true;
-        enableFishIntegration = true;
       };
     };
   };
modules/roles/default.nix
@@ -17,11 +17,6 @@
       core.hardware.graphic.nvidia
       core.hardware.thunderbolt
 
-      core.shell.bash
-      core.shell.fish
-      core.shell.atuin
-      core.shell.starship
-
       core.boot
       core.editor
       core.impermanence
@@ -29,6 +24,7 @@
       core.nameservers
       core.nftables
       core.openssh
+      core.shell
       core.systemd
       core.tailscale
       core.time-sync
modules/users/hpcesia/default.nix
@@ -4,8 +4,6 @@
       [
         den.batteries.host-aspects
         den.batteries.primary-user
-
-        den.aspects.core.shell.fish.bashOverlay
       ]
       ++ (den.lib.policy.when
         ({host, ...}: host.hasAspect den.aspects.roles.develop)