English 中文(简体)
我如何利用“九次搜索”搜寻“Haskell”包件?
原标题:How do I search for Haskell packages using "nix search"?
  • 时间:2019-03-30 12:33:54
  •  标签:
  • haskell
  • nix

我知道,我可以通过使用Nix-env来寻找Haskell包。

nix-env -f  <nixpkgs>  -qaP -A haskellPackages name_of_package

但这很缓慢,而且没有时间。 如果我试图使用新的指挥系统<代码>nix 查询,则所有Haskell包裹都是隐蔽的。

$ nix search aeson
error: no results for the given search term(s)!

利用新的<代码>nix搜索指令,是否可以搜寻是否有kell包? 如果是,如何?


<><>Edit>: 我在thisirclog中找到了这方面的一些讨论,但我可以肯定这些建议在实践中的意义。 具体来说,这一部分:

20:49 <duairc> How do I make nix search include haskellPackages?
20:52 <ottidmes> duairc: you might try and call recurseIntoAttrs on haskellPackages
20:52 <rain1> thanks
20:52 <LnL> rain1: nix-env -f  <nixpkgs>  -qaP -A haskellPackages
20:54 <gchristensen> duairc: ^
20:54 <duairc> LnL: Thanks!
20:55 <LnL> err, wrong person
20:56 <LnL> you can also add an overlay that recurses, but that might make it
      hard to find non haskell stuff if you re searching for something else
20:56 <ottidmes> I can confirm that
      haskellPackages = super.recurseIntoAttrs super.haskellPackages; works though
20:58 <duairc> ottidmes: What do I do with that expression? Put it in
      configuration.nix somewhere? If I type "nix search ghcid" then
      will it find it?
20:59 <duairc> Ah, you re using super, so I guess it s an overlay
20:59 <clever> duairc: for `nix search` to find it, the overlay must be
      somewhere in $HOME, i forget the exact path
20:59 <clever> duairc: configuration.nix only effects nixos-rebuild and
      nothing else
21:00 <ottidmes> duairc: yeah, it should be put in your overlay that is
      also used by nix-env the like, so not nixpkgs.overlays in your
      configuration.nix as mentioned by clever, and then searching
      for e.g. nix search nix-diff will result in:
      * nixpkgs.haskellPackages.nix-diff (nix-diff)
最佳回答

根据国际奥委会的聊天,建立了<代码>~/.config/nixpkgs/overlays.nix。 载有此内容的文件:

[
  (self: super: {
    haskellPackages = super.recurseIntoAttrs super.haskellPackages;
  })
]

这是一种超额开支,规定了<代码>recurseForDerivations属地。 一揽子计划是真实的。 • 显示扫描工具,以复制该套,在<代码>nix 查询时查询。 它目前无证件,但已执行

The Nix wiki describes where to put the overlay and the Nixpkgs manual describes what overlays actually are and how to use them.

问题回答

你们可以节省这一成果:

nix-env -f  <nixpkgs>  -qaP -A haskellPackages

而是每次寻找产出?

I think the issue is <nixpkgs> will have to be evaluated at each invocation, however if this was a static file/path - it would not need to be.

查阅Gitewell NixOS/nixpkgs的最新数据:

nix search nixpkgs#haskellPackages PACKAGE_NAME

i.e.

nix search nixpkgs#haskellPackages aeson

产量

* legacyPackages.x86_64-linux.haskellPackages.AesonBson (0.4.1)
  Mapping between Aeson s JSON and Bson objects

* legacyPackages.x86_64-linux.haskellPackages.HsYAML-aeson (0.2.0.1)
  JSON to YAML Adapter

* legacyPackages.x86_64-linux.haskellPackages.Quickson (0.2)
  Quick JSON extractions with Aeson

* legacyPackages.x86_64-linux.haskellPackages.abeson (0.1.0.1)
  interconversion between aeson and bson

* legacyPackages.x86_64-linux.haskellPackages.activitystreams-aeson (0.2.0.2)
  An interface to the ActivityStreams specification

* legacyPackages.x86_64-linux.haskellPackages.aeson (2.1.2.1)
  Fast JSON parsing and encoding

.
.
.

另一实例

$ nix search nixpkgs#haskellPackages aeson_2  
       
* legacyPackages.x86_64-linux.haskellPackages.aeson_2_2_0_0 (2.2.0.0)
  Fast JSON parsing and encoding



如果您在<代码>nixpkgs上做了检查。 当地:

nix search .#haskellPackages aeson




相关问题
Euler Problem in Haskell -- Can Someone Spot My Error

I m trying my hand at Euler Problem 4 in Haskell. It asks for that largest palindrome formed by multiplying two three-digit numbers. The problem was simple enough, and I thought my Haskell-fu was up ...

How does foldr work?

Can anybody explain how does foldr work? Take these examples: Prelude> foldr (-) 54 [10, 11] 53 Prelude> foldr (x y -> (x+y)/2) 54 [12, 4, 10, 6] 12.0 I am confused about these executions....

Efficient queue in Haskell

How can I efficiently implement a list data structure where I can have 2 views to the head and end of the list, that always point to a head a tail of a list without expensive calls to reverse. i.e: ...

Problem detecting cyclic numbers in Haskell

I am doing problem 61 at project Euler and came up with the following code (to test the case they give): p3 n = n*(n+1) `div` 2 p4 n = n*n p5 n = n*(3*n -1) `div` 2 p6 n = n*(2*n -1) p7 n = n*(5*n -3)...

Ways to get the middle of a list in Haskell?

I ve just started learning about Functional Programming, using Haskel. I m slowly getting through Erik Meijer s lectures on Channel 9 (I ve watched the first 4 so far) and in the 4th video Erik ...

haskell grouping problem

group :: Ord a => [(a, [b])] -> [(a, [b])] I want to look up all pairs that have the same fst, and merge them, by appending all the list of bs together where they have the same a and discarding ...

Closest equivalent to subprocess.communicate in Haskell

I want to do a popen() / python s subprocess.communicate from Haskell - start a program, give it stdin, and get its stdout/stderr. What s the most direct / Haskellish way to do this?

热门标签