-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
73 lines (59 loc) · 2.18 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{ config, lib, pkgs, username, ... }: {
options = {
zsh.enable = lib.mkEnableOption "enables zsh module";
zsh.zoxide.enable = lib.mkEnableOption "enables zoxide";
};
imports = [
./zsh-vi-mode.nix
];
config = let
custom = "$HOME/.zsh-custom";
in lib.mkIf config.zsh.enable {
zsh.vi-mode.enable = lib.mkDefault true;
zsh.zoxide.enable = lib.mkDefault true;
home.packages = [
pkgs.spaceship-prompt
];
programs.zoxide.enable = config.zsh.zoxide.enable;
home.persistence."/persist/home/${username}".directories = lib.mkIf config.impermanence.enable [
".local/share/zoxide"
];
home.file.".zsh-custom/themes/spaceship.zsh-theme" = {
recursive = true;
source = "${pkgs.spaceship-prompt}/lib/spaceship-prompt/spaceship.zsh";
};
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
envExtra = ''
${if config.tmux.enable then "export ZSH_TMUX_AUTOSTART=true" else ""}
${if config.zsh.vi-mode.enable then "ZVM_VI_SURROUND_BINDKEY='s-prefix'" else ""}
${if config.zsh.zoxide.enable then "export ZOXIDE_CMD_OVERRIDE='cd'" else ""}
'';
history = {
expireDuplicatesFirst = true;
};
initExtra = ''
# Allow execution of arbitrary binaries downloaded through channels such as mason
# export NIX_LD=$(nix eval --impure --raw --expr 'let pkgs = import <nixpkgs> {}; NIX_LD = pkgs.lib.fileContents "${pkgs.stdenv.cc}/nix-support/dynamic-linker"; in NIX_LD')
${if config.zsh.vi-mode.enable then "source $HOME/.zsh-custom/my-custom/zsh-vi-mode.sh" else ""}
${if config.scripts.wallpaper-haven.enable then "# Load a random wallpaper from wallpaper haven" else ""}
${if config.scripts.wallpaper-haven.enable then "(&>/dev/null $HOME/.local/bin/wallpaper-haven &)" else ""}
'';
oh-my-zsh = {
enable = true;
inherit custom;
plugins = [
"git"
"nix-shell"
] ++ lib.optionals (config.tmux.enable) [
"tmux"
] ++ lib.optionals (config.zsh.zoxide.enable) [
"zoxide"
];
theme = "spaceship";
};
};
};
}