-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/paperless: json-encoded variables viable in unit and manage script #243084
Conversation
Some paperless options (like PAPERLESS_CONSUMER_IGNORES) are taken as JSON-encoded strings. Using regular double-quotes and then using \-quoted double quotes within the JSON string works for the systemd unit but not for the manage command. With this combination we can actually use `toJSON` to write those values without quoting hassle as a regular nix expression. Includes a test that verifies we're getting this right for both ends. Thanks: erikarvsted for even better quoting.
This is a spin-off from #242084 |
Thanks, this is a duplicate of #242275, so I guess we can close this. |
Ouch. Interesting. I'll have to figure out how to do contributions properly. I usually have limited time frames to work on personal stuff and obviously I don't want to waste time duplicating effort. I decided to work on the issues in the original PR from top down instead of filling the whole slot I had with reading it and then not doing anything and having to come back again days later. Seems like that can quickly become a waste of time (not just for me). Maybe extending the tests in the other PR is a valuable addition? |
|
Hmm. I'm not sure I understand. There was a regression in the paperless module that didn't depend on whether toShellVars is broken but the actual integration in paperless was. Shouldn't that be tested now that we caught it in a broken state? |
Not a regression, this was once the intended behavior that got broken for the service env when the module was updated to paperless-ngx. |
Thanks for clarifying. Coming from a "100% test coverage" and "every regression gets a test" background I'm more on the cautious side. Something I can sympathize with is the amount of tests we run in total and reducing test coverage to a "sane minimum" ... |
Some paperless settings (like PAPERLESS_CONSUMER_IGNORES) are taken as JSON-encoded strings. Using regular double-quotes and then using -quoted double quotes within the JSON string works for the systemd unit but not for systemd.
With this combination we can actually use
toJSON
to write those values without quoting hassle as a regular nix expression.Includes a test that verifies we're getting this right for both ends.
Thanks: erikarvsted for even better quoting.
Description of changes
Improve quoting and add a test.
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)