I am doing some homelab with NixOS only solution
Using flakes, I remotely update NixOS configuration:
From SOURCE desktop to TARGET headless pc. I wrote a systemd service which reads a bash file (/home/alain/dynu-refresh.sh) from TARGET. And this works fine:
{
pkgs,
lib,
config,
...
}:
{
options.services.dynu_refresh = {
enable = lib.mkEnableOption "Enable dynu_refresh";
};
config = lib.mkIf config.services.dynu_refresh.enable {
systemd.services.dynu_refresh = {
enable = true;
description = "adresse dynamique dynu";
after = [
"network.target"
];
environment = {
HOME = "/home/alain";
};
path = [
pkgs.gawk
pkgs.iproute2
pkgs.gnused
pkgs.curl
pkgs.toybox
];
serviceConfig = {
User = "alain";
WorkingDirectory = "/home/alain";
ExecStart = "/run/current-system/sw/bin/sh /home/alain/dynu-refresh.sh";
ExecReload = "/run/current-system/sw/bin/kill $MAINPID";
KillMode = "process";
Restart = "on-failure";
};
wantedBy = [ "multi-user.target" ];
};
};
}
But there is a but, how can I do the same with a bash file read from my SOURCE desktop?
If btw you can improve my module thx !