Files
nixos-setup/modules/home-manager.nix
T

102 lines
2.2 KiB
Nix

{ stateVersion
, enableDevelopmentKit
, name
, fullName
, email
, extraGitConfigs ? [ ]
}:
let
gitconfigs =
(builtins.filterSource (path: type: type != "directory") ./gitconfigs);
gitconfigFiles = builtins.attrNames (builtins.readDir gitconfigs);
commonGitConfigs = {
delta = { enable = true; };
extraConfig = {
color = { ui = "auto"; };
push = {
default = "upstream";
autoSetupRemote = true;
};
init = { defaultBranch = "main"; };
};
includes =
(builtins.map (f: { path = gitconfigs + "/" + f; }) gitconfigFiles)
++ extraGitConfigs;
};
commonProgramsConfig = { pkgs }: {
bat.enable = true;
neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
};
direnv.enable = true;
lsd = {
enable = true;
enableAliases = true;
};
zsh = {
enable = true;
autosuggestion.enable = true;
initExtra = ''
export PROMPT='%(!.%{%F{yellow}%}.)$USER@%{$fg[white]%}%M %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
'';
};
zsh.oh-my-zsh = {
enable = true;
plugins = [ "git" "sudo" ];
theme = "robbyrussell";
};
tmux = {
enable = true;
clock24 = true;
mouse = true;
plugins = with pkgs.tmuxPlugins; [ nord cpu battery sidebar ];
};
};
in
{
makeRootUser = { pkgs, ... }: {
home = {
stateVersion = stateVersion;
shellAliases = {
cat = "bat";
};
};
programs = {
git = {
enable = true;
userName = "root";
} // commonGitConfigs;
} // (commonProgramsConfig { pkgs = pkgs; });
};
makeCommonUser = { pkgs, ... }: {
home = {
stateVersion = stateVersion;
shellAliases = {
cat = "bat";
};
packages = with pkgs;
[ jq nixpkgs-fmt ipfetch nixd ]
++ (if enableDevelopmentKit then [
rye
devenv
uv
devbox
terraform
kubectl
] else
[ ]);
};
programs = {
git = {
enable = true;
userName = fullName;
userEmail = email;
} // commonGitConfigs;
} // (commonProgramsConfig { pkgs = pkgs; });
};
}