44 lines
1.0 KiB
Nix
44 lines
1.0 KiB
Nix
|
{ config, lib, pkgs, inputs, ... }:
|
||
|
let
|
||
|
repo-updater = pkgs.writeShellScriptBin "repo-updater"
|
||
|
(builtins.readFile ../../scripts/gitea/update-repo.sh);
|
||
|
environment = {
|
||
|
XDG_RUNTIME_DIR = "/tmp";
|
||
|
HOME = "/home/nathan";
|
||
|
};
|
||
|
path = with pkgs; [
|
||
|
git
|
||
|
inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.nurl
|
||
|
jq
|
||
|
curl
|
||
|
openssh
|
||
|
bash
|
||
|
nix
|
||
|
];
|
||
|
in {
|
||
|
# Setup hosts for gitea automation
|
||
|
networking.hosts = { "100.99.69.14" = [ "git.stranger.systems" ]; };
|
||
|
# Automate updating rust utility flake
|
||
|
systemd.services."rust-util-update" = {
|
||
|
inherit environment;
|
||
|
inherit path;
|
||
|
script = ''
|
||
|
env
|
||
|
${repo-updater}/bin/repo-updater gitea@git.stranger.systems:nix/Rust.git trunk
|
||
|
'';
|
||
|
serviceConfig = {
|
||
|
Type = "oneshot";
|
||
|
User = "nathan";
|
||
|
Group = "users";
|
||
|
};
|
||
|
};
|
||
|
systemd.timers."rust-util-update" = {
|
||
|
wantedBy = [ "timers.target" ];
|
||
|
partOf = [ "rust-util-update.service" ];
|
||
|
timerConfig = {
|
||
|
OnCalendar = "Mon, 8:00";
|
||
|
Unit = "rust-util-update.service";
|
||
|
};
|
||
|
};
|
||
|
}
|