From 9d54466669c7716fab322468a285408f14606893 Mon Sep 17 00:00:00 2001 From: oddlama Date: Wed, 15 Feb 2023 02:58:32 +0100 Subject: [PATCH] feat: begin zsh again --- flake.lock | 30 +++++++-------- users/common/default.nix | 1 + users/common/fish.nix | 2 - users/common/zsh.nix | 82 ++++++++++++++++++++++++++++++++++++++++ users/myuser/default.nix | 2 +- users/root/default.nix | 2 +- 6 files changed, 100 insertions(+), 19 deletions(-) create mode 100644 users/common/zsh.nix diff --git a/flake.lock b/flake.lock index 0605b02..4781c90 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ ] }, "locked": { - "lastModified": 1676134447, - "narHash": "sha256-PU+6hKp7wbxCCRF5RO5g//Q0G+Rhbj92VrprvXtTOlc=", + "lastModified": 1676153903, + "narHash": "sha256-uetRyjgMiZCs6srmZ10M764Vn7F53M9mVuqnzHmyBqU=", "owner": "ryantm", "repo": "agenix", - "rev": "6053c559c59ca0ebd57330cd356964f85befaff8", + "rev": "ea17cc71b4e1bc5b2601f210a1c85db9453ad723", "type": "github" }, "original": { @@ -120,11 +120,11 @@ }, "flake-utils": { "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", "type": "github" }, "original": { @@ -134,11 +134,11 @@ }, "flake-utils_2": { "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", "type": "github" }, "original": { @@ -223,11 +223,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1675942811, - "narHash": "sha256-/v4Z9mJmADTpXrdIlAjFa1e+gkpIIROR670UVDQFwIw=", + "lastModified": 1676300157, + "narHash": "sha256-1HjRzfp6LOLfcj/HJHdVKWAkX9QRAouoh6AjzJiIerU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "724bfc0892363087709bd3a5a1666296759154b1", + "rev": "545c7a31e5dedea4a6d372712a18e00ce097d462", "type": "github" }, "original": { @@ -266,11 +266,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1675688762, - "narHash": "sha256-oit/SxMk0B380ASuztBGQLe8TttO1GJiXF8aZY9AYEc=", + "lastModified": 1676279938, + "narHash": "sha256-RDyvVdituVQQZtGA7DNaJruJLDz/pfkREpUcI4ZQvsk=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "ab608394886fb04b8a5df3cb0bab2598400e3634", + "rev": "1583077009b6ef4236d1899c0f43cf1ce1db8085", "type": "github" }, "original": { diff --git a/users/common/default.nix b/users/common/default.nix index c8d28fa..9820a44 100644 --- a/users/common/default.nix +++ b/users/common/default.nix @@ -13,6 +13,7 @@ ./starship.nix #./tmux.nix #./xdg.nix + ./zsh.nix ]; home = { diff --git a/users/common/fish.nix b/users/common/fish.nix index 1ad4f10..1bfa5c0 100644 --- a/users/common/fish.nix +++ b/users/common/fish.nix @@ -7,8 +7,6 @@ with lib; { # FIXME: ctrl-del not working # FIXME: DEL also deletes to the left :( # FIXME: ignore certain history entries (" .*", ...) - # FIXME: after tab give space - # FIXME: fzf tab let multi programs.fish = { enable = true; interactiveShellInit = mkMerge [ diff --git a/users/common/zsh.nix b/users/common/zsh.nix new file mode 100644 index 0000000..2dc4c2e --- /dev/null +++ b/users/common/zsh.nix @@ -0,0 +1,82 @@ +{ + lib, + pkgs, + ... +}: +with lib; { + programs.zsh = { + enable = true; + envExtra = '' + umask 077 + ''; + dotDir = ".config/zsh"; + history = { + path = "/dev/null"; + save = 0; + size = 0; + }; + initExtra = mkMerge [ + (mkBefore '' + unset HISTFILE + + # Reset all keybinds and use emacs keybinds + bindkey -d + bindkey -e + + typeset -A key + key=( + Home "''${terminfo[khome]}" + End "''${terminfo[kend]}" + Insert "''${terminfo[kich1]}" + Delete "''${terminfo[kdch1]}" + Up "''${terminfo[kcuu1]}" + Down "''${terminfo[kcud1]}" + Left "''${terminfo[kcub1]}" + Right "''${terminfo[kcuf1]}" + PageUp "''${terminfo[kpp]}" + PageDown "''${terminfo[knp]}" + BackTab "''${terminfo[kcbt]}" + ) + + bindkey "''${key[Delete]}" delete-char + bindkey "''${key[Home]}" beginning-of-line + bindkey "''${key[End]}" end-of-line + bindkey "''${key[Up]}" history-beginning-search-backward-end + bindkey "''${key[Down]}" history-beginning-search-forward-end + bindkey "''${key[PageUp]}" history-beginning-search-backward-end + bindkey "''${key[PageDown]}" history-beginning-search-forward-end + '') + (mkAfter '' + '') + ]; + plugins = [ + { + name = "fzf-tab"; + src = pkgs.fetchFromGitHub { + owner = "Aloxaf"; + repo = "fzf-tab"; + rev = "69024c27738138d6767ea7246841fdfc6ce0d0eb"; + sha256 = "07wwcplyb2mw10ia9y510iwfhaijnsdcb8yv2y3ladhnxjd6mpf8"; + }; + } + { + name = "fast-syntax-highlighting"; + src = pkgs.fetchFromGitHub { + owner = "zdharma-continuum"; + repo = "fast-syntax-highlighting"; + rev = "7c390ee3bfa8069b8519582399e0a67444e6ea61"; + sha256 = "0gh4is2yzwiky79bs8b5zhjq9khksrmwlaf13hk3mhvpgs8n1fn0"; + }; + } + { + name = "zsh-autosuggestions"; + src = pkgs.fetchFromGitHub { + owner = "zsh-users"; + repo = "zsh-autosuggestions"; + rev = "a411ef3e0992d4839f0732ebeb9823024afaaaa8"; + sha256 = "1g3pij5qn2j7v7jjac2a63lxd97mcsgw6xq6k5p7835q9fjiid98"; + }; + } + ]; + }; +} diff --git a/users/myuser/default.nix b/users/myuser/default.nix index 1b69b59..033713d 100644 --- a/users/myuser/default.nix +++ b/users/myuser/default.nix @@ -15,7 +15,7 @@ with lib; { ["wheel" "input" "video"] ++ optionals config.sound.enable ["audio"]; isNormalUser = true; - shell = pkgs.fish; + shell = pkgs.zsh; }; home-manager.users.myuser = { diff --git a/users/root/default.nix b/users/root/default.nix index 056ea13..aa48dc7 100644 --- a/users/root/default.nix +++ b/users/root/default.nix @@ -8,7 +8,7 @@ with lib; { users.users.root = { hashedPassword = "$6$EBo/CaxB.dQoq2W8$lo2b5vKgJlLPdGGhEqa08q3Irf1Zd1PcFBCwJOrG8lqjwbABkn1DEhrMh1P3ezwnww2HusUBuZGDSMa4nvSQg1"; openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA5Uq+CDy5Pmt3If5M6d8K/Q7HArU6sZ7sgoj3T521Wm"]; - shell = pkgs.fish; + shell = pkgs.zsh; }; home-manager.users.root = {