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
|
||||
cfg = config.userSettings.git;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
userSettings.git = {
|
||||
enable = lib.mkEnableOption "Enable git";
|
||||
|
|
@ -10,15 +18,25 @@ in {
|
|||
};
|
||||
|
||||
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.userName = config.userSettings.name;
|
||||
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 = {
|
||||
init.defaultBranch = "main";
|
||||
safe.directory = [ osConfig.systemSettings.dotfilesDir
|
||||
safe.directory = [
|
||||
osConfig.systemSettings.dotfilesDir
|
||||
osConfig.systemSettings.secretsFlakeDir
|
||||
(config.home.homeDirectory + "/.cache/nix/tarball-cache") ];
|
||||
(config.home.homeDirectory + "/.cache/nix/tarball-cache")
|
||||
];
|
||||
};
|
||||
programs.git.lfs.enable = true;
|
||||
services.ssh-agent.enable = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue