[Nix-dev] NIx and portability
emery at vfemail.net
emery at vfemail.net
Thu Feb 19 05:37:17 CET 2015
I'm working on porting Nix to a non-UNIX operating system and I'd like some
advice.
I want to get Nix running on the Genode microkernel OS (http://genode.org/).
Genode is not UNIX-based and the differences are very fundamental but so
far I have managed to execute some simple builders using Bash and its UNIX
emulator.
Libnixexpr works without modification, but I've had to modify libnixutil
and libnixstore. For now I have no plans on managing profiles yet. The
issue I want to deal with now is how to make changes to libnixutil and
libnixstore with the least amount of future maintenance. So far I have been
taking source files and moving problem functions into a unix implementation
file, then making a copy of that and doing a rewrite. Would this separation
be useful to upstream? Is there a better method? Is there any sort of
reorganization or refactoring that I could do at the same time that would
be helpful?
The big changes to be made in libnixstore are:
- Builders are started in a completely different manner, there are no pipes
or PIDs, the builder is monitored in a different way. I haven't implemented
logging but it shouldn't be much of an issue.
- There is no chrooting when you don't have a root, but a stacked virtual
file system is readily available in the emulator.
- Build hook support would need to be reimplemted.
The minor changes elsewhere are:
- No users or groups. Standard filesystems will be used, but the system has
no concept of user, group or mode.
- No getenv or argv for Nix, but no issues with setting these for builders.
The native configuration method has been sufficient for Nix.
- File locks: The file system interface does not yet support file locking.
Permissions and file-locking isn't a big deal, I can probably deal with
those using dummy libc functions. I ported SQLite first, so that is taken
care of, though without file locking I'm using a different journal mode for
the database.
I suppose what I'm doing could make a windows port easier for someone else,
not there would be a point in that.
What do you guys think?
Emery
More information about the nix-dev
mailing list