2021-04-11 00:25:36 +02:00
|
|
|
{ pkgs, config, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.magic_rb.programs.bash;
|
|
|
|
in
|
2020-12-26 23:36:50 +01:00
|
|
|
{
|
2021-04-11 00:25:36 +02:00
|
|
|
options.magic_rb.programs.bash = {
|
|
|
|
enable = mkEnableOption "Enable bash, the shell";
|
|
|
|
emacsclient-remote = mkOption {
|
|
|
|
description = "Enable emacsclient-remote and associated aliases";
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
};
|
2021-05-09 23:34:02 +02:00
|
|
|
|
|
|
|
enableDirenv = mkEnableOption "Enable direnv";
|
2021-04-11 00:25:36 +02:00
|
|
|
};
|
2020-12-26 23:36:50 +01:00
|
|
|
|
2021-04-11 00:25:36 +02:00
|
|
|
config = mkIf cfg.enable {
|
2021-05-09 23:34:02 +02:00
|
|
|
home.packages = mkMerge [
|
|
|
|
(mkIf cfg.emacsclient-remote [
|
|
|
|
pkgs.magic_rb.emacsclient-remote
|
|
|
|
])
|
|
|
|
(mkIf cfg.enableDirenv [
|
|
|
|
pkgs.direnv
|
|
|
|
])
|
2021-04-11 00:25:36 +02:00
|
|
|
];
|
|
|
|
|
2021-05-09 23:34:02 +02:00
|
|
|
programs.direnv.enable = mkIf cfg.enableDirenv true;
|
2021-07-15 15:15:29 +02:00
|
|
|
programs.direnv.nix-direnv.enable = mkIf cfg.enableDirenv true;
|
|
|
|
programs.direnv.nix-direnv.enableFlakes = mkIf cfg.enableDirenv true;
|
2021-05-09 23:34:02 +02:00
|
|
|
|
2021-04-11 00:25:36 +02:00
|
|
|
home.file = {
|
2021-12-22 23:48:31 +01:00
|
|
|
".bashrc".source = pkgs.writeSubstitutedFile {
|
2021-04-11 00:25:36 +02:00
|
|
|
name = ".bashrc";
|
|
|
|
file = ./bashrc;
|
|
|
|
substitutes = {
|
|
|
|
"exa" = "${pkgs.exa}";
|
|
|
|
"bat" = "${pkgs.bat}";
|
2021-05-09 23:34:02 +02:00
|
|
|
"direnvEnabled" = if cfg.enableDirenv then "true" else "false";
|
2021-04-11 00:25:36 +02:00
|
|
|
};
|
2021-02-26 10:24:58 +01:00
|
|
|
};
|
|
|
|
};
|
2020-12-26 23:36:50 +01:00
|
|
|
};
|
|
|
|
}
|