nix/home/shell.nix

108 lines
2.5 KiB
Nix

{
config,
lib,
pkgs,
dots,
inputs,
...
}:
{
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'";
};
}
'';
};
};
};
config = {
home.packages =
with pkgs;
[
nixd
nixfmt-rfc-style
fd
fx
jq
sd
ugrep
unzip
fastfetch
openconnect
fd
ripgrep
tree
gnumake
texinfo
devenv
fontconfig
pandoc
duckdb
hyperfine
(pkgs.python311.withPackages (ppkgs: [
ppkgs.numpy
]))
gum
(inputs.yazi.packages.${pkgs.stdenv.hostPlatform.system}.default.override {
_7zz = pkgs._7zz-rar; # Support for RAR extraction
})
imagemagick
]
++ lib.optionals pkgs.stdenv.isDarwin [ coreutils ]
++ (lib.attrValues config.custom.shell.packages);
programs.bash = {
enable = true;
enableVteIntegration = true;
bashrcExtra = lib.mkAfter ''
export PATH="${dots}/bin:$PATH"
'';
};
programs.zsh = {
enable = true;
enableVteIntegration = true;
initContent = lib.mkAfter ''
export PATH="${dots}/bin:$PATH"
'';
};
programs.fish = {
enable = true;
shellInit = lib.mkAfter ''
fish_add_path "${dots}/bin"
'';
interactiveShellInit = lib.mkAfter ''
source "${dots}/config/fish/config.fish"
'';
};
programs.zoxide = {
enable = true;
enableBashIntegration = config.programs.bash.enable;
enableZshIntegration = config.programs.zsh.enable;
enableFishIntegration = config.programs.fish.enable;
};
xdg.configFile."sesh".source = config.lib.file.mkOutOfStoreSymlink "${dots}/config/sesh";
xdg.configFile."yazi".source = config.lib.file.mkOutOfStoreSymlink "${dots}/config/yazi";
};
}