Add zsh module options

This commit is contained in:
Joshua Yuen 2025-07-26 03:34:15 -04:00
parent c69c584944
commit d794ba91d0
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.hyprland.enable = true;
modules.zsh = {
enable = false;
defaultShell = true;
};
} }

View File

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

View File

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

View File

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

View File

@ -4,5 +4,6 @@
{ {
imports = [ imports = [
./hyprland.nix ./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;
};
};
}