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/vector: add module #103393
nixos/vector: add module #103393
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi there. Thanks for contributing a new module! I have reviewed your contribution and hope you will find my comments helpful. If you have any questions, or need any help with my comments please let me know.
I haven't got a chance to poke around with your code to understand the error (yet?). If I can find some time I will try.
|
||
in { | ||
options.services.vector = { | ||
enable = mkOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By convention most people use mkEnableOption
here.
''; | ||
}; | ||
|
||
package = mkOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is only one version of vector
packaged in nixpkgs and it has no variation. I can't imagine this option will ever be used.
''; | ||
}; | ||
|
||
configuration = mkOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By convention we generally call this option settings
.
''; | ||
}; | ||
|
||
user = mkOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this option is very useful. Maybe you should remove it.
''; | ||
}; | ||
|
||
group = mkOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
group = cfg.group; | ||
isSystemUser = true; | ||
}; | ||
systemd.services.vector = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should consider using the unit provided by upstream instead.
@aanderse Thanks a lot for your comments! I have tested again after the requested changes and I still get the same configuration error. |
I think the error you're seeing with |
@thoughtpolice amazing, updating the channel fixed the initial problem, thanks! now I get this new error.
After checking at journald, vector should be added in a supplementary group if it wants to access journald data. I thought that might be the problem. I added a feature flag for journaldAccess. However even after trying that, I still run into the same error I checked into the default sources included, and it looks like journald is there I'm not sure why this is happening. I'm open to test things if anybody has ideas. |
@johanot I see that you have been using vector recently. I'm trying to get a service merged to nixos. Have you been using it with journald? |
It looks like the |
@johanot Thanks again for that fix, it enabled us to move to the next step! The next error is the following
After looking a little bit, vector needs to have a writable folder
I'm wondering what is the way to do this usually on nix? Is using the "/var/lib/vector" folder a bad idea? |
|
I had the pleasure of working with a Debian 9 box a couple of days ago, which is not eol until 2022. Unfortunately, Debian 9 ships with systemd 232, and StateDirectory was introduced in systemd 235. Since Vector ships deb-packages, they might simply be trying to be compatible with Debian stable - even though 232 is from 2016 :/. |
@happysalada Good job working on an upstream module! 👍 Have you considered using I do something like this in my private module:
|
@johanot thanks for the validation, great idea! @aanderse thanks for the stateDirectory! Now I don't have any more failures on start. I still have a problem with the file sink though. |
@GrahamcOfBorg build vector |
@aanderse @thoughtpolice I think this is ready to merge when you have a moment. |
@GrahamcOfBorg build eval |
@GrahamcOfBorg eval |
@GrahamcOfBorg eval-nixpkgs-tarball |
@GrahamcOfBorg eval nixpkgs tarball |
@happysalada This looks fine and I'm happy to merge it. Do you think we could add a test for this as well? It would help ensure regressions don't go unnoticed. (If you don't want to add one in this PR so it can just go in, please say so and we can merge it and you can just follow up.) Thanks. |
@thoughtpolice I added a file sink test. Of course if you have other tests in mind, let me know and I can try to create scenarii for them. I couldn't think of something other than the file sink. |
@happysalada Adding yourself as a maintainer in this PR is both allowed and appreciated -- just make it a separate commit :) |
@srhb Thanks for the heads up. I'll squash my commits and will also add myself in a separate commit. |
98d395f
to
627dfec
Compare
@thoughtpolice When you have some time, can you have a look at this again? |
@happysalada Thanks for the ping, this looks good! (I'll go ahead and hit the merge button — I think all of @aanderse's comments have been addressed, just GitHub didn't pick up on them. Thanks again!) |
Motivation for this change
add the vector service on nixos
Things done
I took inspiration from https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/monitoring/loki.nix
Not sure exactly what all the options should be.
I'm testing with the following in my configuration
The corresponding generated vector.toml file looks correct
However I get an error starting up vector
I can't figure out why. I'm currently using a similar vector.toml file with a docker setup and I don't have this error.
@thoughtpolice if you have any thoughts on this, I'm happy to try them.
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)