nix-managed-macbook/launchd.nix

23 lines
758 B
Nix
Raw Normal View History

{ config, pkgs, lib, ... }:
2022-09-27 13:08:52 +05:30
let
binPath = "${pkgs.coreutils-full}/bin";
dyndns-updater-script = pkgs.writeScript "dyndns-updater" ''
#!${pkgs.bash}/bin/bash
export CLOUDFLARE_API_TOKEN=`${binPath}/cat ${config.xdg.configHome}/.cloudflare_dns_updater_api_token`
${binPath}/echo && ${binPath}/date
${pkgs.cloudflare-dyndns}/bin/cloudflare-dyndns --debug home.abhinavsarkar.net
'';
in {
launchd.agents.dyndns-updater = lib.optionalAttrs pkgs.stdenv.hostPlatform.isDarwin {
2022-09-27 13:08:52 +05:30
enable = true;
config = {
Program = "${dyndns-updater-script}";
StandardErrorPath = "/tmp/hm-dyndns-updater.log";
StandardOutPath = "/tmp/hm-dyndns-updater.log";
2022-09-27 13:08:52 +05:30
StartInterval = 600;
ProcessType = "Background";
};
};
}