[Nix-dev] Compare strings in filterAttrs

4levels 4levels at gmail.com
Thu Mar 24 15:25:52 CET 2016


Hi Nix'ers,

I currently have a set of service configurations like follows:
{
  a-service = {..};
  b-service = {..};
  c-service = {..};
}

I'd like them to be configured that they wait for eachother before being
activated.  Therefor I though I'd pass the "previous" services names to the
after keyword in the systemd config, eg.

a-service = {
  after = [ .. ];
};
b-service = {
  after = [ .. "a-service" ];
};
c-service = {
  after = [ .. "a-service" "b-service" ]; // or [ .. "b-service"];
};

So somehow I need to filter the list of services with a function that
receives the current service name (eg. "b-service") and returns all keys
that occur before the current service (eg. "a-service" when given
"b-service", "b-service" when given "c-service")

I've been looking in the strings functions but I can't seem to find any
string comparision functions.  The only one I find is the versionOlder
function, but that doesn't seem to work to compare any 2 strings.

Any ideas on how to achieve this?

Kind regards,

Erik aka 4levels
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160324/60ac902f/attachment.html 


More information about the nix-dev mailing list