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

support for subdirectories #49

Merged
merged 3 commits into from
Jul 9, 2024
Merged

support for subdirectories #49

merged 3 commits into from
Jul 9, 2024

Conversation

ajgon
Copy link
Contributor

@ajgon ajgon commented Jul 3, 2024

This PR adds support for flake.nix files not stored in the root of the repository.

I'm aware, that my use-case may be a little bit extra-ordinary, but I maintain one big, gitops monorepo with bunch of stuff separated in different subdirectories (i.e. k8s manifests in k8s, nix flakes in nix etc.). This PR will add support of such cases, by providing option to set up custom subdirectory, while still maintaing compatibility (as the param defaults to ".").

I also tested this branch on my local machine, and no issues so far.

Copy link
Owner

@nlewo nlewo left a comment

Choose a reason for hiding this comment

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

Hello @ajgon!

I agree on the principle but i think the proposed option name could be confusing with the url of the repository (remotes.*.url).

What about flakeSubdirectory (or flakeRelativeDirectory)?

This is the description of this option in the Nix manual:

dir: The subdirectory of the flake in which flake.nix is located. This parameter enables having multiple flakes in a repository or tarball. The default is the root directory of the flake.

(We could also have added this option in remotes.*.flakeSubdirectory but the proposed implementation looks good to me.)

@ajgon
Copy link
Contributor Author

ajgon commented Jul 7, 2024

I agree, repo_dir wasn't a very good name :) I renamed it to flake_subdirectory as suggested, which sounds way better.

Regarding adding this options to remotes.* - I'm not sure if this is a good idea. From what I understood from the code, multiple remotes are generally the same git repository on different locations and is/are cloned to the same directory. Meaning the directory structure remain the same (i.e. they are equivalent of git remote add .....), so this option there wouldn't make much sense (as it has to be the same on each)?

Copy link
Owner

@nlewo nlewo left a comment

Choose a reason for hiding this comment

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

Thanks for the changes.

One last thing: option names should be camelCase in NixOS modules.
Could you rename flake_subdirectory to flakeSubdirectory in the NixOS module?

(Regarding current option names ( such as auth_token_path), I did some mistakes and i plan to rename them.)

@ajgon ajgon requested a review from nlewo July 7, 2024 20:17
@nlewo
Copy link
Owner

nlewo commented Jul 9, 2024

Thank you for your contribution.

@nlewo nlewo merged commit d07e9ef into nlewo:main Jul 9, 2024
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