Btrbk: Difference between revisions

Onny (talk | contribs)
No edit summary
Remove redundant sudo rules since the NixOS module for btrbk already has those rules (https://github.com/NixOS/nixpkgs/blob/5630cf13cceac06cefe9fc607e8dfa8fb342dde3/nixos/modules/services/backup/btrbk.nix#L66)
Tags: Mobile edit Mobile web edit
Line 46: Line 46:
   };
   };
};
};
</nowiki>}}
The user has to be created on the remote host and needs root permissions on the commands <code>btrfs</code>, <code>readlink</code> and <code>test</code>, for example via [[sudo]]. For transport stream compression using <code>lz4</code> to work, the package must also be installed on the target host. The target host configuration for Btrbk could look like this:
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
security.sudo = {
  enable = true;
  extraRules = [{
    commands = [
      {
        command = "${pkgs.coreutils-full}/bin/test";
        options = [ "NOPASSWD" ];
      }
      {
        command = "${pkgs.coreutils-full}/bin/readlink";
        options = [ "NOPASSWD" ];
      }
      {
        command = "${pkgs.btrfs-progs}/bin/btrfs";
        options = [ "NOPASSWD" ];
      }
    ];
    users = [ "btrbk" ];
  }];
  extraConfig = with pkgs; ''
    Defaults:picloud secure_path="${lib.makeBinPath [
      btrfs-progs coreutils-full
    ]}:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin"
  '';
};
environment.systemPackages = [ pkgs.lz4 ];
</nowiki>}}
</nowiki>}}