[Nix-dev] Resolution context of `require' paths

Nicolas Pierron nicolas.b.pierron at gmail.com
Tue Jun 30 11:00:25 CEST 2009


Hi Ludovic,

On Tue, Jun 30, 2009 at 09:50, Ludovic Courtès<ludo at gnu.org> wrote:
> Hello,
>
> The `modular-nixos' branch introduces `require' statements, which now
> take a path, e.g.,
>
>  require = [ ./nixos/hardware/network/intel-4965agn.nix ];
>
> The problem is that the resolution context of this relative path is
> often problematic.

I don't consider this being a problem.
Can't you use absolute path? /etc/nixos/nixos/hardware/network/intel-4965agn.nix

> With the installation, this path is resolved relative to the
> installation target root (/mnt) whereas `nixos-checkout' stores the
> NixOS source under /.

The source aren't copied to the target before the end of the
installation?  May be the nixos-checkout script should consider that
it should checkout the world for the target. (predefined when building
the CD)

> Similarly, with /etc/nixos/configuration.nix being a symlink to
> $HOME/src/..., that path is resolved relative to the actual location of
> `configuration.nix', not relative to /etc/nixos.

Which I consider to be safe because the behavior is independent of the
file which refer to it.

may be your configuration.nix should be:

{ require = [
    /foo/bar/original.nix
    ./other.nix
   ];
}

or you can hard-link it instead of a symlink (which I consider unsafe)
because your file could have different behavior which depends on where
it is evaluated.

> I find this behavior inconvenient.  Do you have ideas on how to fix it?

fix what? AFAIK, this is not a bug.

-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron
Richard Feynman - I think I can safely say that nobody understands
quantum mechanics.



More information about the nix-dev mailing list