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,7 +21,8 @@ in
}
];
config = lib.mkIf cfg.enable {
config = lib.mkMerge [
(lib.mkIf cfg.enable {
# Direnv
programs.direnv.enable = true;
programs.direnv.nix-direnv.enable = true;
@ -33,21 +34,6 @@ in
# GnuPG
programs.gpg.enable = true;
programs.gpg.homedir = "${config.xdg.dataHome}/gnupg";
# Git
programs.git.enable = true;
programs.git.difftastic.enable = true;
programs.git.difftastic.background = "dark";
programs.git.lfs.enable = true;
programs.git.extraConfig.init.defaultBranch = "main";
# Better conflicts (also shows parent commit state)
programs.git.extraConfig.merge.conflictStyle = "zdiff3";
# Do not create merge commits when pulling (rebase but abort on conflict)
programs.git.extraConfig.pull.ff = "only";
# Use `--set-upstream` if the remote does not have the branch
programs.git.extraConfig.push.autoSetupRemote = true;
# If there are uncommitted changes, stash them before rebasing
programs.git.extraConfig.rebase.autoStash = true;
programs.lazygit.enable = true;
# Mail client
programs.himalaya.enable = true;
# Another shell
@ -89,28 +75,69 @@ in
pkgs.sshfs
pkgs.gitoxide
pkgs.xplr
] ++ devcfg.extraPackages ++ lib.optionals devcfg.rust.enable ([ pkgs.rustup ] ++ devcfg.rust.extraPackages);
];
# Extra variables
home.sessionVariables.CARGO_HOME = "${config.xdg.dataHome}/cargo";
home.sessionVariables.RUSTUP_HOME = "${config.xdg.dataHome}/rustup";
home.sessionVariables.GOPATH = "${config.xdg.dataHome}/go";
home.sessionVariables = {
CARGO_HOME = "${config.xdg.dataHome}/cargo";
RUSTUP_HOME = "${config.xdg.dataHome}/rustup";
GOPATH = "${config.xdg.dataHome}/go";
};
home.shellAliases = {
# Verbose Commands
home.shellAliases.cp = "cp --verbose";
home.shellAliases.ln = "ln --verbose";
home.shellAliases.mv = "mv --verbose";
home.shellAliases.mkdir = "mkdir --verbose";
home.shellAliases.rename = "rename --verbose";
cp = "cp --verbose";
ln = "ln --verbose";
mv = "mv --verbose";
mkdir = "mkdir --verbose";
rename = "rename --verbose";
rm = "rm --verbose";
# Add Color
home.shellAliases.grep = "grep --color=auto";
home.shellAliases.ip = "ip --color=auto";
grep = "grep --color=auto";
ip = "ip --color=auto";
# Use exa/eza
home.shellAliases.tree = "eza --tree";
tree = "eza --tree";
};
# XDG directories
xdg.enable = true;
xdg.userDirs.enable = true;
xdg.userDirs.createDirectories = true;
})
(lib.mkIf (cfg.enable && devcfg.enable) {
home = {
sessionVariables.MANPAGER = lib.optionalString devcfg.neovimAsManPager "nvim -c 'Man!' -o -";
packages = devcfg.extraPackages
++ lib.optionals devcfg.rust.enable ([ pkgs.rustup ] ++ devcfg.rust.extraPackages);
};
# Git
programs.git = {
enable = 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;
})
];
}