mirror of
https://github.com/itme-brain/nixos.git
synced 2026-05-08 06:50:11 -04:00
init
This commit is contained in:
commit
864c69fe61
147 changed files with 11233 additions and 0 deletions
32
user/modules/git/default.nix
Normal file
32
user/modules/git/default.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.user.git;
|
||||
|
||||
in
|
||||
{ options.modules.user.git = { enable = mkEnableOption "user.git"; };
|
||||
config = mkIf cfg.enable {
|
||||
programs = {
|
||||
git = {
|
||||
enable = true;
|
||||
};
|
||||
gh = {
|
||||
enable = true;
|
||||
settings.git_protocol = "ssh";
|
||||
};
|
||||
};
|
||||
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
git-crypt
|
||||
];
|
||||
file.".config/git" = {
|
||||
source = ./git;
|
||||
recursive = true;
|
||||
};
|
||||
};
|
||||
|
||||
programs.bash.initExtra = import ./scripts/cdg.nix;
|
||||
};
|
||||
}
|
||||
9
user/modules/git/git/README.md
Normal file
9
user/modules/git/git/README.md
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# Git Config
|
||||
|
||||
My global git configuration.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
git clone git@github.com:itme-brain/git.git ~/.config/git
|
||||
```
|
||||
28
user/modules/git/git/config
Normal file
28
user/modules/git/git/config
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
[init]
|
||||
defaultBranch = master
|
||||
|
||||
# Use vimdiff for diffs and merge conflicts
|
||||
[diff]
|
||||
tool = vimdiff
|
||||
|
||||
[merge]
|
||||
tool = vimdiff
|
||||
|
||||
[mergetool]
|
||||
keepBackup = false
|
||||
|
||||
[mergetool "vimdiff"]
|
||||
trustExitCode = true
|
||||
|
||||
[user]
|
||||
name = Bryan Ramos
|
||||
email = bryan@ramos.codes
|
||||
signingKey = F1F3466458452B2DF351F1E864D12BA95ACE1F2D
|
||||
|
||||
# Auto-set upstream on first push
|
||||
[push]
|
||||
autoSetupRemote = true
|
||||
|
||||
# Enable per-project with: git config --local commit.gpgSign true
|
||||
[commit]
|
||||
gpgSign = false
|
||||
14
user/modules/git/git/ignore
Normal file
14
user/modules/git/git/ignore
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# JavaScript / Node
|
||||
node_modules
|
||||
|
||||
# Nix
|
||||
.direnv
|
||||
result
|
||||
|
||||
# Haskell
|
||||
dist-newstyle
|
||||
|
||||
# Nuxt
|
||||
.nuxt/
|
||||
.output/
|
||||
dist
|
||||
24
user/modules/git/scripts/cdg.nix
Normal file
24
user/modules/git/scripts/cdg.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
''
|
||||
function cdg() {
|
||||
if [[ $1 == "--help" ]]; then
|
||||
echo "A simple utility for navigating to the root of a git repo"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ -n "$1" ]]; then
|
||||
echo "Invalid command: $1. Try 'cdg --help'."
|
||||
return 1
|
||||
fi
|
||||
|
||||
local root_dir
|
||||
root_dir=$(git rev-parse --show-toplevel 2>/dev/null)
|
||||
local git_status=$?
|
||||
|
||||
if [ $git_status -ne 0 ]; then
|
||||
echo "Error: Not a git repo."
|
||||
return 1
|
||||
fi
|
||||
|
||||
cd "$root_dir"
|
||||
}
|
||||
''
|
||||
Loading…
Add table
Add a link
Reference in a new issue