nix-managed-macbook/launchd.nix
Abhinav Sarkar 654585217f flake.lock: Update
Flake lock file updates:

• Updated input 'home-manager':
    'github:nix-community/home-manager/4d2d32231797bfa7213ae5e8ac89d25f8caaae82' (2025-04-26)
  → 'github:nix-community/home-manager/1a1793f6d940d22c6e49753548c5b6cb7dc5545d' (2025-05-04)
• Updated input 'nix-darwin':
    'github:LnL7/nix-darwin/43975d782b418ebf4969e9ccba82466728c2851b' (2025-04-12)
  → 'github:LnL7/nix-darwin/760a11c87009155afa0140d55c40e7c336d62d7a' (2025-05-03)
• Updated input 'nix-index-database':
    'github:nix-community/nix-index-database/69716041f881a2af935021c1182ed5b0cc04d40e' (2025-04-20)
  → 'github:nix-community/nix-index-database/137fd2bd726fff343874f85601b51769b48685cc' (2025-05-04)
• Updated input 'nix-vscode-extensions':
    'github:nix-community/nix-vscode-extensions/3ce03dadc2c5976a8f0f08c12d1e391006d7fa55' (2025-04-26)
  → 'github:nix-community/nix-vscode-extensions/5809c8500215e5a46ca2e3469daff8f2c0a80665' (2025-05-04)
• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/507b63021ada5fee621b6ca371c4fca9ca46f52c' (2025-04-23)
  → 'github:nixos/nixpkgs/f21e4546e3ede7ae34d12a84602a22246b31f7e0' (2025-05-03)
• Updated input 'nixpkgs-stable':
    'github:nixos/nixpkgs/86484f6076aac9141df2bfcddbf7dcfce5e0c6bb' (2025-04-12)
  → 'github:nixos/nixpkgs/068169fd59f89a357bc1f227ab75cf90524f2f7c' (2025-05-03)
2025-05-04 21:18:02 +05:30

30 lines
779 B
Nix

{
config,
pkgs,
lib,
...
}:
let
pkg = pkgs.cloudflare-dyndns;
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
${pkg}/bin/cloudflare-dyndns --debug home.abhinavsarkar.net
'';
in
{
launchd.agents.dyndns-updater = lib.optionalAttrs pkgs.stdenv.hostPlatform.isDarwin {
enable = true;
config = {
Program = "${dyndns-updater-script}";
StandardErrorPath = "/tmp/hm-dyndns-updater.log";
StandardOutPath = "/tmp/hm-dyndns-updater.log";
StartInterval = 600;
ProcessType = "Background";
};
};
}