diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..fdff83b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +# http://editorconfig.org +root = true + +[*] +indent_style = tab +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/configs/.DS_Store b/configs/.DS_Store new file mode 100644 index 0000000..45a7663 Binary files /dev/null and b/configs/.DS_Store differ diff --git a/configs/gitconfigs/alias.conf b/configs/gitconfigs/alias.conf new file mode 100644 index 0000000..8394779 --- /dev/null +++ b/configs/gitconfigs/alias.conf @@ -0,0 +1,29 @@ +[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"; \ No newline at end of file diff --git a/modules/optional/home-manager-config.nix b/modules/optional/home-manager-config.nix index 9361e5d..b3866d5 100644 --- a/modules/optional/home-manager-config.nix +++ b/modules/optional/home-manager-config.nix @@ -1,6 +1,10 @@ { hostName, homeMangerVersion, user }: { pkgs, ... }: -{ +let + gitconfigs = + (builtins.filterSource (path: type: type != "directory") ../../gitconfigs); + gitconfigFiles = builtins.attrNames (builtins.readDir gitconfigs); +in { home-manager.users.root = { home.stateVersion = homeMangerVersion; programs.git = { @@ -17,9 +21,7 @@ home-manager.users.${user.name} = { home = { stateVersion = homeMangerVersion; - shellAliases = { - cat = "bat"; - }; + shellAliases = { cat = "bat"; }; packages = [ (pkgs.nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" ]; }) pkgs.kubectl @@ -41,9 +43,17 @@ enable = true; userName = user.fullName; userEmail = user.email; - delta = { - enable = true; + delta = { enable = true; }; + extraConfig = { + color = { ui = "auto"; }; + push = { + default = "upstream"; + autoSetupRemote = true; + }; + init = { defaultBranch = "main"; }; }; + includes = + (builtins.map (f: { path = gitconfigs + "/" + f; }) gitconfigFiles); }; zsh = { enable = true; @@ -54,10 +64,7 @@ }; zsh.oh-my-zsh = { enable = true; - plugins = [ - "git" - "sudo" - ]; + plugins = [ "git" "sudo" ]; theme = "robbyrussell"; }; };