diff --git a/system/hosts/ooksdesk/default.nix b/system/hosts/ooksdesk/default.nix index 9ff7e7a..daa64db 100644 --- a/system/hosts/ooksdesk/default.nix +++ b/system/hosts/ooksdesk/default.nix @@ -10,7 +10,7 @@ systemModules.user = { ooks.enable = true; - shell.fish.enable = true; + shell = "fish"; }; systemModules.hardware = { diff --git a/system/hosts/ooksmedia/default.nix b/system/hosts/ooksmedia/default.nix index b0c4e3d..a06034e 100644 --- a/system/hosts/ooksmedia/default.nix +++ b/system/hosts/ooksmedia/default.nix @@ -11,7 +11,7 @@ systemModules.user = { ooks.enable = true; - shell.fish.enable = true; + shell = "fish"; }; systemModules.hardware = { diff --git a/system/hosts/ookst480s/default.nix b/system/hosts/ookst480s/default.nix index 29c8632..f9255c0 100644 --- a/system/hosts/ookst480s/default.nix +++ b/system/hosts/ookst480s/default.nix @@ -12,7 +12,7 @@ systemModules = { user = { ooks.enable = true; - shell.fish.enable = true; + shell = "fish"; }; hardware = { cpu.type = "intel"; diff --git a/system/modules/user/shell/bash/default.nix b/system/modules/user/shell/bash/default.nix new file mode 100644 index 0000000..de44c24 --- /dev/null +++ b/system/modules/user/shell/bash/default.nix @@ -0,0 +1,17 @@ +{ lib, config, pkgs, ... }: + +let + inherit (lib) mkIf; + userShell = config.systemModules.user.shell; +in + +{ + config = mkIf (userShell == "bash") { + users.users.ooks.shell = pkgs.bash; + programs.bash = { + enable = true; + }; + environment.pathsToLink = ["/share/bash-completion"]; + }; +} + diff --git a/system/modules/user/shell/default.nix b/system/modules/user/shell/default.nix index 9bbe4c4..13c2bf9 100644 --- a/system/modules/user/shell/default.nix +++ b/system/modules/user/shell/default.nix @@ -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'"; }; } diff --git a/system/modules/user/shell/fish/default.nix b/system/modules/user/shell/fish/default.nix index d375748..37474a2 100644 --- a/system/modules/user/shell/fish/default.nix +++ b/system/modules/user/shell/fish/default.nix @@ -1,11 +1,12 @@ { pkgs, lib, config, ... }: let - cfg = config.systemModules.user.shell.fish; + inherit (lib) mkIf; + userShell = config.systemModules.user.shell; in { - config = lib.mkIf cfg.enable { + config = mkIf (userShell == "fish") { users.users.ooks.shell = pkgs.fish; programs.fish = { enable = true; diff --git a/system/modules/user/shell/zsh/default.nix b/system/modules/user/shell/zsh/default.nix new file mode 100644 index 0000000..50b53c5 --- /dev/null +++ b/system/modules/user/shell/zsh/default.nix @@ -0,0 +1,22 @@ +{ lib, config, pkgs, ... }: + +let + inherit (lib) mkIf; + userShell = config.systemModules.user.shell; +in + +{ + config = mkIf (userShell == "zsh") { + users.users.ooks.shell = pkgs.zsh; + programs.zsh = { + enable = true; + enableCompletion = true; + syntaxHighlighting.enable = true; + autosuggestions = { + enable = true; + async = true; + }; + }; + environment.pathsToLink = ["/share/zsh"]; + }; +}