Re: [Nix-dev] coerce a list of strings

2016-07-26 Thread Daniel Hlynskyi
lib.concatStringsSep "\n"

Google "Nixpkgs strings" for definition and documentation

27 лип. 2016 12:30 дп "Stefan Huchler"  пише:

> 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\ntemplate: 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\ntemplate: 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@lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


[Nix-dev] coerce a list of strings

2016-07-26 Thread Stefan Huchler
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\ntemplate: 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\ntemplate: 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@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev