Selaa lähdekoodia

Use fish shell

Johan Rong 1 kuukausi sitten
vanhempi
sitoutus
7aa7ef4d03

+ 3 - 0
home/features/application/alacritty.nix

@@ -3,6 +3,9 @@
   programs.alacritty = {
     enable = true;
     settings = {
+      terminal.shell = {
+        program = "${pkgs.fish}/bin/fish";
+      };
       cursor = {
         style = {
           shape = "Beam";

+ 72 - 0
home/features/application/fish/config.fish

@@ -0,0 +1,72 @@
+set -U fish_greeting ""
+direnv hook fish | source
+
+function current_git_branch
+    git symbolic-ref --quiet --short HEAD 2>/dev/null | read -l branch
+    and printf '(%s)' $branch
+end
+
+function shlvl_prompt
+    if test "$SHLVL" -gt 1
+        printf '(%d)' "$SHLVL"
+    end
+end
+
+function fish_prompt
+    set -g fish_prompt_pwd_dir_length 0
+    set_color normal
+    shlvl_prompt
+
+    set_color normal
+    printf "("
+
+    set_color --bold brblue
+    printf "%s" $USER
+
+    set_color normal
+    printf "@"
+
+    set_color --bold brblue
+    printf "%s" (prompt_hostname)
+
+    set_color normal
+    printf ":"
+
+    set_color --bold blue
+    printf "%s" (prompt_pwd)
+
+    set_color normal
+    printf ")"
+
+    set_color --bold brgreen
+    current_git_branch
+
+    set_color normal
+    printf '$ '
+end
+
+function nix-update
+    set -l orig_cwd (pwd)
+
+    cd ~/nix-dots || return
+
+    nix flake update
+    or begin
+        cd $orig_cwd
+        return 1
+    end
+
+    nh os switch
+    or begin
+        cd $orig_cwd
+        return 1
+    end
+
+    flatpak update -y
+
+    cd $orig_cwd
+end
+
+function jclone
+    git clone https://github.com/johron/$argv[1]
+end

+ 9 - 0
home/features/application/fish/default.nix

@@ -0,0 +1,9 @@
+{ pkgs, lib, ... }:
+
+{
+  home = {
+    file = {
+      ".config/fish/config.fish".source = ./config.fish;
+    };
+  };
+}

+ 1 - 0
home/flavors/desktop/hyprland/default.nix

@@ -4,5 +4,6 @@
     ../../../features/desktop/hyprland
     ../../../features/application/bashrc.nix
     ../../../features/application/alacritty.nix
+    ../../../features/application/fish
   ];
 }

+ 2 - 0
nixos/features/system/users.nix

@@ -14,4 +14,6 @@ in
     isNormalUser = true;
     extraGroups = [ "wheel" "video" "audio" "input" "networkmanager" "seat" "libvirtd" "docker" "librepods" ];
   };
+
+  users.defaultUserShell = pkgs.fish;
 }

+ 1 - 0
nixos/flavors/application/development/default.nix

@@ -12,6 +12,7 @@
   programs.direnv = {
     enable = true;
     enableBashIntegration = true; 
+    enableFishIntegration = true;
     nix-direnv.enable = true; 
   };
 }

+ 1 - 0
nixos/flavors/application/workstation/default.nix

@@ -60,6 +60,7 @@
   };
 
   programs.librepods.enable = true;
+  programs.fish.enable = true;
 
   fonts = {
     enableDefaultPackages = true;