nixos/modules/shell/default.nix

57 lines
1.1 KiB
Nix
Raw Normal View History

2023-01-11 20:22:35 +00:00
{ pkgs, lib, config, ... }:
2022-10-22 22:18:32 +01:00
let
cfg = config.custom.shell;
in
2022-10-22 22:18:32 +01:00
{
imports = [
./update_scripts.nix
];
options.custom.shell = {
enable = lib.mkEnableOption "shell";
};
config = lib.mkIf cfg.enable {
custom.shell.update_scripts.enable = true;
2023-07-26 20:45:47 +01:00
users.defaultUserShell = pkgs.zsh;
2023-01-11 20:22:35 +00:00
2023-07-26 20:45:47 +01:00
environment.systemPackages = with pkgs; [ direnv ];
nix.settings = {
keep-outputs = true;
keep-derivations = true;
};
custom.impermanence.userExtraDirs.jake = [
".local/share/direnv"
2023-05-11 21:12:57 +01:00
];
2023-07-26 20:45:47 +01:00
programs.thefuck.enable = true;
programs.zsh = {
2022-10-22 22:18:32 +01:00
enable = true;
2023-07-26 20:45:47 +01:00
histSize = 1000000;
histFile = "$HOME/.zsh_history";
setOptions = [
"INC_APPEND_HISTORY"
"SHARE_HISTORY"
];
syntaxHighlighting = {
enable = true;
};
shellAliases = {
"nixos-rebuild" = "nixos-rebuild --flake \"/etc/nixos#${config.networking.fqdn}\"";
};
2023-01-21 18:26:30 +00:00
2023-07-26 20:45:47 +01:00
interactiveShellInit = with pkgs; ''
eval "$(${direnv}/bin/direnv hook zsh)"
source ${nix-direnv}/share/nix-direnv/direnvrc
'';
2023-01-21 18:26:30 +00:00
};
2022-10-22 22:18:32 +01:00
};
}