fixes backrest
This commit is contained in:
parent
f158e2c5c6
commit
ba4d09e0ec
1 changed files with 12 additions and 8 deletions
|
|
@ -74,13 +74,17 @@ in
|
||||||
description = "Backrest service user";
|
description = "Backrest service user";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Write the declarative config at activation time.
|
# Write the declarative config into the backrest state dir at activation time.
|
||||||
# The file is owned by root (readable by backrest via group or world-read)
|
# The file must be in a writable location because backrest creates a .bak
|
||||||
# but we set it 640 and add backrest to read it via the service's User=.
|
# alongside it when migrating. /var/lib/backrest is owned by the backrest user.
|
||||||
environment.etc."backrest/config.json" = {
|
system.activationScripts.backrestConfig = {
|
||||||
text = backrestConfig;
|
deps = [ "users" ];
|
||||||
mode = "0440";
|
text = ''
|
||||||
group = "backrest";
|
install -d -m 750 -o backrest -g backrest /var/lib/backrest
|
||||||
|
install -m 640 -o backrest -g backrest \
|
||||||
|
${pkgs.writeText "backrest-config.json" backrestConfig} \
|
||||||
|
/var/lib/backrest/config.json
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.backrest = {
|
systemd.services.backrest = {
|
||||||
|
|
@ -92,7 +96,7 @@ in
|
||||||
environment = {
|
environment = {
|
||||||
BACKREST_PORT = "9004";
|
BACKREST_PORT = "9004";
|
||||||
BACKREST_RESTIC_COMMAND = "${pkgs.restic}/bin/restic";
|
BACKREST_RESTIC_COMMAND = "${pkgs.restic}/bin/restic";
|
||||||
BACKREST_CONFIG = "/etc/backrest/config.json";
|
BACKREST_CONFIG = "/var/lib/backrest/config.json";
|
||||||
BACKREST_DATA = "/var/lib/backrest/data";
|
BACKREST_DATA = "/var/lib/backrest/data";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue