Move scripts to Nix files
Move the scripts I commonly use into Nix files managed by Home Manager. Some, like `mounter` and `unmounter` are desktop-only, but this can be addressed in a future commit to create per-host scripts or desktop/non-desktop scripts. This commit also removes a number of unused scripts that are either included in packages like `git-extras` or aren't used.
This commit is contained in:
parent
0b437adccc
commit
dfebe131a6
26 changed files with 194 additions and 323 deletions
33
modules/home-manager/cli/scripts/update-all-git-repos.nix
Executable file
33
modules/home-manager/cli/scripts/update-all-git-repos.nix
Executable file
|
@ -0,0 +1,33 @@
|
|||
{ pkgs }:
|
||||
|
||||
pkgs.writeShellApplication {
|
||||
name = "update-all-git-repos";
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
findutils
|
||||
git
|
||||
];
|
||||
|
||||
text = ''
|
||||
# Update all top-level Git repository clones within my Code directories to their
|
||||
# latest version.
|
||||
|
||||
dirs=$(find "$XDG_REPOS_DIR" -mindepth 2 -maxdepth 3 -type d -name .git -not -path '*/*.old/*')
|
||||
|
||||
for dir in $dirs; do
|
||||
repo_path="''${dir%/.git}"
|
||||
|
||||
cd "''${repo_path}"
|
||||
|
||||
# If the repo is a bare clone, the commands need to be run within the
|
||||
# worktree directory.
|
||||
[[ -f .bare/worktrees/main/gitdir && -d main && -f main/.git ]] && cd main
|
||||
|
||||
echo "Updating $(pwd)"
|
||||
|
||||
# Update the repository.
|
||||
git fetch --all --jobs=4 --progress --prune
|
||||
git pull --rebase
|
||||
done
|
||||
'';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue