Skip to content

Fix completions & cscli setup & prometheus#7

Merged
TornaxO7 merged 7 commits intoTornaxO7:crowdsecfrom
gaelj:fix-completions
Feb 18, 2026
Merged

Fix completions & cscli setup & prometheus#7
TornaxO7 merged 7 commits intoTornaxO7:crowdsecfrom
gaelj:fix-completions

Conversation

@gaelj
Copy link

@gaelj gaelj commented Feb 14, 2026

A new round of fixes for NixOS#446307

Additional config dirs / files added inspired by https://github.com/crowdsecurity/crowdsec/blob/356d3111dda77b75e4531c47c6574dbf77f2e433/build/debian/rules

I started playing with prometheus and noticed it requires prometheus.enabled = true, so let's add it as an option for clarity.

The patterns config dir, IMO is better to overwrite on each setup, in case upstream modified them after an update.

Completions: use sudo su subshell to workaround password prompt on each tab. The first level of completions are duplicated:

image

But from the 2nd level it looks fine:

image

Not sure how to fix this...

@gaelj
Copy link
Author

gaelj commented Feb 15, 2026

2 commits added, following latest comments in the PR thread

Comment on lines +861 to +866
(pkgs.runCommand "cscli-completions" { } ''
mkdir -p $out/share
ln -s ${cfg.package}/share/bash-completion $out/share/bash-completion
ln -s ${cfg.package}/share/zsh $out/share/zsh
ln -s ${cfg.package}/share/fish $out/share/fish
'')
Copy link
Owner

Choose a reason for hiding this comment

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

Am I understanding this correctly that this also fixes the cscli autocompletion for the different shells? 👀

Copy link
Author

Choose a reason for hiding this comment

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

Yes that is the purpose of this subset of the change. As already mentioned, it's not perfect because systemd will ask for password on each tab press unless in a sudo su shell. Also nearly all entries (not all though, interestingly) in the first level (subcommands) show up duplicated, on zsh (which is customized to pipe suggestions in fzf). Bash is fine. Fish, I haven't tested as I don't use it.

Copy link
Owner

Choose a reason for hiding this comment

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

Hm... have you tried to add your user to the crowdsec group? Maybe this helps a bit since the service is running as that user.

@gaelj
Copy link
Author

gaelj commented Feb 16, 2026

Just a sec... After some more testing I'm getting


       >        … while evaluating the attribute 'description'
       >          at /nix/store/9nc6m5bxsgxldq8jv059p1m676fd0323-source/nixos/modules/services/security/crowdsec.nix:331:23:
       >           330|                       example = "${config_paths.data_dir}/online_api_credentials.yaml";
       >           331|                       description = "Path to a file containing credentials for the Central API. To automatically register with `crowdsec-setup`, set this option (typically to ${config_paths.data_dir}/online_api_credentials.yaml). The file will be automatically created.";
       >              |                       ^
       >           332|                     };
       >
       >        error: attribute 'services' missing
       >        at /nix/store/9nc6m5bxsgxldq8jv059p1m676fd0323-source/nixos/modules/services/security/crowdsec.nix:8:9:
       >             7| let
       >             8|   cfg = config.services.crowdsec;
       >              |         ^
       >             9|   yaml = pkgs.formats.yaml { };

let me fix this

Copy link
Owner

@TornaxO7 TornaxO7 left a comment

Choose a reason for hiding this comment

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

I'll merge this for now.

@TornaxO7
Copy link
Owner

Thank you!

@TornaxO7 TornaxO7 merged commit e3dabca into TornaxO7:crowdsec Feb 18, 2026
23 of 25 checks passed
@gaelj gaelj deleted the fix-completions branch February 20, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants