Comments (4)
Thinking about it some more, I think the IFD would only appear if you are packaging an external source, that is you're using js2nix on a project fetched from GitHub or somethingโin that case you'd need to vendor the yarn.lock.
from js2nix.
Hi @bouk, wow, it looks awesome! ๐
so it can work without having to generate and commit a
yarn.lock.nix
file. This would make the user experience a lot nicer since you'd only have to run yarn update to upgrade a version for example, without having to then runjs2nix
as well
Yeah, this I a really good developer experience I think and the js2nix
supports it already. You might notice that there is yarn.lock.nix
file in this repository and it must be committed into the repository because it is being used to bootstrap the tool itself - dependencies for the js2nix
CLI are provided via the yarn.lock.nix
file + js2nix
Nix library. Other than that, there is no need to commit generated yarn.lock.nix
files for the consumers of this project and the Nix expression can be purely (purity here is a requirement, see project's goals section here) generated on-fly. However, it is possible to manually pre-generate such files, if you want to avoid the Import From Derivation situation for some reason. For more details see the first section here.
The tool was implemented in JS initially for a single reason, to make the PoC asap and iterate over with a reasonable pace. I would love to see it implemented in Nix where possible/reasonable. I am not sure, however, if this is something that can be easily done in Nix language: besides a pure representation of a yarn.lock
file the resulting Nix expression addressed the dependencies cycles problem, described here. I wouldn't have time re-implementing cycles hosting it in Nix somewhen in nearest future, but I would be happy to review and merge this changes.
A potentially interesting aspect of having on-fly yarn.lock
file representation in Nix could be avoid IFD, but as long as any builtins.readFile
operation is considered as IFD it doesn't really make a big difference.
Thanks for sharing your implementation, it's very interesting digging into reading through it!
from js2nix.
Yes exactly, it'd like to avoid IFD whenever possible, performance being the main reason! The readFile would cause an IFD if the yarn.lock file was generated as well, so if you're packaging up your own code that should be fine.
I'll look at the cyclic dependency thing, it should be solvable. But I'm glad you're interested, I'll have to see if I can implement a function that generates the equivalent of the whole yarn.lock.nix file.
from js2nix.
The readFile would cause an IFD if the yarn.lock file was generated as well, so if you're packaging up your own code that should be fine.
Oh, you are right. I read it again and it seems as long as you readFile
not from derivation (f drv
) it should be fine.
Wow, that actually looks exciting if we can remove IFD from this tool. The IFD is not a blocker for us at the moment but it brings some complexity into pipelines and definitely slows down parallel Nix build execution. Thanks for your suggestion, I look forward to getting the change in ๐
from js2nix.
Related Issues (10)
- No `meta.description`
- Syntax error on `yarn.lock` HOT 3
- fysa: `placebo-npm` HOT 1
- Checks don't work for modules HOT 1
- Some sort of peer dependency automation HOT 6
- Packaging a node package using js2nix HOT 2
- Issue building [email protected] HOT 1
- Wire things up in a flake HOT 11
- Happy path to run HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from js2nix.