Add zsh module options

This commit is contained in:
Joshua Yuen 2025-07-26 03:34:15 -04:00
parent b0eccdf769
commit 82419f9b62
Signed by: josh
GPG Key ID: 502720BC22ED411C
6 changed files with 51 additions and 7 deletions

View File

@ -13,4 +13,8 @@
];
modules.hyprland.enable = true;
modules.zsh = {
enable = false;
defaultShell = true;
};
}

View File

@ -1,11 +1,17 @@
{
config,
host,
inputs,
lib,
pkgs,
profile,
username,
...
}:
with lib;
let
zshCfg = config.modules.zsh;
in
{
imports = [ inputs.home-manager.nixosModules.home-manager ];
home-manager = {
@ -30,7 +36,10 @@
extraGroups = [
"wheel"
];
shell = pkgs.zsh;
shell = mkMerge [
(mkIf (zshCfg.enable && zshCfg.defaultShell) pkgs.zsh)
(mkIf (!zshCfg.enable || !zshCfg.defaultShell) pkgs.bash)
];
ignoreShellProgramCheck = true;
};

View File

@ -1,17 +1,21 @@
{
config,
lib,
osConfig,
pkgs,
profile,
...
}:
with lib;
let
cfg = osConfig.modules.zsh;
in
{
imports = [
./zshrc-personal.nix
];
programs.zsh = {
enable = true;
enable = cfg.enable;
autosuggestion.enable = true;
syntaxHighlighting = {
enable = true;

View File

@ -1,11 +1,19 @@
{
lib,
osConfig,
pkgs,
...
}:
with lib;
let
cfg = osConfig.modules.zsh;
in
{
config = mkIf cfg.enable {
home.packages = with pkgs; [ zsh ];
home.file."./.zshrc-personal".text = ''
export EDITOR=vim
'';
};
}

View File

@ -4,5 +4,6 @@
{
imports = [
./hyprland.nix
./zsh.nix
];
}

18
modules/options/zsh.nix Normal file
View File

@ -0,0 +1,18 @@
{
config,
lib,
...
}:
with lib;
let
cfg = config.modules.zsh;
in
{
options.modules.zsh = {
enable = mkEnableOption "Install ZSH";
defaultShell = mkEnableOption {
description = "Set ZSH as the default shell";
default = true;
};
};
}