[Nix-dev] A few questions from a NixOS newbie.

Bjørn Forsman bjorn.forsman at gmail.com
Mon Apr 21 16:25:51 CEST 2014


On 21 April 2014 15:35, Kirill Elagin <kirelagin at gmail.com> wrote:
> If there was a way to
>
> 1. run nix-repl non-interactively,
> 2. list variables in scope
>
> that would be a fine replacement for grepping and opening files…
>
> Something like `nix-repl ':l <nixpkgs>; :scope' | grep foo` and `nix-repl
> ':l <nixpkgs>; :p foo.meta`.

Running nix-repl non-interactively:

$ printf ":l <nixpkgs>\n:p wireshark.meta" | nix-repl
Welcome to Nix version 1.7. Type :? for help.

nix-repl> :l <nixpkgs>
Added 3747 variables.

nix-repl> :p wireshark.meta
{ description = "a powerful network protocol analyzer"; homepage =
"http://www.wireshark.org/"; license = { fullName = "GNU General
Public License version 2"; shortName = "GPLv2"; url =
"http://www.gnu.org/licenses/old-licenses/gpl-2.0.html"; };
longDescription = "Wireshark (formerly known as \"Ethereal\") is a
powerful network\nprotocol analyzer developed by an international team
of networking\nexperts. It runs on UNIX, OS X and Windows.\n";
maintainers = [ "Peter Simons <simons at cryp.to>" ]; platforms = [
"i686-linux" "x86_64-linux" "armv5tel-linux" "armv7l-linux"
"mips64el-linux" ]; position =
"/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/applications/networking/sniffers/wireshark/default.nix:47";
}


It's not as user friendly as e.g. "apt-get show wireshark" on Debian/Ubuntu :-)


Hm, I just tested the new --json option for nix-env. Look at this
(plesently surprised):

$ nix-env -qaP --json wireshark | json_pp
{
   "nixos.pkgs.wireshark" : {
      "system" : "x86_64-linux",
      "name" : "wireshark-1.11.2",
      "meta" : {
         "longDescription" : "Wireshark (formerly known as
\"Ethereal\") is a powerful network\nprotocol analyzer developed by an
international team of networking\nexperts. It runs on UNIX, OS X and
Windows.\n",
         "homepage" : "http://www.wireshark.org/",
         "platforms" : [
            "i686-linux",
            "x86_64-linux",
            "armv5tel-linux",
            "armv7l-linux",
            "mips64el-linux"
         ],
         "maintainers" : [
            "Peter Simons <simons at cryp.to>"
         ],
         "position" :
"/nix/store/sv3pqp26qkiviq0rk2dgpaj6a1csaf3a-nixos-14.04pre42244.4160e65/nixos/nixpkgs/pkgs/applications/networking/sniffers/wireshark/default.nix:47",
         "license" : {
            "fullName" : "GNU General Public License version 2",
            "url" : "http://www.gnu.org/licenses/old-licenses/gpl-2.0.html",
            "shortName" : "GPLv2"
         },
         "description" : "a powerful network protocol analyzer"
      }
   }
}


More information about the nix-dev mailing list