From f46f67dd71058b29526cca2525a76a8f5a04b420 Mon Sep 17 00:00:00 2001 From: Joshua Yuen Date: Sat, 26 Jul 2025 03:41:00 -0400 Subject: [PATCH] Adjust default shell option --- hosts/vm/default.nix | 7 +++---- modules/core/user.nix | 7 ++----- modules/options/default.nix | 1 + modules/options/shell.nix | 23 +++++++++++++++++++++++ 4 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 modules/options/shell.nix diff --git a/hosts/vm/default.nix b/hosts/vm/default.nix index dbbb98b..3ed7bff 100644 --- a/hosts/vm/default.nix +++ b/hosts/vm/default.nix @@ -13,8 +13,7 @@ ]; modules.hyprland.enable = true; - modules.zsh = { - enable = false; - defaultShell = true; - }; + + modules.zsh.enable = true; + modules.shell.defaultShell = "zsh"; } \ No newline at end of file diff --git a/modules/core/user.nix b/modules/core/user.nix index 1f44160..87b7cf6 100644 --- a/modules/core/user.nix +++ b/modules/core/user.nix @@ -11,7 +11,7 @@ }: with lib; let - zshCfg = config.modules.zsh; + shellCfg = config.modules.shell; in { imports = [ inputs.home-manager.nixosModules.home-manager ]; @@ -37,10 +37,7 @@ in extraGroups = [ "wheel" ]; - shell = mkMerge [ - (mkIf (zshCfg.enable && zshCfg.defaultShell) pkgs.zsh) - (mkIf (!zshCfg.enable || !zshCfg.defaultShell) pkgs.bash) - ]; + shell = pkgs.${shellCfg.defaultShell}; ignoreShellProgramCheck = true; }; diff --git a/modules/options/default.nix b/modules/options/default.nix index c648c53..e7130be 100644 --- a/modules/options/default.nix +++ b/modules/options/default.nix @@ -4,6 +4,7 @@ { imports = [ ./hyprland.nix + ./shell.nix ./zsh.nix ]; } \ No newline at end of file diff --git a/modules/options/shell.nix b/modules/options/shell.nix new file mode 100644 index 0000000..9db5ad1 --- /dev/null +++ b/modules/options/shell.nix @@ -0,0 +1,23 @@ +{ + config, + lib, + ... +}: +with lib; +let + cfg = config.modules.shell; +in +{ + options.modules.shell = { + defaultShell = mkOption { + type = types.enum [ + "bash" + "zsh" + ]; + default = "zsh"; + description = '' + The default shell to use for your user account. + ''; + }; + }; +} \ No newline at end of file