From 08c23eb1d242c3ad9a2be6a69b51a217ffaf5ffc Mon Sep 17 00:00:00 2001 From: Joonas Rautiola Date: Sat, 26 Oct 2024 15:46:15 +0300 Subject: [PATCH] Use fish shell --- modules/common.nix | 5 +---- modules/home/common.nix | 15 ++++++++++++++- modules/home/default.nix | 15 ++++++++++++++- modules/home/fish.nix | 33 +++++++++++++++++++++++++++++++++ modules/home/starship.nix | 3 +++ modules/home/zsh.nix | 11 ----------- modules/x11.nix | 3 --- 7 files changed, 65 insertions(+), 20 deletions(-) diff --git a/modules/common.nix b/modules/common.nix index f4baa95..e920767 100644 --- a/modules/common.nix +++ b/modules/common.nix @@ -74,12 +74,9 @@ }; environment = { - # fix completion for zsh - pathsToLink = [ "/share/zsh" ]; - # allow both zsh and bash shells = [ pkgs.bashInteractive - pkgs.zsh + pkgs.fish ]; # uninstall all default packages that I don't need diff --git a/modules/home/common.nix b/modules/home/common.nix index 23ca673..418cb32 100644 --- a/modules/home/common.nix +++ b/modules/home/common.nix @@ -1,10 +1,12 @@ -{ pkgs, ... }: +{ pkgs, inputs, ... }: { home.stateVersion = "23.11"; programs.home-manager.enable = true; nixpkgs.config.allowUnfree = true; systemd.user.startServices = "sd-switch"; + imports = [ inputs.nix-index-database.hmModules.nix-index ]; + dconf = { enable = true; settings = { @@ -12,6 +14,17 @@ }; }; + home.sessionVariables = { + TERMINAL = "wezterm"; + EDITOR = "nvim"; + }; + + programs = { + # run commands without installing them with `, ` + nix-index-database.comma.enable = true; + fzf.enable = true; + }; + home.packages = with pkgs; [ # development python3 diff --git a/modules/home/default.nix b/modules/home/default.nix index e7c079e..6fbca5b 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -2,6 +2,7 @@ inputs, user, lib, + pkgs, ... }: let @@ -41,7 +42,6 @@ let ./yazi.nix ./zathura.nix ./zen.nix - ./zsh.nix ./fish.nix ] ); @@ -65,4 +65,17 @@ in ]; }; }; + + networking.firewall = rec { + allowedTCPPortRanges = [ + { + from = 1714; + to = 1764; + } + ]; + allowedUDPPortRanges = allowedTCPPortRanges; + }; + + users.users."${user.name}".shell = pkgs.fish; + programs.fish.enable = true; } diff --git a/modules/home/fish.nix b/modules/home/fish.nix index 17ef2bf..b00b869 100644 --- a/modules/home/fish.nix +++ b/modules/home/fish.nix @@ -1,5 +1,38 @@ { programs.fish = { enable = true; + + shellAbbrs = { + gs = "git status"; + gd = "git diff"; + ga = "git add"; + }; + + shellAliases = { + ls = "ls --color=auto --hyperlink"; + mv = "mv -iv"; + rm = "rm -I"; + cp = "cp -iv"; + ln = "ln -iv"; + + ".." = "cd .."; + "..." = "cd ../.."; + "...." = "cd ../../.."; + + please = "sudo $history[1]"; + copy = "xclip -selection clipboard"; + dev = "nix develop --impure -c $SHELL"; + git-branch-cleanup = "git branch -vv | grep gone | awk '{print $1}' | xargs git branch -D"; + }; + + shellInit = # fish + '' + # Start X at login + if status is-login + if test -z "$DISPLAY" -a "$XDG_VTNR" = 1 + exec startx -- -keeptty + end + end + ''; }; } diff --git a/modules/home/starship.nix b/modules/home/starship.nix index f32acc3..7e20411 100644 --- a/modules/home/starship.nix +++ b/modules/home/starship.nix @@ -1,12 +1,15 @@ { programs.starship = { enable = true; + enableTransience = true; settings = { add_newline = true; + right_format = "$time"; continuation_prompt = "▶▶ "; battery.disabled = true; git_metrics.disabled = false; + time.disabled = false; nix_shell = { format = "[󱄅 $name](#74b2ff) "; diff --git a/modules/home/zsh.nix b/modules/home/zsh.nix index 8d4aa2c..8d32abb 100644 --- a/modules/home/zsh.nix +++ b/modules/home/zsh.nix @@ -1,13 +1,5 @@ { pkgs, inputs, ... }: { - imports = [ inputs.nix-index-database.hmModules.nix-index ]; - - programs = { - # run commands without installing them with `, ` - nix-index-database.comma.enable = true; - fzf.enable = true; - }; - programs.zsh = { enable = true; @@ -24,9 +16,6 @@ ln = "ln -iv"; please = "sudo $(fc -ln -1)"; lf = "lfub"; - gs = "git status"; - gd = "git diff"; - ga = "git add"; ssh = "TERM=xterm-256color ssh"; "cd ..." = "cd ../.."; "cd ...." = "cd ../../.."; diff --git a/modules/x11.nix b/modules/x11.nix index 36f1a15..7c57bf5 100644 --- a/modules/x11.nix +++ b/modules/x11.nix @@ -40,7 +40,4 @@ services.gnome.gnome-keyring.enable = true; programs.dconf.enable = true; - - programs.zsh.enable = true; - users.users."${user.name}".shell = pkgs.zsh; }