Skip to content

nixos/crowdsec: add hub.updateOnStart for hermetic deploys - #586947

Open
SMC17 wants to merge 1 commit into
NixOS:masterfrom
SMC17:crowdsec-hub-update-on-start
Open

SMC17 wants to merge 1 commit into
NixOS:masterfrom
SMC17:crowdsec-hub-update-on-start

Conversation

@SMC17

@SMC17 SMC17 commented Nov 11, 2026 •

Copy link
Copy Markdown

Adds services.crowdsec.hub.updateOnStart (default true) so crowdsec-setup can skip cscli hub update on deployments without internet/DNS access at boot.

The setup script runs `cscli hub update` unconditionally before the
service starts. On hosts without hub access the update fails, the
setup script aborts, and crowdsec never starts (NixOS#520206).

Add `services.crowdsec.hub.updateOnStart` (default true, preserving
current behaviour) so operators of hermetic or air-gapped deployments
can skip the start-time update. The daily autoUpdateService timer is
unchanged.
@nixpkgs-ci nixpkgs-ci Bot added the 12.first-time contribution This PR is the author's first one; please be gentle! label Nov 11, 2026
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Nov 11, 2026
@TornaxO7

Copy link
Copy Markdown
Contributor

The failure combines badly with the
DynamicUser + StateDirectory semantics of the
crowdsec-firewall-bouncer-register service, which migrates
/var/lib/crowdsec → /var/lib/private/crowdsec under the dynamic
user.

What? The crowdsec-firewall-bouncer-register service doesn't use the StateDirectory anymore.

After that migration, (...)

which migration?

This blocks pkgs.testers.nixosTest-based integration testing of
the services.crowdsec module (test VMs have no network by
default) and affects air-gapped / DNS-strict / pre-network-online
deployments in production.

So you mean that you aren't able to run the nixos tests on your machine?

@TornaxO7 TornaxO7 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case if you used AI:
Please don't make the context not more complicated/full than it needs to be. A simple:

Added an option to disable `cscli hub update` for `crowdsec-setup`.

I needed it because on some restricted deployments I don't have internet access
or DNS resolution in the beginning which doesn't let the `crowdsec.service` even start.

would have been enough if I'm understanding your message correctly.

Comment on lines +121 to +125
Whether to run `cscli hub update` in the setup step before the
service starts. Set to `false` for hermetic or air-gapped
deployments where the hub is unreachable: an unconditional
update there fails the setup script and the service never
starts. The daily `autoUpdateService` timer is unaffected.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it needs to add an example for which kind of deployments needs this value.

Suggested change
Whether to run `cscli hub update` in the setup step before the
service starts. Set to `false` for hermetic or air-gapped
deployments where the hub is unreachable: an unconditional
update there fails the setup script and the service never
starts. The daily `autoUpdateService` timer is unaffected.
Set to `false` if `cscli hub update` shouldn't be executed in the setup step before the service starts, otherwise `true`. `services.crowdsec.autoUpdateService` is unaffected by this option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.first-time contribution This PR is the author's first one; please be gentle!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants