mirror of
https://github.com/librephoenix/nixos-config
synced 2025-11-30 14:43:59 +05:30
git change-commits helper script
This commit is contained in:
parent
27889b597f
commit
d6656137cb
1 changed files with 24 additions and 6 deletions
|
|
@ -1,8 +1,16 @@
|
||||||
{ config, lib, pkgs, pkgs-stable, osConfig, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
pkgs-stable,
|
||||||
|
osConfig,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.userSettings.git;
|
cfg = config.userSettings.git;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options = {
|
options = {
|
||||||
userSettings.git = {
|
userSettings.git = {
|
||||||
enable = lib.mkEnableOption "Enable git";
|
enable = lib.mkEnableOption "Enable git";
|
||||||
|
|
@ -10,15 +18,25 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
home.packages = [ pkgs.git pkgs-stable.openssh ];
|
home.packages = [
|
||||||
|
pkgs.git
|
||||||
|
pkgs.git-extras
|
||||||
|
pkgs.git-filter-repo
|
||||||
|
pkgs-stable.openssh
|
||||||
|
];
|
||||||
programs.git.enable = true;
|
programs.git.enable = true;
|
||||||
programs.git.userName = config.userSettings.name;
|
programs.git.userName = config.userSettings.name;
|
||||||
programs.git.userEmail = config.userSettings.email;
|
programs.git.userEmail = config.userSettings.email;
|
||||||
|
programs.git.aliases = {
|
||||||
|
change-commits = ''!f() { VAR=$1; OLD=$2; NEW=$3; shift 3; FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch --env-filter "if [[ \"$`echo $VAR`\" = '$OLD' ]]; then export $VAR='$NEW'; fi" $@; }; f'';
|
||||||
|
};
|
||||||
programs.git.extraConfig = {
|
programs.git.extraConfig = {
|
||||||
init.defaultBranch = "main";
|
init.defaultBranch = "main";
|
||||||
safe.directory = [ osConfig.systemSettings.dotfilesDir
|
safe.directory = [
|
||||||
|
osConfig.systemSettings.dotfilesDir
|
||||||
osConfig.systemSettings.secretsFlakeDir
|
osConfig.systemSettings.secretsFlakeDir
|
||||||
(config.home.homeDirectory + "/.cache/nix/tarball-cache") ];
|
(config.home.homeDirectory + "/.cache/nix/tarball-cache")
|
||||||
|
];
|
||||||
};
|
};
|
||||||
programs.git.lfs.enable = true;
|
programs.git.lfs.enable = true;
|
||||||
services.ssh-agent.enable = true;
|
services.ssh-agent.enable = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue