configuration.nix/home/default.nix

205 lines
5.5 KiB
Nix
Raw Normal View History

{
nvim-config,
stylix ? null,
2024-05-04 20:57:33 +02:00
}: {
config,
pkgs,
lib,
...
2024-05-04 20:57:33 +02:00
}: let
cfg = config.jhome;
devcfg = cfg.dev;
2024-05-04 20:57:33 +02:00
in {
imports =
[
nvim-config
./options.nix
./gui
./users.nix
]
++ lib.optionals (stylix != null) [
stylix.homeManagerModules.stylix
{stylix.image = cfg.sway.background;}
];
config = lib.mkMerge [
(lib.mkIf (cfg.enable && cfg.styling.enable) {stylix.enable = true;})
(lib.mkIf cfg.enable {
2024-05-17 18:50:01 +02:00
programs = {
2024-02-24 15:47:24 +01:00
# Better cat (bat)
2024-05-17 18:50:01 +02:00
bat = {
enable = true;
# Disable headers and numbers
config.style = "plain";
};
# Direnv
direnv = {
enable = true;
nix-direnv.enable = true;
};
# ls replacement
eza = {
enable = true;
git = true;
icons = true;
};
# GnuPG
gpg = {
enable = true;
homedir = "${config.xdg.dataHome}/gnupg";
};
# Mail client
himalaya.enable = true;
# Another shell
nushell.enable = true;
# Password manager
password-store = {
enable = true;
package = pkgs.pass-nodmenu;
settings.PASSWORD_STORE_DIR = "${config.xdg.dataHome}/pass";
};
# SSH
ssh.enable = true;
# cd replacement
zoxide.enable = true;
# Shell
zsh = {
enable = true;
autosuggestion.enable = true;
enableCompletion = true;
autocd = true;
dotDir = ".config/zsh";
history.path = "${config.xdg.dataHome}/zsh/zsh_history";
syntaxHighlighting.enable = true;
};
2024-02-24 15:47:24 +01:00
};
2024-05-17 18:50:01 +02:00
services = {
# GPG Agent
gpg-agent = {
enable = true;
maxCacheTtl = 86400;
pinentryPackage =
if config.jhome.gui.enable
then pkgs.pinentry-qt
else pkgs.pinentry-curses;
extraConfig = "allow-preset-passphrase";
};
# Spotifyd
spotifyd = {
inherit (config.jhome.gui) enable;
settings.global = {
device_name = config.jhome.hostName;
device_type = "computer";
backend = "pulseaudio";
zeroconf_port = 2020;
};
};
};
2024-05-17 18:50:01 +02:00
home = {
stateVersion = "22.11";
# Extra packages
packages = [
pkgs.gopass
pkgs.sshfs
pkgs.gitoxide
pkgs.xplr
];
# Extra variables
sessionVariables = {
CARGO_HOME = "${config.xdg.dataHome}/cargo";
RUSTUP_HOME = "${config.xdg.dataHome}/rustup";
GOPATH = "${config.xdg.dataHome}/go";
};
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";
};
};
# XDG directories
2024-05-17 18:50:01 +02:00
xdg = {
enable = true;
userDirs = {
enable = true;
createDirectories = true;
};
};
})
(lib.mkIf (cfg.enable && devcfg.enable) {
home = {
sessionVariables.MANPAGER = lib.optionalString devcfg.neovimAsManPager "nvim -c 'Man!' -o -";
2024-04-02 15:25:42 +02:00
packages = devcfg.extraPackages;
};
# Github CLI
2024-05-17 18:50:01 +02:00
programs = {
gh.enable = true;
gh-dash.enable = true;
# Git
git = {
enable = true;
difftastic = {
enable = true;
background = "dark";
};
lfs.enable = true;
extraConfig = {
# Add diff to the commit message editor
commit.verbose = true;
# Improve submodule diff
diff.submodule = "log";
# Set the default branch name for new branches
init.defaultBranch = "main";
# Better conflicts (also shows parent commit state)
merge.conflictStyle = "zdiff3";
# Do not create merge commits when pulling (rebase but abort on conflict)
pull.ff = "only";
# Use `--set-upstream` if the remote does not have the branch
push.autoSetupRemote = true;
rebase = {
# If there are uncommitted changes, stash them before rebasing
autoStash = true;
# If there are fixup! commits, squash them while rebasing
autoSquash = true;
};
# Enable ReReRe (Reuse Recovered Resolution) auto resolve previously resolved conflicts
rerere.enabled = true;
# Improve submodule status
status.submoduleSummary = true;
};
};
lazygit.enable = true;
# Jujutsu (alternative DVCS (git-compatible))
jujutsu = {
enable = true;
settings = {
ui.pager = "bat";
};
};
};
})
2024-04-02 15:25:42 +02:00
(lib.mkIf (cfg.enable && devcfg.enable && devcfg.rust.enable) {
2024-05-04 20:57:33 +02:00
home.packages = [pkgs.rustup] ++ devcfg.rust.extraPackages;
2024-04-02 15:25:42 +02:00
# Background code checker (for Rust)
2024-04-02 17:05:17 +02:00
programs.bacon = {
enable = true;
settings = {
export = {
enabled = true;
path = ".bacon-locations";
line_format = "{kind} {path}:{line}:{column} {message}";
};
};
};
2024-04-02 15:25:42 +02:00
})
];
}