feat: refactor home-manager configs
This commit is contained in:
parent
442c9051ba
commit
fca82b60ce
13 changed files with 355 additions and 150 deletions
70
modules/home-manager/cli/cli.nix
Normal file
70
modules/home-manager/cli/cli.nix
Normal file
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.feature.cli;
|
||||
in
|
||||
{
|
||||
options.feature.cli = {
|
||||
enable = lib.mkEnableOption "Set up the CLI";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
starship
|
||||
tree
|
||||
];
|
||||
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
functions.fish_greeting = "";
|
||||
shellInitLast = lib.mkIf (lib.strings.hasSuffix "darwin" pkgs.system) ''
|
||||
eval $(/opt/homebrew/bin/brew shellenv)
|
||||
'';
|
||||
};
|
||||
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
|
||||
programs.zsh = lib.mkIf (lib.strings.hasSuffix "darwin" pkgs.system) {
|
||||
enable = true;
|
||||
|
||||
# zsh is a POSIX compliant shell and a safe default, but if it's an interactive
|
||||
# shell and fish is not in the parent processes (i.e. I'm not deliberately starting
|
||||
# zsh to use interactively from fish) then just launch fish.
|
||||
initContent = ''
|
||||
[[ $- == *i* ]] || return
|
||||
|
||||
is_parent_fish() {
|
||||
local ppid=$$
|
||||
while [[ $ppid -ne 1 ]]; do
|
||||
local ppname=$(ps -p $ppid -o comm=)
|
||||
if [[ "$ppname" == *fish* ]]; then
|
||||
return 1
|
||||
fi
|
||||
ppid=$(ps -o ppid= -p $ppid)
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
if is_parent_fish
|
||||
then
|
||||
exec fish -l
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
enableInteractive = true;
|
||||
enableTransience = true;
|
||||
settings = builtins.fromTOML (builtins.readFile ./starship.toml);
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue