Skip to content

Commit

Permalink
Enable git maintenance for nix repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
rake5k committed Jun 25, 2024
1 parent 09ebd19 commit 9a7d1c0
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions home/users/christian/git/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ in
ss = "status -s";
};

extraConfig = {
maintenance.repo = [
"${config.home.homeDirectory}/.nix-config"
"${config.home.homeDirectory}/code/nixcfg"
];
};

ignores = [
# Taken from https://github.com/github/gitignore

Expand Down Expand Up @@ -365,5 +372,66 @@ in
"*.vsix"
];
};

systemd.user = {
services = {
"git-maintenance@" = {
Unit = {
Description = "Optimize Git repositories data";
};
Service = {
Type = "oneshot";
ExecStart = "\"${pkgs.git}/libexec/git-core/git\" --exec-path=\"${pkgs.git}/libexec/git-core\" for-each-repo --config=maintenance.repo maintenance run --schedule=%i";
LockPersonality = "yes";
MemoryDenyWriteExecute = "yes";
NoNewPrivileges = "yes";
RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6 AF_VSOCK";
RestrictNamespaces = "yes";
RestrictRealtime = "yes";
RestrictSUIDSGID = "yes";
SystemCallArchitectures = "native";
SystemCallFilter = "@system-service";
};
};
};
timers = {
"git-maintenance@daily" = {
Unit = {
Description = "Optimize Git repositories data";
};
Timer = {
OnCalendar = "Tue..Sun *-*-* 0:27:00";
Persistent = "true";
};
Install = {
WantedBy = [ "timers.target" ];
};
};
"git-maintenance@hourly" = {
Unit = {
Description = "Optimize Git repositories data";
};
Timer = {
OnCalendar = "*-*-* 1..23:27:00";
Persistent = "true";
};
Install = {
WantedBy = [ "timers.target" ];
};
};
"git-maintenance@weekly" = {
Unit = {
Description = "Optimize Git repositories data";
};
Timer = {
OnCalendar = "Mon 0:27:00";
Persistent = "true";
};
Install = {
WantedBy = [ "timers.target" ];
};
};
};
};
};
}

0 comments on commit 9a7d1c0

Please sign in to comment.