Skip to content
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

fix(home): shellcheck failure for fixed secretsDir #195

Merged
merged 1 commit into from
Sep 15, 2023

Conversation

Eisfunke
Copy link
Contributor

@Eisfunke Eisfunke commented Sep 9, 2023

If you set secretsDir in the home-manager module to a fixed path containing no env variable, the building of the mount script will fail with shellcheck warnings like these (for /home/eisfunke/.agenix as secretsDir):

In /nix/store/sh4igrd310v01nlfdgw9fw7qb9ck30wm-agenix-home-manager-mount-secrets/bin/agenix-home-manager-mount-secrets line 101:
[ "/home/eisfunke/.agenix/nixNetrc" != "/home/eisfunke/.agenix/nixNetrc" ] && mkdir -p "$(dirname "/home/eisfunke/.agenix/nixNetrc")"
                                    ^-- SC2050 (warning): This expression is constant. Did you forget the $ on a variable?


In /nix/store/sh4igrd310v01nlfdgw9fw7qb9ck30wm-agenix-home-manager-mount-secrets/bin/agenix-home-manager-mount-secrets line 112:
[ "/home/eisfunke/.agenix/nixNetrc" != "/home/eisfunke/.agenix/nixNetrc" ] && ln -sfn "/home/eisfunke/.agenix/nixNetrc" "/home/eisfunke/.agenix/nixNetrc"
                                    ^-- SC2050 (warning): This expression is constant. Did you forget the $ on a variable?

This is a problem as not having an env var in my secretsDir was the entire reason that I modified it at all, because not all applications accept env vars in paths (e.g. my usecase: the Nix config won't resolve the env vars net-rc-file which I want to set to an agenix secret).

Ignoring SC2050 in the corresponding lines in age-home.nix fixed this for me.

@Eisfunke
Copy link
Contributor Author

Eisfunke commented Sep 9, 2023

CI failure seems to be unrelated.

@n8henrie
Copy link
Collaborator

I think this makes sense to silence a useless warning -- that warning just complains that a user is comparing two static strings e.g. if [ "foo" = "bar" ] which normally would be an error, but in our case these strings are being created in the above context by nix and therefore could differ.

@n8henrie n8henrie merged commit da5d6f0 into ryantm:main Sep 15, 2023
1 of 2 checks passed
@Eisfunke
Copy link
Contributor Author

Thank you!

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