configuration.nix/home/default.nix

207 lines
5.5 KiB
Nix
Raw Normal View History

{
nvim-config,
stylix ? null,
}:
{
config,
pkgs,
lib,
...
}:
let
cfg = config.jhome;
devcfg = cfg.dev;
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;
[chore] flake.lock: update inputs Fix for OpenSSH vulnerability: ``` • Updated input 'home-manager': 'github:nix-community/home-manager/a1fddf0967c33754271761d91a3d921772b30d0e' (2024-06-16) → 'github:nix-community/home-manager/391ca6e950c2525b4f853cbe29922452c14eda82' (2024-07-01) • Updated input 'nixos-hardware': 'github:NixOS/nixos-hardware/a59f00f5ac65b19382617ba00f360f8bc07ed3ac' (2024-06-29) → 'github:NixOS/nixos-hardware/6e253f12b1009053eff5344be5e835f604bb64cd' (2024-07-02) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/89c49874fb15f4124bf71ca5f42a04f2ee5825fd' (2024-06-26) → 'github:NixOS/nixpkgs/d032c1a6dfad4eedec7e35e91986becc699d7d69' (2024-07-01) • Updated input 'nixvim': 'github:nix-community/nixvim/c062b976eff9f13597c7c23d77a6b3ac677b7fd5' (2024-06-29) → 'github:nix-community/nixvim/079c2c479b5707adf0b03f817be30945c92c15cf' (2024-07-01) • Updated input 'nixvim/flake-parts': 'github:hercules-ci/flake-parts/2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8' (2024-06-01) → 'github:hercules-ci/flake-parts/c3c5ecc05edc7dafba779c6c1a61cd08ac6583e9' (2024-06-30) • Updated input 'nixvim/treefmt-nix': 'github:numtide/treefmt-nix/065a23edceff48f948816b795ea8cc6c0dee7cdf' (2024-06-24) → 'github:numtide/treefmt-nix/8df5ff62195d4e67e2264df0b7f5e8c9995fd0bd' (2024-06-30) • Updated input 'unstable': 'github:NixOS/nixpkgs/b2852eb9365c6de48ffb0dc2c9562591f652242a' (2024-06-27) → 'github:NixOS/nixpkgs/2741b4b489b55df32afac57bc4bfd220e8bf617e' (2024-06-29) ```
2024-06-30 14:03:24 +02:00
config = {
# Disable headers and numbers
style = "plain";
theme = lib.mkForce "gruvbox-dark";
};
2024-05-17 18:50:01 +02:00
};
# 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;
2024-05-17 18:50:01 +02:00
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
];
# 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) {
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
})
];
}