-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Optional flake inputs #7205
Comments
This might be a good thing to put through the RFC process. It certainly has a lot of edges that would need to be ironed out. Though, for your use case today it may make sense to set the input to an empty repository by default and then use |
That sounds like a great idea. Thanks for the suggestion.
Interesting. Is there a standard way to point to an empty repository (e.g. |
@RyanGibb I don't believe there's a built-in way. However, you could do something like use a subdirectory of your flake or push up an super bare flake repo. I would probably opt for the second so you can do something like: {
inputs = {
secret-stuff.url = "github:ryangibb/empty";
};
} That would probably be the cleanest way given the current constraints. Would still be worth bringing up in an RFC if you're interested. I know that I've thought about trying to use private modules in my public flake, but haven't actually tried due to current limitations. |
Thanks, @jakehamilton ! I'll have a go at creating an RFC |
So I've tried overriding an empty flake input, but it doesn't seem to work:
|
But both of these succeed:
|
Instead of hacking something into flake inputs, could this easily be handled in nix code that the part that requires private code is optional? |
I suppose we could possibly write a derivation that is optional, but then we lose the advantages flakes give us for composing projects, like updating the git revision easily. |
Ah-ha! This was failing because I had |
People that do not have access to the private repo can't update it but it should otherwise work because flakes should be downloaded lazy. |
Okay this commit adds this for the repo that takes the private repo as an input: https://github.com/RyanGibb/gibbr.org/commit/86403e25363a391a1033bbdb7e83c16044268a2e And this commit overrides the private input when deploying it on a NixOS system: RyanGibb/nixos@9d13ca8 |
Oh I see, let me try this. |
The only thing is, how can we pass a flag to enable using the private repo? At the moment I'm checking whether or not to use the private repo flake based on if it contains a |
#2861 made me realise we can effectively pass an argument by targeting a different derivation: https://github.com/RyanGibb/gibbr.org/commit/a899ee6ca403ce6f71cfbcb20a647bde79652bef. I think this closes the issue. Thanks @SuperSandro2000! |
E.g.
Use case: I have a private flake input that prevents someone else building the project. However this forms only a small part of the larger project. It would be good for anyone to be able to build the rest without having to access the private input.
The text was updated successfully, but these errors were encountered: