2022-07-31 11:03:59 +02:00
|
|
|
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
2020-12-26 23:36:50 +01:00
|
|
|
{
|
2022-07-31 11:03:59 +02:00
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
cfg = config.magic_rb.programs.bash;
|
|
|
|
in {
|
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
|
|
|
};
|
2022-07-31 11:03:59 +02: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;
|
2021-05-09 23:34:02 +02:00
|
|
|
|
2021-04-11 00:25:36 +02:00
|
|
|
home.file = {
|
2022-11-10 22:37:55 +01:00
|
|
|
".bash_profile".source = ./bash_profile;
|
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}";
|
2022-07-31 11:03:59 +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
|
|
|
};
|
|
|
|
}
|