programs/arqbackup: init module (#1474)

This commit is contained in:
Michael Hoang 2025-05-24 15:40:10 +10:00 committed by GitHub
commit acd6aa5a90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 42 additions and 0 deletions

View file

@ -103,6 +103,7 @@
./services/jankyborders
./programs/_1password.nix
./programs/_1password-gui.nix
./programs/arqbackup.nix
./programs/bash
./programs/direnv.nix
./programs/fish.nix

View file

@ -0,0 +1,41 @@
{
config,
pkgs,
lib,
...
}:
let
cfg = config.programs.arqbackup;
in
{
options = {
programs.arqbackup = {
enable = lib.mkEnableOption "Arq backup";
# If `arq` is not available then we set `default` to `null` to prevent
# eval from breaking while `arq` hasn't been merged yet. Only if a user
# enables the module will they be required to set this option.
package = lib.mkPackageOption pkgs "arq" (lib.optionalAttrs (!pkgs ? arq) { default = null; });
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
launchd.daemons.arqagent = {
command = "${cfg.package}/Applications/Arq.app/Contents/Resources/ArqAgent.app/Contents/MacOS/ArqAgent";
serviceConfig.Label = "com.haystacksoftware.arqagent";
serviceConfig.RunAtLoad = true;
serviceConfig.KeepAlive = true;
};
launchd.user.agents.ArqMonitor = {
command = "${cfg.package}/Applications/Arq.app/Contents/Resources/ArqMonitor.app/Contents/MacOS/ArqMonitor";
serviceConfig.Label = "com.haystacksoftware.ArqMonitor";
serviceConfig.RunAtLoad = true;
serviceConfig.KeepAlive = true;
managedBy = "programs.arqbackup.enable";
};
};
}