[Nix-dev] RPM now includes NIX executables

Jeff Johnson n3npq at mac.com
Fri Mar 26 18:04:56 CET 2010


Hi --

This is as likely as good a time and place as any to describe
a work-in-progess @rpm5.org.

I'm the lead developer @rpm5.org (http://rpm5.org) as well as a researcher
with the Mancoosi (http://mancoosi.org) WP3 project.

There's been a fair amount of interest in Nix and NixOS in
my professional efforts over the last year.

Over the last couple of weeks, I've finally found the
opportunity to look seriously at the Nix implementation.

As part of studying Nix, I've now merged all the nix
executables into @rpm5.org CVS.

Here are the specifics (note: "xiu" is "nix" inverted in ASCII):

    Direct imports of C++ code from NIX:
	/usr/bin/nix-hash	    (xiu-hash.c will replace)
	/usr/bin/nix-instantiate    (xiu-instantiate.c may replace)
	/usr/bin/nix-store	    (xiu-store.c may replace)
	/usr/bin/nix-log2xml
	/usr/bin/nix-env
	/usr/bin/nix-worker

    Rewritten from perl -> C (largely complete, mostly untested):
	/usr/bin/nix-build
	/usr/bin/nix-channel
	/usr/bin/nix-collect-garbage
	/usr/bin/nix-copy-closure
	/usr/bin/nix-install-package
	/usr/bin/nix-pull	(needs readmanifest parser)
	/usr/bin/nix-push	(needs readmanifest parser)

    Rewritten from shell -> C (and functional afaict so far):
	/usr/bin/nix-prefetch-url

While the code above is currently only "proof-of-concept" hackery (i.e.
I literally recoded the perl/shell line-by-line into C) and
all of the executables are quite buggy and leaky, I have succeeded
in eliminating any need for /usr/bin/perl, and (before I'm done),
will likely be able to eliminate any need for /usr/bin/curl
and/or /usr/libexec/nix/bzip2.

If there's interest from NixOS, I can/will attempt to send along
production quality C code that could be integrated with Nix.

So far I have used only a few RPM peculier API's:
	argv.c		for string arrays
	macro.c		for popen/pclose and string concatenation
that could be re-implemented in any number of ways. I've also
used popt for a common approach to CLI option processing.

E.g. I'd suggest that rewriting the nix-prefetch-url in something
other than shell would be quite useful: shell isn't the
right implementation language for what nix-prefetch-url is
doing. JMHO.

Is there interest in replacing some of the executables in nix?

hth

73 de Jeff






More information about the nix-dev mailing list