Automate updating of the rust util flake
This commit is contained in:
parent
5c2fa7957b
commit
4c08a978e0
|
@ -0,0 +1,43 @@
|
|||
{ 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";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
{ config, lib, pkgs, inputs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ./automation.nix ];
|
||||
# Sops setup for this machine
|
||||
sops.secrets = {
|
||||
"borg-ssh-key" = {
|
||||
|
@ -148,6 +149,9 @@
|
|||
locations."/" = { proxyPass = "http://localhost:8091"; };
|
||||
};
|
||||
|
||||
# Setup hosts for gitea automation
|
||||
networking.hosts = { "100.99.69.14" = [ "git.stranger.systems" ]; };
|
||||
# Configure nix build
|
||||
nix.settings = {
|
||||
cores = 6;
|
||||
max-jobs = 6;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
set -eou pipefail
|
||||
|
||||
TEMP_DIR=$(mktemp -d "repo-updater.XXXX" -p $XDG_RUNTIME_DIR)
|
||||
pushd $TEMP_DIR
|
||||
|
||||
git clone "$1" repo
|
||||
pushd repo
|
||||
git switch $2
|
||||
|
||||
./update.sh
|
||||
|
||||
git add -A
|
||||
if git commit -m "Update flake/dependencies"; then
|
||||
git push -u origin $2
|
||||
else
|
||||
echo "No changes made"
|
||||
fi
|
||||
|
||||
popd
|
||||
popd
|
||||
rm -rf $TEMP_DIR
|
Loading…
Reference in New Issue