nix/home/shell/default.nix
2025-06-07 21:33:23 -07:00

70 lines
1.8 KiB
Nix

{
config,
lib,
pkgs,
dots,
...
}:
{
options.custom = with lib; {
shell = {
packages = mkOption {
type =
with types;
attrsOf (oneOf [
str
attrs
package
]);
default = { };
apply = custom.mkShellPackages;
description = ''
Attrset of shell packages to install and add to pkgs.custom overlay (for compatibility across multiple shells).
Both string and attr values will be passed as arguments to writeShellApplicationCompletions
'';
example = ''
shell.packages = {
myPackage1 = "echo 'Hello, World!'";
myPackage2 = {
runtimeInputs = [ pkgs.hello ];
text = "hello --greeting 'Hi'";
};
}
'';
};
# additionalSourceFile = mkOption {
# type =
# with types;
# nullOr (oneOf [
# path
# str
# ]);
# default = "${dots}/src/home/shell/custom.sh";
# };
};
};
config = {
# xdg.configFile."emacs".source = config.lib.file.mkOutOfStoreSymlink "${dots}/home/emacs/config";
programs.bash = {
bashrcExtra = lib.mkAfter ''
export PATH="${dots}/home/shell/bin:$PATH"
'';
};
programs.zsh = {
initExtra = lib.mkAfter ''
export PATH="${dots}/home/shell/bin:$PATH"
'';
};
# programs.bash = lib.mkIf (config.custom.shell.additionalSourceFile != null) {
# bashrcExtra = lib.mkAfter ''
# source ${config.custom.shell.additionalSourceFile}
# '';
# };
# programs.zsh = lib.mkIf (config.custom.shell.additionalSourceFile != null) {
# initExtra = lib.mkAfter ''
# source ${config.custom.shell.additionalSourceFile}
# '';
# };
};
}