Hello there,
I would like to create a systemd service that runs the gitlab-rails
executable, but the package is built as a derivation inside the gitlab NixOS module, and I don’t know how to get its nix store’s path. I cannot use pkgs like usually: ${pkgs.gitlab-rails}/bin/gitlab-rails
.
Currently I have to statically use the path /run/current-system/sw/bin/gitlab-rails
.
The goal is to have a timer that automatically postpone user tokens expiration, here is my config (which works):
{
systemd.timers."gitlab-postpone-token-expiration" = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "weekly";
Persistent = true;
Unit = "gitlab-postpone-token-expiration.service";
};
};
systemd.services."gitlab-postpone-token-expiration" = {
script = ''
/run/current-system/sw/bin/gitlab-rails runner "PersonalAccessToken.where(revoked: false, user_id: User.active).where(last_used_at: 3.months.ago...).update_all(expires_at: Time.now + 3.months, expire_notification_delivered: false)"
'';
serviceConfig = {
Type = "oneshot";
User = config.services.gitlab.user;
};
};
}
Is there a better solution than using this static path?
Thanks for the help