mirror of
https://github.com/Death916/nixconfig.git
synced 2026-04-10 02:54:39 -07:00
kopia-server
This commit is contained in:
parent
8de87d3028
commit
a8a2b6bde8
2 changed files with 48 additions and 4 deletions
44
modules/containers/kopia-server.nix
Normal file
44
modules/containers/kopia-server.nix
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
# All settings are defined here for easy editing
|
||||
secretsFile = "/etc/nixos/secrets/kopia.env";
|
||||
#tlsCert = "/home/death916/certs/pimox.bandicoot-skate.ts.net.crt";
|
||||
#tlsKey = "/home/death916/certs/pimox.bandicoot-skate.ts.net.key";
|
||||
listenAddress = "0.0.0.0:51515";
|
||||
dataDir = "/var/lib/kopia";
|
||||
in
|
||||
{
|
||||
options.services.kopia-server.enable = lib.mkEnableOption "Self-contained Kopia Server";
|
||||
|
||||
config = lib.mkIf config.services.kopia-server.enable {
|
||||
systemd.services.kopia = {
|
||||
description = "Kopia Backup Server";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
|
||||
environment = {
|
||||
KOPIA_CONFIG_PATH = "${dataDir}/repository.config";
|
||||
KOPIA_LOG_DIR = "${dataDir}/logs";
|
||||
KOPIA_CACHE_DIRECTORY = "${dataDir}/cache";
|
||||
};
|
||||
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
User = "root";
|
||||
EnvironmentFile = secretsFile;
|
||||
ExecStart = ''
|
||||
${pkgs.kopia}/bin/kopia server start \
|
||||
--disable-csrf-token-checks \
|
||||
--address=${listenAddress}
|
||||
# --tls-cert-file=${tlsCert} \
|
||||
# --tls-key-file=${tlsKey}
|
||||
'';
|
||||
Restart = "on-failure";
|
||||
ReadWritePaths = [ dataDir ];
|
||||
};
|
||||
|
||||
preStart = "mkdir -p ${dataDir}";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -14,10 +14,10 @@
|
|||
../modules/nixos/common/base.nix
|
||||
../modules/nixos/homelab/user.nix
|
||||
../modules/nixos/common/tailscale.nix
|
||||
# ../modules/containers/kopia.nix
|
||||
../modules/containers/kopia-server.nix
|
||||
];
|
||||
|
||||
# config = {
|
||||
# services.kopia.enable = true;
|
||||
#};
|
||||
config = {
|
||||
services.kopia-server.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue