-
Notifications
You must be signed in to change notification settings - Fork 77
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
niv status, sources discovery and niv init templates #272
Comments
Love it, more opinionation is always good in this kind of tooling. |
Some personal feelings:
I think a bunch of these issues center around the fact that
|
To me, the original proposal sounds very reasonable, but I do have some theoretical concerns. I realize that these might not be actual flaws in the design, but I'd still like to see them addressed.
Unlike @michaelpj, I do not think Niv would work better with a configuration file. The original proposal is very opinionated, but should already be flexible enough to support most workflows. Thanks for giving the community an opportunity to respond to your plans! |
I just want to chime in and say that @michaelpj concerns about I am probably missing the point but I don't see why In any case, I would challenge any added complexity, would go with sane defaults and have good documentation for users that want to follow more advanced avenues. I am actually using niv in some global overlays without any default.nix. I only do |
This would be nice, because sometimes I put files in nonstandard directories, and passing |
Got a lot of feedback over the past few months, and a lot more experience with niv. This in an outline of the sources handling changes that will happen soon; it's aimed at making basic nix projects even simpler, while giving people more flexibility re. the location of niv's files. Speak now or forever hold your peace!
discovery
sources.json: niv will go up in the directories (til filesystem boundary) until if finds either a
sources.json
or anix/sources.json
. When it does, it will try to parse it (should be an object and all values should be objects). If it doesn't parse, keep searching.sources.nix: same as above, but with
sources.nix
ornix/sources.nix
, and will hash it for a known sources.nix hash (orniv: no_update
)inlined sources.nix: niv will go up in the directories (til filesystem boundary) and for every file with a
.nix
extension in.
and./nix/
and will scan them (up to n characters) for the upload URL of sources.nix (i.e.https://raw.githubusercontent.com/nmattia/niv/<version>/nix/sources.nix
) and the sha256 of a knownsources.nix
.Generally the discovery should be done lazily (not performed if not needed), should be short-circuited with global flags (like
--sources-file
does already) and should not take more than n milliseconds.niv status
This is a new command that displays:
sources.json
sources.nix
, or the path of the nix file where it's inlined (i.e. fetchurl with remote source)sources.nix
niv init templates
niv init
tries to discoversources.json
andsources.nix
. If it finds them (NOTE: both or either?) it considers niv was already initiated and only updatessources.nix
(if necessary). If it does not find them, then it initializes directory.There will be two templates to start with,
light
andheavy
(not sure yet on the name).light
is the default.$ niv init (--light|--heavy)
light:
heavy:
nix/default.nix
similar todefault.nix
inlight
, except that it returnspkgs
(notpkgs.hello
) and that it imports a localsources.nix
that's written innix/sources.nix
. Might add a flag (--remote-sources
) to disable this.the
sources.json
go tonix/sources.json
(instead of./sources.json
) and includeniv
as well (instead of justnixpkgs
).The text was updated successfully, but these errors were encountered: