nix flake templates are not evaluated properly #478
Labels
No labels
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/store
bug
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
imported
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
RFD
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
ux
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/lix#478
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Describe the bug
derivations in flake templates are not properly evaluated?
Steps To Reproduce
Consider the following code:
Calling
nix flake init -t ".#foo"
gives the following error:Expected behavior
The derivation should be actually build so that the path exists.
the template output is not system-specific (unlike for example packages). Also something that doesn't really make sense to me as it should be possible to build templates and building may not be system-agnostic.
Something like
outputs.templates.${system}.foo.path = "${pkgs.hello}"
should be possible i feel likenix-env --version
outputnix-env (Lix, like Nix) 2.90.0
Priorities
Add 👍 to issues you find important.
I've had this discussion on cppnix already and felt like maybe it'd find more tracktion here.
Here's the original issue tho: https://github.com/NixOS/nix/issues/11309
wait the paths are not realized??! holy crap flakes are so broken.
i have a bad solution for you:
builtins.seq (builtins.length (builtins.listDir drv)) drv
, which should force an import-from-derivation build of the thing.anyway, I'm going to mark this as help wanted because i think my current temperature read on the lix team is that fixing bugs in flakes is the least enjoyable activity imaginable so this is most likely to get done if someone else sends a patch.
i will say, i think this is probably a bad idea to fix without changing the schema of flakes because as the cppnix maintainers pointed out, there are no system specific templates. so just fixing this by itself is probably going to inadvertently encourage people to write x86_64-linux only templates.
the more realistic thing to do today is some kind of construction based on nix run, imo.
That's what I will prbly do.
Altho I want to point out that how people are gonna write their templates is not that important imo. I have seen x86_64-linux only packages where the maintainer just didn't use
mkFlake
. The same is gonna happen with templates, no doubt.My plan was to use a tool like
mkFlake
in my templates so that wouldn't make the code significantly more complicated either.