diff options
Diffstat (limited to 'modules/shell')
| -rw-r--r-- | modules/shell/bash/default.nix | 9 | ||||
| -rw-r--r-- | modules/shell/default.nix | 18 | ||||
| -rw-r--r-- | modules/shell/zsh/default.nix | 11 |
3 files changed, 28 insertions, 10 deletions
diff --git a/modules/shell/bash/default.nix b/modules/shell/bash/default.nix index f26e3d8..ee3b4a8 100644 --- a/modules/shell/bash/default.nix +++ b/modules/shell/bash/default.nix @@ -1,13 +1,14 @@ -{ config, lib, ... }: +{ config, lib, pkgs, ... }: { - options = { - bash.enable = lib.mkEnableOption "Enables bash."; + options.shell.bash = { + enable = lib.mkEnableOption "Enables bash."; }; - config = lib.mkIf config.bash.enable { + config = lib.mkIf config.shell.bash.enable { programs.bash.enable = true; programs.bash.historyFile = "${config.xdg.cacheHome}/bash/history"; + programs.bash.shellAliases = config.shell.alias; home.file."${config.xdg.cacheHome}/bash/histroy".text = ""; # Create the cache directory and histroy file }; } diff --git a/modules/shell/default.nix b/modules/shell/default.nix index e4c3964..2dbd054 100644 --- a/modules/shell/default.nix +++ b/modules/shell/default.nix @@ -1,8 +1,24 @@ -{ lib, config, ... }: +{ lib, pkgs, ... }: { imports = [ ./bash ./zsh ]; + + options.shell = { + default = lib.mkOption { + type = lib.types.string; + description = "Path to the default shell program."; + }; + alias = lib.mkOption { + type = lib.types.attrs; + description = "Shell aliases."; + }; + }; + + config = { + shell.default = lib.mkDefault "${pkgs.bash}/bin/bash"; # Set bash as default shell + shell.bash.enable = lib.mkDefault true; # Enable bash by default + }; } diff --git a/modules/shell/zsh/default.nix b/modules/shell/zsh/default.nix index b4ea77a..c553ec4 100644 --- a/modules/shell/zsh/default.nix +++ b/modules/shell/zsh/default.nix @@ -1,15 +1,16 @@ -{ config, lib, ... }: +{ config, lib, pkgs, ... }: { - options = { - zsh.enable = lib.mkEnableOption "Enables zsh."; + options.shell.zsh = { + enable = lib.mkEnableOption "Enables zsh."; }; - config = lib.mkIf config.zsh.enable { + config = lib.mkIf config.shell.zsh.enable { programs.zsh.enable = true; programs.zsh.dotDir = ".config/zsh"; programs.zsh.history.path = "${config.xdg.cacheHome}/zsh/history"; programs.zsh.initExtra = builtins.readFile ./zshrc; - programs.zsh.shellAliases = config.programs.bash.shellAliases; + programs.zsh.shellAliases = config.shell.alias; + shell.default = "${pkgs.zsh}/bin/zsh"; }; } |
