Re-configure dev-commit
This commit is contained in:
parent
f48b81ecea
commit
3e7bf2721f
4 changed files with 45 additions and 9 deletions
|
@ -56,8 +56,6 @@
|
||||||
|
|
||||||
systemd.user = lib.mkIf cfg.schedule.enable {
|
systemd.user = lib.mkIf cfg.schedule.enable {
|
||||||
services.dev-commit = {
|
services.dev-commit = {
|
||||||
Install.WantedBy = [ "default.target" ];
|
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
Environment = [ "DEV_COMMIT_PATHS=${repoPaths}" ];
|
Environment = [ "DEV_COMMIT_PATHS=${repoPaths}" ];
|
||||||
ExecStart = "${lib.getExe pkgs.dev-commit}";
|
ExecStart = "${lib.getExe pkgs.dev-commit}";
|
||||||
|
|
20
modules2/hosts/t480/dev-commit.nix
Normal file
20
modules2/hosts/t480/dev-commit.nix
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{ config, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
flake.modules.nixos."nixosConfigurations/t480".home-manager.users.${config.flake.meta.owner.username} =
|
||||||
|
hmArgs: {
|
||||||
|
programs.dev-commit.schedule.enable = true;
|
||||||
|
programs.dev-commit.schedule.time = "daily";
|
||||||
|
|
||||||
|
programs.dev-commit.repoPaths =
|
||||||
|
let
|
||||||
|
repos = "${hmArgs.config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/forgejo/opdavies";
|
||||||
|
in
|
||||||
|
[
|
||||||
|
"${repos}/email-filters"
|
||||||
|
"${repos}/nix-config"
|
||||||
|
"${repos}/oliverdavies.uk"
|
||||||
|
"${repos}/opentofu-dns"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,3 +1,5 @@
|
||||||
{
|
{
|
||||||
flake.modules.homeManager.base.programs.zsh.dotDir = ".config/zsh";
|
flake.modules.homeManager.base = {
|
||||||
|
programs.zsh.dotDir = ".config/zsh";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ pkgs.writeShellApplication {
|
||||||
runtimeInputs = with pkgs; [
|
runtimeInputs = with pkgs; [
|
||||||
coreutils
|
coreutils
|
||||||
git
|
git
|
||||||
|
logger
|
||||||
openssh
|
openssh
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -13,14 +14,29 @@ pkgs.writeShellApplication {
|
||||||
IFS=':' read -ra repos <<< "$DEV_COMMIT_PATHS"
|
IFS=':' read -ra repos <<< "$DEV_COMMIT_PATHS"
|
||||||
|
|
||||||
for repo in "''${repos[@]}"; do
|
for repo in "''${repos[@]}"; do
|
||||||
echo "Processing $repo"
|
logger "Processing repository: $repo"
|
||||||
pushd "$repo"
|
|
||||||
|
pushd "$repo" > /dev/null 2>&1
|
||||||
|
|
||||||
|
if [[ -n $(git status --porcelain) ]]; then
|
||||||
|
logger "Changes detected in $repo"
|
||||||
|
|
||||||
|
git status --short | while read -r line; do
|
||||||
|
logger "Changed file: $line"
|
||||||
|
done
|
||||||
|
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Automated dev commit" || true
|
|
||||||
git push
|
|
||||||
|
|
||||||
popd
|
if git commit -m "Automated dev commit"; then
|
||||||
|
logger "Commit successful in $repo"
|
||||||
|
else
|
||||||
|
logger "No changes to commit in $repo"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
logger "No changes in $repo"
|
||||||
|
fi
|
||||||
|
|
||||||
|
popd > /dev/null 2>&1
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue