refactor(zsh): migrate to new configuration format
This commit is contained in:
parent
a1e088fb35
commit
9214e48791
25
common/zsh/default.nix
Normal file
25
common/zsh/default.nix
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) mkEnableOption mkIf;
|
||||||
|
cfg = config.my.zsh;
|
||||||
|
in {
|
||||||
|
options.my.zsh = {
|
||||||
|
enable = mkEnableOption "zsh";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
hm.my.zsh.enable = true;
|
||||||
|
|
||||||
|
programs.zsh = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.variables.EDITOR = "nvim";
|
||||||
|
|
||||||
|
users.users."${config.my.user}".shell = pkgs.zsh;
|
||||||
|
};
|
||||||
|
}
|
64
common/zsh/home.nix
Normal file
64
common/zsh/home.nix
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) mkEnableOption mkIf;
|
||||||
|
cfg = config.my.zsh;
|
||||||
|
in {
|
||||||
|
options.my.zsh = {
|
||||||
|
enable = mkEnableOption "zsh";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
programs.zsh = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
autosuggestion.enable = true;
|
||||||
|
syntaxHighlighting.enable = true;
|
||||||
|
historySubstringSearch.enable = true;
|
||||||
|
autocd = true;
|
||||||
|
enableCompletion = true;
|
||||||
|
|
||||||
|
# Enable pure prompt
|
||||||
|
initExtra = ''
|
||||||
|
fpath+=${pkgs.pure-prompt}/share/zsh/site-functions
|
||||||
|
autoload -U promptinit;
|
||||||
|
promptinit
|
||||||
|
prompt pure
|
||||||
|
'';
|
||||||
|
|
||||||
|
envExtra = ''
|
||||||
|
# Do not load global configuration
|
||||||
|
setopt no_global_rcs
|
||||||
|
'';
|
||||||
|
|
||||||
|
loginExtra = ''
|
||||||
|
setopt correct
|
||||||
|
'';
|
||||||
|
|
||||||
|
sessionVariables = {
|
||||||
|
# Make ls colorful on MacOS
|
||||||
|
CLICOLOR = 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
plugins = [
|
||||||
|
{
|
||||||
|
name = "zsh-nix-shell";
|
||||||
|
file = "nix-shell.plugin.zsh";
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "chisui";
|
||||||
|
repo = "zsh-nix-shell";
|
||||||
|
rev = "v0.8.0";
|
||||||
|
sha256 = "1lzrn0n4fxfcgg65v0qhnj7wnybybqzs4adz7xsrkgmcsr0ii8b7";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.zoxide = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
@ -3,7 +3,6 @@
|
|||||||
../../modules/applications/alacritty.nix
|
../../modules/applications/alacritty.nix
|
||||||
../../modules/applications/sioyek.nix
|
../../modules/applications/sioyek.nix
|
||||||
|
|
||||||
../../modules/zsh.nix
|
|
||||||
../../modules/zellij
|
../../modules/zellij
|
||||||
../../modules/dev.nix
|
../../modules/dev.nix
|
||||||
../../modules/git.nix
|
../../modules/git.nix
|
||||||
@ -19,6 +18,7 @@
|
|||||||
nvim-custom
|
nvim-custom
|
||||||
];
|
];
|
||||||
|
|
||||||
|
my.zsh.enable = true;
|
||||||
programs.zsh = {
|
programs.zsh = {
|
||||||
# Needed for nix-shell to have the correct bash version
|
# Needed for nix-shell to have the correct bash version
|
||||||
profileExtra = ''
|
profileExtra = ''
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
{pkgs, ...}: {
|
{pkgs, ...}: {
|
||||||
imports = [
|
imports = [
|
||||||
../../modules/git.nix
|
../../modules/git.nix
|
||||||
../../modules/zsh.nix
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
my.zsh.enable = true;
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
lazygit
|
lazygit
|
||||||
nvim-custom
|
nvim-custom
|
||||||
|
@ -8,9 +8,10 @@
|
|||||||
../../modules/git_nixos.nix
|
../../modules/git_nixos.nix
|
||||||
../../modules/vscode.nix
|
../../modules/vscode.nix
|
||||||
../../modules/zellij
|
../../modules/zellij
|
||||||
../../modules/zsh.nix
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
my.zsh.enable = true;
|
||||||
|
|
||||||
home.packages = with pkgs; [nvim-custom];
|
home.packages = with pkgs; [nvim-custom];
|
||||||
|
|
||||||
# Let Home Manager install and manage itself.
|
# Let Home Manager install and manage itself.
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
{pkgs, ...}: {
|
|
||||||
programs.zsh = {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
autosuggestion.enable = true;
|
|
||||||
syntaxHighlighting.enable = true;
|
|
||||||
historySubstringSearch.enable = true;
|
|
||||||
autocd = true;
|
|
||||||
enableCompletion = true;
|
|
||||||
|
|
||||||
# Enable pure prompt
|
|
||||||
initExtra = ''
|
|
||||||
fpath+=${pkgs.pure-prompt}/share/zsh/site-functions
|
|
||||||
autoload -U promptinit;
|
|
||||||
promptinit
|
|
||||||
prompt pure
|
|
||||||
'';
|
|
||||||
|
|
||||||
envExtra = ''
|
|
||||||
# Do not load global configuration
|
|
||||||
setopt no_global_rcs
|
|
||||||
'';
|
|
||||||
|
|
||||||
loginExtra = ''
|
|
||||||
setopt correct
|
|
||||||
'';
|
|
||||||
|
|
||||||
sessionVariables = {
|
|
||||||
# Make ls colorful on MacOS
|
|
||||||
CLICOLOR = 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
plugins = [
|
|
||||||
{
|
|
||||||
name = "zsh-nix-shell";
|
|
||||||
file = "nix-shell.plugin.zsh";
|
|
||||||
src = pkgs.fetchFromGitHub {
|
|
||||||
owner = "chisui";
|
|
||||||
repo = "zsh-nix-shell";
|
|
||||||
rev = "v0.8.0";
|
|
||||||
sha256 = "1lzrn0n4fxfcgg65v0qhnj7wnybybqzs4adz7xsrkgmcsr0ii8b7";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.zoxide = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user