feat(home): Implement dev-config disable

This commit is contained in:
Jalil David Salamé Messina 2024-02-24 13:33:56 +01:00
parent d08d05450d
commit dd9897f38b
Signed by: jalil
GPG key ID: F016B9E770737A0B

View file

@ -21,96 +21,123 @@ in
} }
]; ];
config = lib.mkIf cfg.enable { config = lib.mkMerge [
# Direnv (lib.mkIf cfg.enable {
programs.direnv.enable = true; # Direnv
programs.direnv.nix-direnv.enable = true; programs.direnv.enable = true;
# ls replacement programs.direnv.nix-direnv.enable = true;
programs.eza.enable = true; # ls replacement
programs.eza.enableAliases = true; programs.eza.enable = true;
programs.eza.git = true; programs.eza.enableAliases = true;
programs.eza.icons = true; programs.eza.git = true;
# GnuPG programs.eza.icons = true;
programs.gpg.enable = true; # GnuPG
programs.gpg.homedir = "${config.xdg.dataHome}/gnupg"; programs.gpg.enable = true;
# Git programs.gpg.homedir = "${config.xdg.dataHome}/gnupg";
programs.git.enable = true; # Mail client
programs.git.difftastic.enable = true; programs.himalaya.enable = true;
programs.git.difftastic.background = "dark"; # Another shell
programs.git.lfs.enable = true; programs.nushell.enable = true;
programs.git.extraConfig.init.defaultBranch = "main"; # Password manager
# Better conflicts (also shows parent commit state) programs.password-store.enable = true;
programs.git.extraConfig.merge.conflictStyle = "zdiff3"; programs.password-store.package = pkgs.pass-nodmenu;
# Do not create merge commits when pulling (rebase but abort on conflict) programs.password-store.settings.PASSWORD_STORE_DIR = "${config.xdg.dataHome}/pass";
programs.git.extraConfig.pull.ff = "only"; # SSH
# Use `--set-upstream` if the remote does not have the branch programs.ssh.enable = true;
programs.git.extraConfig.push.autoSetupRemote = true; # cd replacement
# If there are uncommitted changes, stash them before rebasing programs.zoxide.enable = true;
programs.git.extraConfig.rebase.autoStash = true; # Shell
programs.lazygit.enable = true; programs.zsh.enable = true;
# Mail client programs.zsh.enableAutosuggestions = true;
programs.himalaya.enable = true; programs.zsh.enableCompletion = true;
# Another shell programs.zsh.autocd = true;
programs.nushell.enable = true; programs.zsh.dotDir = ".config/zsh";
# Password manager programs.zsh.history.path = "${config.xdg.dataHome}/zsh/zsh_history";
programs.password-store.enable = true; programs.zsh.syntaxHighlighting.enable = true;
programs.password-store.package = pkgs.pass-nodmenu;
programs.password-store.settings.PASSWORD_STORE_DIR = "${config.xdg.dataHome}/pass";
# SSH
programs.ssh.enable = true;
# cd replacement
programs.zoxide.enable = true;
# Shell
programs.zsh.enable = true;
programs.zsh.enableAutosuggestions = true;
programs.zsh.enableCompletion = true;
programs.zsh.autocd = true;
programs.zsh.dotDir = ".config/zsh";
programs.zsh.history.path = "${config.xdg.dataHome}/zsh/zsh_history";
programs.zsh.syntaxHighlighting.enable = true;
# GPG Agent # GPG Agent
services.gpg-agent.enable = true; services.gpg-agent.enable = true;
services.gpg-agent.maxCacheTtl = 86400; services.gpg-agent.maxCacheTtl = 86400;
services.gpg-agent.pinentryFlavor = if config.jhome.gui.enable then "qt" else "curses"; services.gpg-agent.pinentryFlavor = if config.jhome.gui.enable then "qt" else "curses";
services.gpg-agent.extraConfig = "allow-preset-passphrase"; services.gpg-agent.extraConfig = "allow-preset-passphrase";
# Spotifyd # Spotifyd
services.spotifyd.enable = true; services.spotifyd.enable = true;
services.spotifyd.settings.global.device_name = config.jhome.hostName; services.spotifyd.settings.global.device_name = config.jhome.hostName;
services.spotifyd.settings.global.device_type = "computer"; services.spotifyd.settings.global.device_type = "computer";
services.spotifyd.settings.global.backend = "pulseaudio"; services.spotifyd.settings.global.backend = "pulseaudio";
services.spotifyd.settings.global.zeroconf_port = 2020; services.spotifyd.settings.global.zeroconf_port = 2020;
home.stateVersion = "22.11"; home.stateVersion = "22.11";
# Extra packages # Extra packages
home.packages = [ home.packages = [
pkgs.gopass pkgs.gopass
pkgs.sshfs pkgs.sshfs
pkgs.gitoxide pkgs.gitoxide
pkgs.xplr pkgs.xplr
] ++ devcfg.extraPackages ++ lib.optionals devcfg.rust.enable ([ pkgs.rustup ] ++ devcfg.rust.extraPackages); ];
# Extra variables # Extra variables
home.sessionVariables.CARGO_HOME = "${config.xdg.dataHome}/cargo"; home.sessionVariables = {
home.sessionVariables.RUSTUP_HOME = "${config.xdg.dataHome}/rustup"; CARGO_HOME = "${config.xdg.dataHome}/cargo";
home.sessionVariables.GOPATH = "${config.xdg.dataHome}/go"; RUSTUP_HOME = "${config.xdg.dataHome}/rustup";
GOPATH = "${config.xdg.dataHome}/go";
};
home.shellAliases = {
# Verbose Commands
cp = "cp --verbose";
ln = "ln --verbose";
mv = "mv --verbose";
mkdir = "mkdir --verbose";
rename = "rename --verbose";
rm = "rm --verbose";
# Add Color
grep = "grep --color=auto";
ip = "ip --color=auto";
# Use exa/eza
tree = "eza --tree";
};
# Verbose Commands # XDG directories
home.shellAliases.cp = "cp --verbose"; xdg.enable = true;
home.shellAliases.ln = "ln --verbose"; xdg.userDirs.enable = true;
home.shellAliases.mv = "mv --verbose"; xdg.userDirs.createDirectories = true;
home.shellAliases.mkdir = "mkdir --verbose"; })
home.shellAliases.rename = "rename --verbose"; (lib.mkIf (cfg.enable && devcfg.enable) {
# Add Color home = {
home.shellAliases.grep = "grep --color=auto"; sessionVariables.MANPAGER = lib.optionalString devcfg.neovimAsManPager "nvim -c 'Man!' -o -";
home.shellAliases.ip = "ip --color=auto"; packages = devcfg.extraPackages
# Use exa/eza ++ lib.optionals devcfg.rust.enable ([ pkgs.rustup ] ++ devcfg.rust.extraPackages);
home.shellAliases.tree = "eza --tree"; };
# XDG directories # Git
xdg.enable = true; programs.git = {
xdg.userDirs.enable = true; enable = true;
xdg.userDirs.createDirectories = true; difftastic.enable = true;
}; difftastic.background = "dark";
lfs.enable = true;
# Add diff to the commit message editor
extraConfig.commit.verbose = true;
# Improve submodule diff
extraConfig.diff.submodule = "log";
# Set the default branch name for new branches
extraConfig.init.defaultBranch = "main";
# Better conflicts (also shows parent commit state)
extraConfig.merge.conflictStyle = "zdiff3";
# Do not create merge commits when pulling (rebase but abort on conflict)
extraConfig.pull.ff = "only";
# Use `--set-upstream` if the remote does not have the branch
extraConfig.push.autoSetupRemote = true;
# If there are uncommitted changes, stash them before rebasing
extraConfig.rebase.autoStash = true;
# If there are fixup! commits, squash them while rebasing
extraConfig.rebase.autoSquash = true;
# Enable ReReRe (Reuse Recovered Resolution) auto resolve previously resolved conflicts
extraConfig.rerere.enabled = true;
# Improve submodule status
extraConfig.status.submoduleSummary = true;
};
programs.lazygit.enable = true;
})
];
} }