2024-04-05 11:55:35 +02:00
|
|
|
{
|
|
|
|
nvim-config,
|
|
|
|
stylix ? null,
|
2024-07-03 23:58:26 +02:00
|
|
|
}:
|
|
|
|
{
|
2024-04-05 11:55:35 +02:00
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
2024-09-20 09:24:25 +02:00
|
|
|
osConfig ? null,
|
2024-04-05 11:55:35 +02:00
|
|
|
...
|
2024-07-03 23:58:26 +02:00
|
|
|
}:
|
|
|
|
let
|
2024-01-21 20:56:00 +01:00
|
|
|
cfg = config.jhome;
|
|
|
|
devcfg = cfg.dev;
|
2024-09-20 09:24:25 +02:00
|
|
|
# Query the osConfig for a setting. Return the default value if missing or in standalone mode
|
|
|
|
fromOs =
|
|
|
|
path: default: if osConfig == null then default else lib.attrsets.attrByPath path default osConfig;
|
2024-07-03 23:58:26 +02:00
|
|
|
in
|
|
|
|
{
|
2024-04-05 11:55:35 +02:00
|
|
|
imports =
|
|
|
|
[
|
|
|
|
nvim-config
|
|
|
|
./options.nix
|
|
|
|
./gui
|
|
|
|
./users.nix
|
|
|
|
]
|
|
|
|
++ lib.optionals (stylix != null) [
|
|
|
|
stylix.homeManagerModules.stylix
|
2024-07-03 23:58:26 +02:00
|
|
|
{ stylix.image = cfg.sway.background; }
|
2024-04-05 11:55:35 +02:00
|
|
|
];
|
2024-01-21 20:56:00 +01:00
|
|
|
|
2024-02-24 13:33:56 +01:00
|
|
|
config = lib.mkMerge [
|
2024-11-21 21:47:17 +01:00
|
|
|
(lib.mkIf (cfg.enable && cfg.styling.enable) {
|
|
|
|
stylix = {
|
|
|
|
enable = true;
|
|
|
|
programs.nixvim.enable = false; # I prefer doing it myself
|
|
|
|
};
|
|
|
|
})
|
|
|
|
(lib.mkIf cfg.enable {
|
2024-09-20 09:24:25 +02:00
|
|
|
nix.settings.use-xdg-base-directories = fromOs [
|
|
|
|
"nix"
|
|
|
|
"settings"
|
|
|
|
"use-xdg-base-directories"
|
|
|
|
] true;
|
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;
|
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;
|
2024-11-20 18:00:09 +01:00
|
|
|
icons = "auto";
|
2024-05-17 18:50:01 +02:00
|
|
|
};
|
|
|
|
# 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;
|
2024-07-03 23:58:26 +02:00
|
|
|
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-02-24 13:33:56 +01:00
|
|
|
};
|
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";
|
|
|
|
};
|
2024-02-24 13:33:56 +01:00
|
|
|
};
|
|
|
|
# XDG directories
|
2024-05-17 18:50:01 +02:00
|
|
|
xdg = {
|
|
|
|
enable = true;
|
|
|
|
userDirs = {
|
|
|
|
enable = true;
|
|
|
|
createDirectories = true;
|
|
|
|
};
|
|
|
|
};
|
2024-02-24 13:33:56 +01:00
|
|
|
})
|
|
|
|
(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;
|
2024-02-24 13:33:56 +01:00
|
|
|
};
|
2024-03-02 19:05:19 +01:00
|
|
|
# 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-14 20:44:37 +02:00
|
|
|
};
|
|
|
|
};
|
2024-02-24 13:33:56 +01:00
|
|
|
})
|
2024-04-02 15:25:42 +02:00
|
|
|
(lib.mkIf (cfg.enable && devcfg.enable && devcfg.rust.enable) {
|
2024-07-03 23:58:26 +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
|
|
|
})
|
2024-02-24 13:33:56 +01:00
|
|
|
];
|
2024-01-21 20:56:00 +01:00
|
|
|
}
|