refactor of user
This commit is contained in:
1 parent
a81a8ac57b
commit
e7d22b40ff
9 files changed
+75
-199
No files matched your search
@@ -1,17 +1,11 @@
|
||||
{ hostName, version, user, enableDevelopmentKit ? false, ... }:
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
gitconfigs =
|
||||
(builtins.filterSource (path: type: type != "directory") ./gitconfigs);
|
||||
gitconfigFiles = builtins.attrNames (builtins.readDir gitconfigs);
|
||||
in
|
||||
{
|
||||
home-manager.users.root = {
|
||||
home.stateVersion = version;
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = "root";
|
||||
userEmail = "root@${hostName}";
|
||||
};
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
@@ -19,75 +13,5 @@ in
|
||||
};
|
||||
programs.zsh.oh-my-zsh.enable = true;
|
||||
};
|
||||
home-manager.users.${user.name} = {
|
||||
home = {
|
||||
sessionVariables = { };
|
||||
stateVersion = version;
|
||||
shellAliases = {
|
||||
cat = "bat";
|
||||
};
|
||||
packages = with pkgs;
|
||||
[ jq nixfmt-classic devenv ipfetch nixd ]
|
||||
++ (if enableDevelopmentKit then [
|
||||
rye
|
||||
uv
|
||||
devbox
|
||||
terraform
|
||||
kubectl
|
||||
] else
|
||||
[ ]);
|
||||
};
|
||||
programs = {
|
||||
bat.enable = true;
|
||||
neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
};
|
||||
direnv.enable = true;
|
||||
lsd = {
|
||||
enable = true;
|
||||
enableAliases = true;
|
||||
};
|
||||
git = {
|
||||
enable = true;
|
||||
userName = user.fullName;
|
||||
userEmail = user.email;
|
||||
delta = { enable = true; };
|
||||
extraConfig = {
|
||||
color = { ui = "auto"; };
|
||||
push = {
|
||||
default = "upstream";
|
||||
autoSetupRemote = true;
|
||||
};
|
||||
init = { defaultBranch = "main"; };
|
||||
};
|
||||
includes =
|
||||
(builtins.map (f: { path = gitconfigs + "/" + f; }) gitconfigFiles)
|
||||
++ (if builtins.hasAttr "extraGitConfigs" user then
|
||||
user.extraGitConfigs
|
||||
else
|
||||
[ ]);
|
||||
};
|
||||
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 ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.skyg.home-manager.gitaliases;
|
||||
gitconfigs =
|
||||
(builtins.filterSource (path: type: type != "directory") ./gitconfigs);
|
||||
gitconfigFiles = builtins.attrNames (builtins.readDir gitconfigs);
|
||||
|
||||
in
|
||||
{
|
||||
options = {
|
||||
skyg.home-manager.gitaliases = {
|
||||
enable = mkEnableOption
|
||||
"Use my awesome git aliases";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable { };
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
[alias]
|
||||
pp = "!f() { \
|
||||
echo 'git pull --ff';\
|
||||
git pull --ff; \
|
||||
echo 'git push';\
|
||||
git push; \
|
||||
}; f";
|
||||
up = "pull --rebase --autostash";
|
||||
ca = "commit -a";
|
||||
ls = "log --oneline";
|
||||
cap = "!f() { \
|
||||
echo 'commiting code'; \
|
||||
git ca ${@}; \
|
||||
echo 'pushing...'; \
|
||||
git push ; \
|
||||
}; f";
|
||||
undo-commit = "!f() { \
|
||||
lastcommit=$(git log --oneline -n 1); \
|
||||
echo '[[switching]] from' $lastcommit; \
|
||||
git reset --soft HEAD~${1:-1}; \
|
||||
lastcommit=$(git log --oneline -n 1); \
|
||||
echo '[[switching]] to' $lastcommit; \
|
||||
git status; \
|
||||
}; f";
|
||||
sync = "!f() { \
|
||||
target_branch=${1:-main}; \
|
||||
remote=${2:-origin}; \
|
||||
git fetch $remote $target_branch:$target_branch; \
|
||||
}; f";
|
||||
clean-branches = "!f() { \
|
||||
git for-each-ref --format '%(refname:short)' refs/heads| grep -v 'master\\|main' | xargs git branch -D ; \
|
||||
}; f";
|
||||
Reference in new issue
Block a user