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, ... }:
|
||||||
|
|
||||||
{
|
let binDir = "${config.home.profileDirectory}/bin";
|
||||||
launchd.agents.dyndns-updater = {
|
in {
|
||||||
|
launchd.agents.dyndns-updater = lib.optionalAttrs pkgs.stdenv.hostPlatform.isDarwin {
|
||||||
enable = true;
|
enable = true;
|
||||||
config = {
|
config = {
|
||||||
Program = "${pkgs.cloudflare-dyndns}/bin/cloudflare-dyndns";
|
Program = "${pkgs.cloudflare-dyndns}/bin/cloudflare-dyndns";
|
||||||
|
@ -12,10 +13,34 @@
|
||||||
"--debug"
|
"--debug"
|
||||||
"home.abhinavsarkar.net"
|
"home.abhinavsarkar.net"
|
||||||
];
|
];
|
||||||
StandardErrorPath = "/tmp/cloudflare-dyndns.log";
|
StandardErrorPath = "/tmp/hm-dyndns-updater.log";
|
||||||
StandardOutPath = "/tmp/cloudflare-dyndns.log";
|
StandardOutPath = "/tmp/hm-dyndns-updater.log";
|
||||||
StartInterval = 600;
|
StartInterval = 600;
|
||||||
ProcessType = "Background";
|
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 ];
|
imports = [ ./fish.nix ./git.nix ];
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
|
bash
|
||||||
broot
|
broot
|
||||||
cloc
|
cloc
|
||||||
cloudflare-dyndns
|
cloudflare-dyndns
|
||||||
|
|
Loading…
Reference in New Issue