On Thu, May 22, 2014 at 11:49 AM, Marc Weber <marco-owe...@gmx.de> wrote:

>
> You may want to talk about your use case.



Happy to. We have several developers working on our (newly nix-ified)
codebase. For development, we'd like them each to have a nix expression
that points at their local copy of the source. It seemed reasonable, if
vaguely dodgy, to use an environmental variable to configure the base
directory
in which their local source lives. I ended up with this function:

helper.configSrc = buildLocal: srcdir: fetchArgs@{url, ... }: if buildLocal
     then builtins.toPath ((builtins.getEnv "CODE_PATH") + srcdir)
     else pkgs.fetchgit fetchArgs;

which also allows me to pass in `--arg buildLocal false` to use our git
repository, for deployment.

Of course, a workaround is to do something like this:

helper.configSrc = buildLocal: basedir: srcdir: fetchArgs@{url, ... }: if
buildLocal
     then basedir + srcdir
     else pkgs.fetchgit fetchArgs;

and have our developers set an alias for nix-shell --arg basedir
<their-code-directory>.
_______________________________________________
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to