Adds launchd agent for auto-updating programs
parent
336545a3f8
commit
86a4946e2d
35
launchd.nix
35
launchd.nix
|
@ -1,7 +1,8 @@
|
|||
{ config, pkgs, ... }:
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
launchd.agents.dyndns-updater = {
|
||||
let binDir = "${config.home.profileDirectory}/bin";
|
||||
in {
|
||||
launchd.agents.dyndns-updater = lib.optionalAttrs pkgs.stdenv.hostPlatform.isDarwin {
|
||||
enable = true;
|
||||
config = {
|
||||
Program = "${pkgs.cloudflare-dyndns}/bin/cloudflare-dyndns";
|
||||
|
@ -12,10 +13,34 @@
|
|||
"--debug"
|
||||
"home.abhinavsarkar.net"
|
||||
];
|
||||
StandardErrorPath = "/tmp/cloudflare-dyndns.log";
|
||||
StandardOutPath = "/tmp/cloudflare-dyndns.log";
|
||||
StandardErrorPath = "/tmp/hm-dyndns-updater.log";
|
||||
StandardOutPath = "/tmp/hm-dyndns-updater.log";
|
||||
StartInterval = 600;
|
||||
ProcessType = "Background";
|
||||
};
|
||||
};
|
||||
|
||||
launchd.agents.program-updater = lib.optionalAttrs pkgs.stdenv.hostPlatform.isDarwin {
|
||||
enable = true;
|
||||
config = {
|
||||
Program = "${binDir}/bash";
|
||||
ProgramArguments = [
|
||||
"${binDir}/bash"
|
||||
"-c"
|
||||
''echo && date && \
|
||||
export PATH="${binDir}:$PATH" && echo $PATH && \
|
||||
nix-channel --update && \
|
||||
home-manager switch &&
|
||||
nix-collect-garbage -d --delete-old
|
||||
''
|
||||
];
|
||||
StandardErrorPath = "/tmp/hm-program-updater.log";
|
||||
StandardOutPath = "/tmp/hm-program-updater.log";
|
||||
StartCalendarInterval = [{
|
||||
Hour = 10;
|
||||
Minute = 30;
|
||||
}];
|
||||
ProcessType = "Background";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
imports = [ ./fish.nix ./git.nix ];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
bash
|
||||
broot
|
||||
cloc
|
||||
cloudflare-dyndns
|
||||
|
|
Loading…
Reference in New Issue