-
-
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
Allow usage of multiple flake files inside a monorepo without updating lock files for relative dependencies #12320
Comments
Relative inputs should no longer do locking. Can you check with 2.26? |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2024-01-22-nix-team-meeting-minutes-210/59239/1 |
Thanks for the answer and sorry I'm stupid and don't know how to use the 2.26 version yet 😓. I'm on version Can you point me to the steps of how to use newer version of nix eg directly from git master or a tag? |
|
Alright I was able to try that:
It will still output this same error even if I remove the lock file and even if I use It doesn't work even when I'm using the earlier Is there something else I should do after using version |
Okay it started to work after I completely removed the
It imports the inner flake properly into the main flake and can use it. But when I modified the I still need to run either:
or override the input with the local path so that it will always read whatever is in the current state:
So even version 2.26 doesn't solve this issue. I can continue using the |
And it seems that I would need to always remove the Otherwise it complains all the time about the unlocked input issue:
I documented my problems better here in the |
Is your feature request related to a problem?
I would want to use flakes inside single git monorepo to define my server and develop services too.
One can learn how to develop and deploy a simple go service following this great blog:
http://mtlynch.io/notes/simple-go-web-service-nixos/
I followed this and then moved the separate go service into:
./services/basic-go-web-app/
inside the git repo which contained the server configs and it'sflake.nix
It's easy to have multiple flakes in single repository and use them with relative paths:
But then what happens automatically is that
flake.lock
will get the initial version of the local project and will not be updated automatically.One needs to rely on hacks like
--override-input basic-go-web-app ./services/basic-go-web-app/
to update the service into the servers.Would there be an easy way to skip relative project from the lock files completely so that the service would always be built and deployed without the
--override-input
flag?Proposed solution
Similarly as we have the special flag
follows
:we could have an option
disable-lock
=true
or even default to this when using relative paths.This is a major headache and confusion for a new users like me.
Alternative solutions
One can use the:
1.
--override-input basic-go-web-app ./services/basic-go-web-app/
as argument to thenixes-rebuild
2. Update the input in
flake.lock
with:nix flake lock --update-input basic-go-web-app
Additional context
Some discussions regarding this:
https://discourse.nixos.org/t/any-examples-for-a-monorepo-to-develop-app-and-deploy-it-to-servers/54798/2
https://discourse.nixos.org/t/relative-path-support-for-nix-flakes/18795/5
Checklist
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: