NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.61k stars 13.09k forks source link

Feature request: vaultwarden: add DATA_FOLDER config variable #289473

Open atemp opened 5 months ago

atemp commented 5 months ago

Issue description

Currently backupDir is configurable but the data folder is not. Is is possible to specify DATA_FOLDER in config but the it is hardcoded in backup-vaultwarden.service to /var/lib/bitwarden_rs.

Feature request

It would be cool to have a e.g. dataFolder config variable that would set DATA_FOLDER in the config and that would be used in the backup service.

Thanks!

dotlambda commented 5 months ago

You should be able to set services.vaultwarden.config.DATA_FOLDER. That will override the value. EDIT: I just see that it wouldn't change the value used in the backup-vaultwarden service. Is that the issue?

atemp commented 5 months ago

I just see that it wouldn't change the value used in the backup-vaultwarden service. Is that the issue?

Yes. Backup wont work if i change that.

stuebinm commented 5 months ago

Hi! I've opened a PR for this a while ago, but unfortunately haven't gotten around do coming back to it yet.

But afaik, all that's missing to make the backup service work as well is setting DATA_FOLDER there as an environment variable, which you can do manually e.g. via systemd.services.backup-vaultwarden.environment.DATA_FOLDER = lib.mkForce "<your value>".

(there's some more intricacies to adding a "nice" automatic option for this, e.g. who creates that directory, how to make sure of it has fitting access rights, etc., which is why that PR isn't done yet)

kylernocturnalnerd commented 1 week ago

This seems to be a bigger problem. The assertion for non-sqlite database backends prevents us from being able to use anything besides sqlite. We're effectively softlocked into sqlite because we can't state that a data folder exists.