feat(user:shell): add system modules for zsh/bash user shell configuration

This commit is contained in:
ooks-io 2024-04-14 19:41:53 +12:00
parent 48c0e8e005
commit ea1c418c73
7 changed files with 53 additions and 34 deletions

View file

@ -1,40 +1,19 @@
{ lib, config, ... }:
{ lib, ... }:
let
cfg = config.systemModules.user.shell;
inherit (lib) types mkOption;
in
{
imports = [
./fish
# ./bash
# ./zsh
./bash
./zsh
];
options.systemModules.user.shell = {
fish = {
enable = lib.mkEnableOption "Enable fish as the user shell";
};
zsh = {
enable = lib.mkEnableOption "Enable zsh as the user shell";
};
bash = {
enable = lib.mkEnableOption "Enable bash as the user shell";
};
};
config = {
assertions = [
{
assertion =
(lib.length (lib.filter (x: x) [
cfg.fish.enable or false
cfg.zsh.enable or false
cfg.bash.enable or false
]) <= 1);
message = "Only one user shell can be active in the configuration";
}
];
options.systemModules.user.shell = mkOption {
type = types.enum ["fish" "zsh" "bash"];
default = "zsh";
description = "The user shell to use. Select from 'zsh' 'bash' 'fish'";
};
}