[Nix-dev] Declaring filesystems using functions
Oliver Matthews
ojm at codersoffortune.net
Wed May 27 09:49:13 CEST 2015
So,
I have a bunch of containers that I want to bind mount specific directories into. For ease, I intend to mount them at the same point on the parent FS.
a mapped function struck me as the most obvious, but I can't quite get it to work - I have a sort of solution, but there is a layer of indirection which is beating me.
This works:
let bindFS = { container, dir }:
{ "/var/lib/containers/${container}/${dir}" = { device = "${dir}"; options = "${bind}"; }; };
in
{
fileSystems =
bindFS { container="containerName"; dir="somedir1"; } //
bindFS { container="containerName"; dir="somedir2"; };
}
I tried fileSystems = map bindFS [ { container=... But that fails as it creates anonymous items within fileSystems.
Can someone help with what I've missed?
Regards,
Oliver
More information about the nix-dev
mailing list