switch to elvish shell
This commit is contained in:
parent
c7e27e5594
commit
4434fa8922
@ -105,8 +105,6 @@
|
||||
networking.firewall.allowPing = true;
|
||||
networking.firewall.allowedTCPPorts = lib.mkDefault [22];
|
||||
|
||||
programs.zsh.enable = lib.mkDefault true;
|
||||
programs.fish.enable = lib.mkDefault true;
|
||||
users.defaultUserShell = lib.mkOverride 900 pkgs.zsh;
|
||||
};
|
||||
}
|
||||
|
@ -85,6 +85,7 @@
|
||||
kermit = import ./home-manager/modules/kermit.nix;
|
||||
de2u = import ./home-manager/modules/de2u.nix inputs;
|
||||
de3u = import ./home-manager/modules/de3u.nix inputs;
|
||||
elvish = import ./home-manager/modules/elvish.nix inputs;
|
||||
all = import ./home-manager/modules/default.nix inputs;
|
||||
};
|
||||
|
||||
|
@ -59,26 +59,16 @@ inputs: {
|
||||
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
settings = {
|
||||
line_break.disabled = true;
|
||||
};
|
||||
};
|
||||
|
||||
programs.zoxide = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
programs.zsh = {
|
||||
programs.elvish = {
|
||||
enable = true;
|
||||
enableAutosuggestions = true;
|
||||
enableSyntaxHighlighting = true;
|
||||
shellAliases = {
|
||||
ls = "lsd";
|
||||
l = "ls -l";
|
||||
la = "ls -a";
|
||||
lla = "ls -la";
|
||||
lt = "ls --tree";
|
||||
};
|
||||
starship = true;
|
||||
zoxide = true;
|
||||
};
|
||||
|
||||
programs.firefox = {
|
||||
|
@ -15,5 +15,6 @@ inputs: {
|
||||
./kermit.nix
|
||||
(import ./de2u.nix inputs)
|
||||
(import ./de3u.nix inputs)
|
||||
./elvish.nix
|
||||
];
|
||||
}
|
||||
|
82
home-manager/modules/elvish.nix
Normal file
82
home-manager/modules/elvish.nix
Normal file
@ -0,0 +1,82 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.programs.elvish;
|
||||
in {
|
||||
options.programs.elvish = {
|
||||
enable = mkEnableOption "Elvish, a friendly interactive shell and an expressive programming";
|
||||
|
||||
defaultFromBash = mkOption {
|
||||
type = types.bool;
|
||||
default = cfg.enable;
|
||||
description = ''
|
||||
Launch automatically when an interactive Bash shell is started
|
||||
'';
|
||||
};
|
||||
|
||||
zoxide = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Enable zoxide smart directory switcher
|
||||
'';
|
||||
};
|
||||
|
||||
starship = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Use the starship prompt
|
||||
'';
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.elvish;
|
||||
defaultText = literalExpression "pkgs.elvish";
|
||||
description = ''
|
||||
The elvish package to install. May be used to change the version.
|
||||
'';
|
||||
};
|
||||
|
||||
initExtra = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Elvish code called during interactive elvish shell
|
||||
initialisation.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [cfg.package];
|
||||
|
||||
# programs.man.generateCaches = mkDefault true;
|
||||
|
||||
xdg.configFile."elvish/rc.elv".text = cfg.initExtra;
|
||||
|
||||
programs.bash.enable = mkIf cfg.defaultFromBash true;
|
||||
programs.bash.initExtra = mkIf cfg.defaultFromBash "exec elvish";
|
||||
|
||||
programs.starship.enable = mkIf cfg.starship true;
|
||||
programs.zoxide.enable = mkIf cfg.zoxide true;
|
||||
|
||||
programs.starship.enableBashIntegration = mkIf cfg.defaultFromBash false;
|
||||
|
||||
programs.elvish.initExtra = mkMerge [
|
||||
(mkIf cfg.starship ''
|
||||
if (and (not-eq $E:TERM "dumb") (or (not (has-env "INSIDE_EMACS")) (eq $E:INSIDE_EMACS "vterm"))) {
|
||||
eval (${config.home.profileDirectory}/bin/starship init elvish)
|
||||
}
|
||||
'')
|
||||
(mkIf cfg.zoxide ''
|
||||
eval (${config.programs.zoxide.package}/bin/zoxide init elvish | slurp)
|
||||
'')
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user