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

Agenix wrapper errors out for flakes that exist as a subdirectory in a git repository #12

Closed
JustinLex opened this issue Feb 11, 2024 · 2 comments

Comments

@JustinLex
Copy link

My homelab infrastructure monorepo has the "nodes" nix.flake under the nodes/ subdirectory. When I try to run the agenix wrapper in this subdirectory, it dies and gives the error "error: Could not determine location of your project's flake.nix. Please run this at or below your main directory containing the flake.nix." This is happening even though my pwd is the nodes/ directory with the nix.flake in it.

The bug seems to be here:

USER_FLAKE_DIR=$(git rev-parse --show-toplevel 2>/dev/null || pwd) \

USER_FLAKE_DIR is being set to the output of git rev-parse --show-toplevel, which is the parent git repository, not the subdirectory with my flake.

The agenix wrapper should either:

  • try both git toplevel and pwd before dying
    or
  • search for the flake recursively upwards from pwd until it reaches git toplevel
@oddlama
Copy link
Owner

oddlama commented Feb 15, 2024

Sounds good, I can add that when I have some time next month :)

@oddlama
Copy link
Owner

oddlama commented Feb 26, 2024

I've implemented recursive upward search, can you try whether that solves your problem?

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

No branches or pull requests

2 participants