DrSensor / modern-nix-templates

Modern nix flake templates that only use both fastest and leanest toolchains
BSD Zero Clause License
0 stars 0 forks source link

Add git related configuration in the λ`developWorkflow` #18

Open DrSensor opened 3 years ago

DrSensor commented 3 years ago

I need it to simplify this. Also, gron can be useful to fed the nix attributes (e.g git.config = {...};) into git config command by converting it to JSON first then use gron to flatten it.

Example usage

developWorkflow {
  git.config = {
    commit.gpgsign = true;
    tag.gpgsign = true;
  };
  git.remote = {
    upstream = "git@upstream.site:username/repo";
    all.push = [ "git@upstream.site:username/repo" "git@origin.site:username/repo" ];
  };

  # pull/fetch each time entering `nix develop` mode
  git.autosync = true; # auto fetch/pull all branches and submodules from default remote
  git.autosync.branches = true; # auto fetch/pull all branches from default remote
  git.autosync.branches = [ "main" "nick/feature" ]; # auto fetch/pull "main" and "nick/feature" branches from default remote
  git.autosync.branches.main = "upstream/trunk"; # auto fetch/pull "main" branch from remote "upstream" on branch "trunk"
  git.autosync.branches."nick/feature" = true; # auto fetch/pull "nick/feature" branch from default remote
  git.autosync.submodules = true; # auto fetch/pull all submodules
  git.autosync.submodules = [ "tensorflow" "intel-mkl" ]; # auto fetch/pull "tensorflow" and "intel-mkl" submodules
  # TODO: define how to recursive update on specific submodules. Does granular recursive update needed? 🤔
}