Files
nix-config/modules/nixos/services/restic/default.nix
2025-12-19 14:06:18 -06:00

33 lines
723 B
Nix

{
config,
lib,
namespace,
...
}:
with lib;
let
name = "restic";
cfg = config.${namespace}.services.${name};
resticConfig = lib.${namespace}.mkModule {
inherit config name;
serviceName = "${name}-rest-server";
description = "restic";
options = { };
moduleConfig = {
# Configure the standard NixOS restic server service
services.restic.server = {
enable = true;
dataDir = "${cfg.dataDir}/backup/restic";
prometheus = true;
listenAddress = "${cfg.listenAddress}:${toString cfg.port}";
htpasswd-file = "${cfg.dataDir}/backup/restic/.htpasswd";
extraFlags = [ "--no-auth" ];
};
};
};
in
{
imports = [ resticConfig ];
}