From 349e926e32629786611044daa96375a186f5d049 Mon Sep 17 00:00:00 2001 From: muon Date: Wed, 12 Jun 2024 14:56:28 +0000 Subject: [PATCH] Configure zsh --- hosts/muon/configuration.nix | 1 - hosts/muon/hardware-configuration.nix | 3 +- hosts/muon/home.nix | 1 + modules/home/terminal/shell.nix | 55 ++++++++++++++++++--------- modules/home/terminal/tools.nix | 24 ++++++++++-- modules/nixos/core/nix.nix | 1 + 6 files changed, 60 insertions(+), 25 deletions(-) diff --git a/hosts/muon/configuration.nix b/hosts/muon/configuration.nix index 5dd9641..15e423b 100644 --- a/hosts/muon/configuration.nix +++ b/hosts/muon/configuration.nix @@ -8,7 +8,6 @@ in { ]; # System - nix.settings.experimental-features = [ "nix-command" "flakes" ]; mods.user.name = "muon"; networking.hostName = cfg.user.name; diff --git a/hosts/muon/hardware-configuration.nix b/hosts/muon/hardware-configuration.nix index 7e274c2..897293c 100644 --- a/hosts/muon/hardware-configuration.nix +++ b/hosts/muon/hardware-configuration.nix @@ -39,7 +39,8 @@ # with explicit per-interface declarations with `networking.interfaces..useDHCP`. networking.useDHCP = lib.mkDefault true; # networking.interfaces.docker0.useDHCP = lib.mkDefault true; - # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true; + networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true; + networking.interfaces.enp0s31f6.mtu = 1200; # networking.interfaces.tun0.useDHCP = lib.mkDefault true; # networking.interfaces.vboxnet0.useDHCP = lib.mkDefault true; diff --git a/hosts/muon/home.nix b/hosts/muon/home.nix index 17ac59d..3a348b6 100644 --- a/hosts/muon/home.nix +++ b/hosts/muon/home.nix @@ -9,6 +9,7 @@ let cfg = osConfig.mods; in { programs.qutebrowser.enable = true; mods.social.enable = true; mods.i3.enable = true; + mods.terminal.zsh.enable = true; mods.terminal.emulator.enable = true; mods.terminal.development.enable = true; mods.terminal.tools.enable = true; diff --git a/modules/home/terminal/shell.nix b/modules/home/terminal/shell.nix index 629fd5f..21fd290 100644 --- a/modules/home/terminal/shell.nix +++ b/modules/home/terminal/shell.nix @@ -1,26 +1,43 @@ -{ pkgs, lib, config, osConfig, ... }: { - programs.zsh = { - enable = true; - enableCompletion = true; - autosuggestion.enable = true; - syntaxHighlighting.enable = true; +{ pkgs, lib, config, ... }: +let + cfg = config.mods.terminal; - history = { - save = 2097152; - size = 2097152; - expireDuplicatesFirst = true; - ignoreDups = true; - ignoreSpace = true; - path = "${config.xdg.dataHome}/zsh/history"; - }; + aliases = { + la = "ls -lah"; + }; - zplug = { +in { + options.mods.terminal = { + zsh.enable = lib.mkEnableOption "enables zsh"; + }; + + config = { + programs.starship.enable = true; + + programs.zsh = lib.mkIf cfg.zsh.enable { enable = true; - plugins = [ - { name = "jeffreytse/zsh-vi-mode"; } + enableCompletion = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + + history = { + save = 2097152; + size = 2097152; + expireDuplicatesFirst = true; + ignoreDups = true; + ignoreSpace = true; + path = "${config.xdg.dataHome}/zsh/history"; + }; + + shellAliases = aliases; + + plugins = with pkgs; [ + { + name = "zsh-vi-mode"; + src = zsh-vi-mode; + file = "share/zsh-vi-mode/zsh-vi-mode.plugin.zsh"; + } ]; }; }; - - programs.starship.enable = true; } diff --git a/modules/home/terminal/tools.nix b/modules/home/terminal/tools.nix index bfd842d..5739dc5 100644 --- a/modules/home/terminal/tools.nix +++ b/modules/home/terminal/tools.nix @@ -1,8 +1,24 @@ -{ pkgs, lib, config, ... }: { - options.mods.terminal.tools.enable = lib.mkEnableOption "enables cli tools"; +{ pkgs, lib, config, ... }: +let + cfg = config.mods.terminal; +in with lib; { + options.mods.terminal.tools.enable = mkEnableOption "enables cli tools"; - config = lib.mkIf config.mods.terminal.tools.enable { - programs.zellij.enable = true; + config = mkIf cfg.tools.enable { + programs.zellij = { + enable = true; + enableZshIntegration = mkIf cfg.zsh.enable true; + }; + + programs.zoxide = { + enable = true; + enableZshIntegration = mkIf cfg.zsh.enable true; + }; + + programs.dircolors = { + enable = true; + enableZshIntegration = mkIf cfg.zsh.enable true; + }; home.packages = with pkgs; [ # libraries diff --git a/modules/nixos/core/nix.nix b/modules/nixos/core/nix.nix index e1c9ad3..e2c0d2f 100644 --- a/modules/nixos/core/nix.nix +++ b/modules/nixos/core/nix.nix @@ -5,6 +5,7 @@ clean.extraArgs = "--keep-since 4d --keep 3"; flake = "/home/${config.mods.user.name}/.config/home"; }; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings = { substituters = [ "https://cache.nixos.org"