home: move shell config to separate file
This commit is contained in:
parent
45b2e7ff0f
commit
8c15a71cec
home
@ -5,5 +5,6 @@
|
||||
./nodm.nix
|
||||
./nix.nix
|
||||
./theme.nix
|
||||
./shell.nix
|
||||
];
|
||||
}
|
||||
|
64
home/common/shell.nix
Normal file
64
home/common/shell.nix
Normal file
@ -0,0 +1,64 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
inherit (lib) mkOption mkEnableOption mkIf mkDefault;
|
||||
cfg = config.nixfiles.common.shell;
|
||||
|
||||
common_functions = shell: ''
|
||||
__nixfiles_alias_comma_frequent_commands () {
|
||||
history | sed 's:^ \+[0-9]\+ \+::' | grep '^,' | cut -d' ' -f2- | sed 's:^\(-[^ ]\+ \?\)\+::g' | grep . | cut -d' ' -f1 | sort | uniq -c | sort -g
|
||||
}
|
||||
'';
|
||||
in
|
||||
{
|
||||
options.nixfiles.common.shell = {
|
||||
enable = lib.mkEnableOption "" // {
|
||||
description = "Whether to enable the nixfiles shell configuration.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.shellAliases = {
|
||||
v = "nvim";
|
||||
icat = "kitten icat";
|
||||
srun = "systemd-run";
|
||||
urun = "systemd-run --user";
|
||||
|
||||
# this lets me find commands that i run with comma very frequently so i
|
||||
# can install them
|
||||
comma-frequent = "__nixfiles_alias_comma_frequent_commands";
|
||||
};
|
||||
programs.fzf.enable = mkDefault true;
|
||||
programs.fzf.enableZshIntegration = mkDefault true;
|
||||
programs.fzf.enableBashIntegration = mkDefault true;
|
||||
|
||||
programs.bash = {
|
||||
enable = mkDefault true;
|
||||
# declare functions at start of bashrc
|
||||
bashrcExtra = common_functions "bash";
|
||||
initExtra = ''
|
||||
export HOME_MANAGER_MANAGED=true;
|
||||
[[ -e ~/dotfiles/shell/.bashrc ]] && . ~/dotfiles/shell/.bashrc ]]
|
||||
unset HOME_MANAGERR_MANAGED
|
||||
'';
|
||||
};
|
||||
programs.zsh = {
|
||||
enable = mkDefault true;
|
||||
initExtra = ''
|
||||
export HOME_MANAGER_MANAGED=true
|
||||
[[ -e ~/dotfiles/shell/.zshrc ]] && . ~/dotfiles/shell/.zshrc ]]
|
||||
unset HOME_MANAGER_MANAGED
|
||||
'' + common_functions "zsh";
|
||||
oh-my-zsh = {
|
||||
enable = mkDefault true;
|
||||
theme = "robbyrussell";
|
||||
extraConfig = ''
|
||||
DISABLE_MAGIC_FUNCTIONS="true"
|
||||
'';
|
||||
plugins = [
|
||||
"git"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
@ -17,6 +17,7 @@ in
|
||||
nixfiles.programs.comma.enable = true;
|
||||
nixfiles.programs.neovim.enable = lib.mkDefault true;
|
||||
nixfiles.common.nix.enable = true;
|
||||
nixfiles.common.shell.enable = true;
|
||||
|
||||
home.sessionVariables = lib.mkMerge [
|
||||
(lib.mkIf config.programs.neovim.enable {
|
||||
@ -34,50 +35,6 @@ in
|
||||
})
|
||||
];
|
||||
|
||||
|
||||
# TODO move this stuff to a shell.nix or something; this is just a quick
|
||||
# fix so home.sessionVariables works
|
||||
home.shellAliases = {
|
||||
v = "nvim";
|
||||
icat = "kitten icat";
|
||||
srun = "systemd-run";
|
||||
urun = "systemd-run --user";
|
||||
|
||||
# this lets me find commands that i run with comma very frequently so i
|
||||
# can install them
|
||||
comma-frequent = "history | sed 's:^ \+[0-9]\+ \+::' | grep '^,' | cut -d' ' -f2- | sed 's:^\(-[^ ]\+ \?\)\+::g' | grep . | cut -d' ' -f1 | sort | uniq -c | sort -g";
|
||||
};
|
||||
programs.fzf.enable = lib.mkDefault true;
|
||||
programs.fzf.enableZshIntegration = lib.mkDefault true;
|
||||
programs.fzf.enableBashIntegration = lib.mkDefault true;
|
||||
|
||||
programs.bash = {
|
||||
enable = lib.mkDefault true;
|
||||
initExtra = ''
|
||||
export HOME_MANAGER_MANAGED=true;
|
||||
[[ -e ~/dotfiles/shell/.bashrc ]] && . ~/dotfiles/shell/.bashrc ]]
|
||||
unset HOME_MANAGERR_MANAGED
|
||||
'';
|
||||
};
|
||||
programs.zsh = {
|
||||
enable = lib.mkDefault true;
|
||||
initExtra = ''
|
||||
export HOME_MANAGER_MANAGED=true
|
||||
[[ -e ~/dotfiles/shell/.zshrc ]] && . ~/dotfiles/shell/.zshrc ]]
|
||||
unset HOME_MANAGER_MANAGED
|
||||
'';
|
||||
oh-my-zsh = {
|
||||
enable = lib.mkDefault true;
|
||||
theme = "robbyrussell";
|
||||
extraConfig = ''
|
||||
DISABLE_MAGIC_FUNCTIONS="true"
|
||||
'';
|
||||
plugins = [
|
||||
"git"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
programs.btop.enable = lib.mkDefault true;
|
||||
|
||||
programs.ranger = let
|
||||
|
Loading…
x
Reference in New Issue
Block a user