Set devshell subflake inputs to track parent flake inputs#445
Set devshell subflake inputs to track parent flake inputs#445astratagem wants to merge 4 commits into
Conversation
| main.url = "path:../."; | ||
|
|
||
| # Inherited inputs | ||
| nixpkgs.follows = "main/nixpkgs"; |
There was a problem hiding this comment.
do we really need a nixpkgs that follow the main one?
In my reasoning we rather want uncoupled up-to-date tooling for the devshell.
Was your reasoning to increase cache hits?
There was a problem hiding this comment.
The immediate reason was an error running nix develop --update-input main './devshell#default' --command evalnix on darwin in #438. nixpkgs-unstable breaks on darwin hosts regularly.
In my reasoning we rather want uncoupled up-to-date tooling for the devshell.
That's a good point, and for that reason I tend to use overlays like in https://github.com/divnix/digga/blob/main/examples/devos/overlays/overrides.nix – but that seems to me like it would be better to leave that decision to the user to handle.
AFAIK digga doesn't currently force users to depend on nixpkgs-unstable at all, so this is a pretty significant change. Adding nixpkgs-unstable in a subflake effectively hides that away, especially without documentation.
For reference, here's the error I got on darwin, caused by std's chicken dependency:
❯ nix develop --update-input main './devshell#default' --command evalnix
warning: Git tree '/Users/montchr/Developer/contrib/divnix/digga' is dirty
warning: updating lock file '/Users/montchr/Developer/contrib/divnix/digga/devshell/flake.lock':
• Updated input 'main':
'path:../.?narHash=sha256-DSQeol3hCIM0ZaSAebmrLHnXcszDy9XScIOCHwEjY6c='
→ 'path:../.?narHash=sha256-9az30Kwl1hiEgi5WloHRE9NUIkCR5CcpHaSE0WJbyAw='
• Added input 'main/darwin':
'github:montchr/nix-darwin/3bb62d40a2ef5c7c1b5634c58c47dd4a239d7618' (2022-02-28)
• Added input 'main/darwin/nixpkgs':
follows 'main/latest'
• Updated input 'main/std':
'github:divnix/std/133fb0c1cc8d0d477a3d339971ef09fa57a60fd3' (2022-03-14)
→ 'github:montchr/std/d6390c705cd8c0c583b95dec77a9c493afd34e19' (2022-03-29)
• Updated input 'main/std/nixpkgs':
'github:nixos/nixpkgs/3eb07eeafb52bcbf02ce800f032f18d666a9498d' (2022-03-15)
→ 'github:nixos/nixpkgs/30d3d79b7d3607d56546dd2a6b49e156ba0ec634' (2022-03-25)
warning: Git tree '/Users/montchr/Developer/contrib/divnix/digga' is dirty
error: builder for '/nix/store/1lw7b3489as9bniipw27yg687c7ykig8-chicken-5.3.0.drv' failed with exit code 2;
last 10 log lines:
> (PASS) (repository-path) contains something by default
> TOTALS:
> 1 tests completed in 0.026 seconds
> 1 (100.00%) tests passed
> 0 (0.00%) tests failed
> /usr/bin/env DYLD_LIBRARY_PATH='/private/tmp/nix-build-chicken-5.3.0.drv-0/chicken-5.3.0/tests/..' /private/tmp/nix-build-chicken-5.3.0.drv-0/chicken-5.3.0/tests/../chicken 'sample-module.scm' -output-file 'sample-module.c' -dynamic -feature chicken-compile-shared -verbose -include-path /private/tmp/nix-build-chicken-5.3.0.drv-0/chicken-5.3.0/tests/.. -consult-types-file ../types.db -ignore-repository -emit-import-library sample-module
> sh: /usr/bin/env: Operation not permitted
>
> Error: shell command terminated with non-zero exit status 32256: /usr/bin/env DYLD_LIBRARY_PATH='/private/tmp/nix-build-chicken-5.3.0.drv-0/chicken-5.3.0/tests/..' /private/tmp/nix-build-chicken-5.3.0.drv-0/chicken-5.3.0/tests/../chicken 'sample-module.scm' -output-file 'sample-module.c' -dynamic -feature chicken-compile-shared -verbose -include-path /private/tmp/nix-build-chicken-5.3.0.drv-0/chicken-5.3.0/tests/.. -consult-types-file ../types.db -ignore-repository -emit-import-library sample-module
> make: *** [rules.make:1015: check] Error 1
For full logs, run 'nix log /nix/store/1lw7b3489as9bniipw27yg687c7ykig8-chicken-5.3.0.drv'.
error: 1 dependencies of derivation '/nix/store/fy6anzg4kg985qdsy52ll66mfy9v530n-chicken-5.3.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/15kf3wl5apajs7lvs29542i9w1zhqx8g-std.drv' failed to build
error: 1 dependencies of derivation '/nix/store/2dn2003ccgl8y3iccw68f7flgnmhq29a-devshell-dir.drv' failed to build
error: 1 dependencies of derivation '/nix/store/0696if0xfc8l0ac355lahfvbd57ckj2x-Digga-formerly-DevOS--env.drv' failed to build
There was a problem hiding this comment.
Interesting!
I didn't have this mac compatibility issues with unstable on the screen.
Each invokation of an overlay recalculates the nixpkgs fix-point which adds 130MB roughly of RAM requirement.
They also obfuscate cache potential hits due to the changes fixed point.
It might also be that the original package wasn't built for the different nixpkgs api.
So I'm trying to reduce my use of overlays.
After all, if this increases compatibility, then I'm happy.
| devShells.default = devshell.legacyPackages.mkShell ( | ||
| {extraModulesPath, ...}: { | ||
| name = "Digga (formerly DevOS)"; | ||
| name = "digga-fka-devos"; |
There was a problem hiding this comment.
this is due to an old version of devshell 😄. I bothered to do a fix a while ago upstream.
|
divnix/std#47 is merged, does this need bumping? |
|
Closing in favor of #444 |
Addresses a few issues with the std input and devshell subflake I ran into on macOS while testing #438.
Depends on divnix/std#47