[Nix-dev] coerce a list of strings

Daniel Hlynskyi abcz2.uprola at gmail.com
Wed Jul 27 06:32:10 CEST 2016


lib.concatStringsSep "\n"

Google "Nixpkgs strings" for definition and documentation

27 лип. 2016 12:30 дп "Stefan Huchler" <stefan.huchler at mail.de> пише:

> I wanted to shorten my configuration file a bit.
> I have a long configuration for flexget with entries like that:
>
>
>   yt_tech-talk-today:
>     rss: http://feedpress.me/t3mob
>     template: youtube
>
>
> I can replace that with such let statement:
>
>   ${let
>       makeFeed = { name, url}:
>       { x = "  yt_$name:\n   rss: $url\n    template: youtube";}.x;
>     in makeFeed
>       { name = "tech-talk-today"; url = "http://feedpress.me/t3mob"; }
>   }
>
> but now I wanted to use the map function to map more than one entry like
> that:
>
>   ${let
>       makeFeed = { name, url}:
>       { x = "  yt_$name:\n   rss: $url\n    template: youtube";}.x;
>     in map makeFeed
>       [ { name = "tech-talk-today"; url = "http://feedpress.me/t3mob"; }]
>   }
>
> which did not work cause it generates a list of strings what it cant
> "coerce" to a string:
>
> error: cannot coerce a list to a string
>
> Now I thought there is maybe some sort of concat function or merge
> function to build out of this list ONE stirng so it works.
>
> Either this api is very limited or not very well documented, some github
> nix packages seem to imply or list a concat function, but it seems to
> not work or I dont understand this language very well.
>
> wrapping that in a ${concat { let... } at least seems to not work, any
> suggestions?
>
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160727/c7baea28/attachment.html>


More information about the nix-dev mailing list