aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-18 19:43:11 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-18 19:45:26 +0200
commit7b9400b9453a63477d17ad212afba5b5644ae6d3 (patch)
tree51d5db3356942501cafeb6195234908297625c91 /modules
parentrefactor(modules/legacy/conf/zsh): Modernize module (diff)
downloadnixos-config-7b9400b9453a63477d17ad212afba5b5644ae6d3.zip
refactor(modules/legacy/conf/zsh): Parameterize and move to new `by-name`
Diffstat (limited to 'modules')
-rw-r--r--modules/by-name/zs/zsh/config/command_not_found.sh (renamed from modules/home.legacy/conf/zsh/config/command_not_found.sh)0
-rw-r--r--modules/by-name/zs/zsh/config/command_not_found_insult.sh (renamed from modules/home.legacy/conf/zsh/config/command_not_found_insult.sh)0
-rw-r--r--modules/by-name/zs/zsh/config/custom_cursor.zsh (renamed from modules/home.legacy/conf/zsh/config/custom_cursor.zsh)0
-rw-r--r--modules/by-name/zs/zsh/config/zsh-init.zsh (renamed from modules/home.legacy/conf/zsh/config/zsh-init.zsh)0
-rw-r--r--modules/by-name/zs/zsh/module.nix94
-rw-r--r--modules/home.legacy/conf/zsh/default.nix84
6 files changed, 94 insertions, 84 deletions
diff --git a/modules/home.legacy/conf/zsh/config/command_not_found.sh b/modules/by-name/zs/zsh/config/command_not_found.sh
index fb21b676..fb21b676 100644
--- a/modules/home.legacy/conf/zsh/config/command_not_found.sh
+++ b/modules/by-name/zs/zsh/config/command_not_found.sh
diff --git a/modules/home.legacy/conf/zsh/config/command_not_found_insult.sh b/modules/by-name/zs/zsh/config/command_not_found_insult.sh
index 5126845a..5126845a 100644
--- a/modules/home.legacy/conf/zsh/config/command_not_found_insult.sh
+++ b/modules/by-name/zs/zsh/config/command_not_found_insult.sh
diff --git a/modules/home.legacy/conf/zsh/config/custom_cursor.zsh b/modules/by-name/zs/zsh/config/custom_cursor.zsh
index 37390c1c..37390c1c 100644
--- a/modules/home.legacy/conf/zsh/config/custom_cursor.zsh
+++ b/modules/by-name/zs/zsh/config/custom_cursor.zsh
diff --git a/modules/home.legacy/conf/zsh/config/zsh-init.zsh b/modules/by-name/zs/zsh/config/zsh-init.zsh
index cd8d34a9..cd8d34a9 100644
--- a/modules/home.legacy/conf/zsh/config/zsh-init.zsh
+++ b/modules/by-name/zs/zsh/config/zsh-init.zsh
diff --git a/modules/by-name/zs/zsh/module.nix b/modules/by-name/zs/zsh/module.nix
new file mode 100644
index 00000000..98e0d28a
--- /dev/null
+++ b/modules/by-name/zs/zsh/module.nix
@@ -0,0 +1,94 @@
+{
+ config,
+ pkgs,
+ lib,
+ shell_library,
+ system,
+ ...
+}: let
+ cfg = config.soispha.programs.zsh;
+ homeConfig = config.home-manager.users.soispha;
+in {
+ options.soispha.programs.zsh = {
+ enable = lib.mkEnableOption "zsh";
+ };
+
+ config.home-manager.users.soispha = lib.mkIf cfg.enable {
+ home.sessionPath = [];
+
+ programs.zsh = {
+ enable = true;
+ enableCompletion = true;
+ autosuggestion.enable = true;
+ syntaxHighlighting.enable = true;
+
+ autocd = true;
+
+ # Must be relative to the users home directory (for whatever reason)
+ # Thus no `${homeConfig.xdg.configHome}`
+ dotDir = ".config/zsh";
+
+ history = {
+ extended = true;
+ ignoreDups = false;
+ expireDuplicatesFirst = false;
+ ignoreSpace = false;
+
+ path = "${homeConfig.xdg.dataHome}/zsh/history";
+ save = 9000000; # number of lines to save
+ size = 9000000; # number of lines to keep
+ share = false; # share between sessions
+ };
+ historySubstringSearch = {
+ enable = true;
+ searchDownKey = "^[[B"; # DOWN Arrow key
+ searchUpKey = "^[[A"; # UP Arrow key
+ };
+
+ loginExtra =
+ "setopt " # The extra space is important
+ + lib.concatStringsSep "\nsetopt " [
+ "AUTO_CD"
+ "AUTO_PUSHD"
+ "CHASE_DOTS"
+
+ "ALWAYS_TO_END"
+
+ "EXTENDED_HISTORY"
+ "HIST_ALLOW_CLOBBER"
+ "HIST_VERIFY"
+ "HIST_FCNTL_LOCK"
+ "APPEND_HISTORY"
+
+ "DVORAK"
+ "CORRECT"
+
+ "PROMPT_SUBST"
+ "TRANSIENT_RPROMPT" # maybe?
+
+ "COMBINING_CHARS"
+ "VI"
+ ];
+
+ initExtraFirst =
+ builtins.readFile ./config/zsh-init.zsh
+ + ''
+ SHELL_LIBRARY_VERSION="2.1.2" source ${shell_library.rawLib.${system}}
+ # This next line buffers the first line of the following item:
+
+ ''
+ # NOTE: This must be before the insult, as we otherwise override the previous handler <2024-02-28>
+ + builtins.readFile ./config/command_not_found.sh
+ + builtins.readFile ./config/command_not_found_insult.sh
+ + builtins.readFile ./config/custom_cursor.zsh
+ + builtins.readFile "${pkgs.fzf}/share/fzf/key-bindings.zsh";
+
+ shellAliases = {
+ ll = ". ll";
+ lm = ". lm";
+
+ hisea = "history 0 | grep";
+ };
+ };
+ };
+}
diff --git a/modules/home.legacy/conf/zsh/default.nix b/modules/home.legacy/conf/zsh/default.nix
deleted file mode 100644
index 2af7cdbe..00000000
--- a/modules/home.legacy/conf/zsh/default.nix
+++ /dev/null
@@ -1,84 +0,0 @@
-{
- config,
- pkgs,
- lib,
- shell_library,
- system,
- ...
-}: {
- home.sessionPath = [];
- programs.zsh = {
- enable = true;
- autosuggestion.enable = true;
- enableCompletion = true;
- syntaxHighlighting.enable = true;
-
- autocd = true;
-
- # Must be relative to the users home directory (for whatever reason)
- # Thus no `${config.xdg.configHome}`
- dotDir = ".config/zsh";
-
- history = {
- extended = true;
- ignoreDups = false;
- expireDuplicatesFirst = false;
- ignoreSpace = false;
-
- path = "${config.xdg.dataHome}/zsh/history";
- save = 9000000; # number of lines to save
- size = 9000000; # number of lines to keep
- share = false; # share between sessions
- };
- historySubstringSearch = {
- enable = true;
- searchDownKey = "^[[B"; # DOWN Arrow key
- searchUpKey = "^[[A"; # UP Arrow key
- };
-
- loginExtra =
- "setopt " # The extra space is important
- + lib.concatStringsSep "\nsetopt " [
- "AUTO_CD"
- "AUTO_PUSHD"
- "CHASE_DOTS"
-
- "ALWAYS_TO_END"
-
- "EXTENDED_HISTORY"
- "HIST_ALLOW_CLOBBER"
- "HIST_VERIFY"
- "HIST_FCNTL_LOCK"
- "APPEND_HISTORY"
-
- "DVORAK"
- "CORRECT"
-
- "PROMPT_SUBST"
- "TRANSIENT_RPROMPT" # maybe?
-
- "COMBINING_CHARS"
- "VI"
- ];
-
- initExtraFirst =
- builtins.readFile ./config/zsh-init.zsh
- + ''
- SHELL_LIBRARY_VERSION="2.1.2" source ${shell_library.rawLib.${system}}
- # This next line buffers the first line of the following item:
-
- ''
- # NOTE: This must be before the insult, as we otherwise override the previous handler <2024-02-28>
- + builtins.readFile ./config/command_not_found.sh
- + builtins.readFile ./config/command_not_found_insult.sh
- + builtins.readFile ./config/custom_cursor.zsh
- + builtins.readFile "${pkgs.fzf}/share/fzf/key-bindings.zsh";
-
- shellAliases = {
- ll = ". ll";
- lm = ". lm";
-
- hisea = "history 0 | grep";
- };
- };
-}