mirror of
https://github.com/vale981/phoebe
synced 2025-03-04 09:21:40 -05:00
rsync: Correctly support using a non-default local user account
Prior to this commit if the local user name was changed but the group was left at the default then neither the user nor group was created. This resulted in a failed `chown'.
This commit is contained in:
parent
899b1db967
commit
374abe15ca
2 changed files with 8 additions and 3 deletions
|
@ -5,7 +5,6 @@ let
|
|||
cfg = config.phoebe.backup.rsync;
|
||||
cdir = config.phoebe.backup.directory;
|
||||
plib = config.phoebe.lib;
|
||||
user = "backup";
|
||||
port = builtins.head config.services.openssh.ports;
|
||||
scripts = (import ../../pkgs/default.nix { inherit pkgs; }).backup-scripts;
|
||||
|
||||
|
@ -157,7 +156,7 @@ in
|
|||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = user;
|
||||
default = config.phoebe.backup.user.name;
|
||||
description = "User to perform backups as.";
|
||||
};
|
||||
|
||||
|
@ -176,7 +175,12 @@ in
|
|||
|
||||
#### Implementation
|
||||
config = mkIf cfg.enable {
|
||||
phoebe.backup.user.enable = cfg.user == user;
|
||||
# Create user/group if necessary:
|
||||
phoebe.backup.user.enable =
|
||||
let user = config.phoebe.backup.user.name;
|
||||
group = config.phoebe.backup.user.group;
|
||||
in cfg.user == user || cfg.group == group;
|
||||
|
||||
systemd.services = toSystemd service;
|
||||
systemd.timers = toSystemd timer;
|
||||
};
|
||||
|
|
|
@ -20,6 +20,7 @@ pkgs.nixosTest {
|
|||
|
||||
phoebe.backup.rsync = {
|
||||
enable = true;
|
||||
user = "root";
|
||||
schedules = [
|
||||
{ host = "localhost";
|
||||
directory = "/tmp/backup";
|
||||
|
|
Loading…
Add table
Reference in a new issue