Created
January 23, 2017 10:37
-
-
Save moretea/e41e4ea7a9ce87e7e0c433a88fefc3b0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with (import <nixpkgs> {}); | |
with pkgs.lib; | |
let | |
getLicense = meta: | |
if !(meta ? license) then | |
"not specified" | |
else | |
if (meta.license ? fullName) | |
then meta.license.fullName | |
else | |
if (isList meta.license) | |
then map (l: l.fullName) meta.license | |
else meta.license; | |
package = pkgs.${builtins.getEnv("PACKAGE")}; | |
showPkg = pkg: { | |
name = pkg.name; | |
path = toString pkg; | |
license = getLicense pkg.meta; | |
}; | |
computeDeps = pkg: [(showPkg pkg)] ++ (map (x: computeDeps x) pkg.nativeBuildInputs); | |
in | |
{ | |
packagePath = toString package; | |
depList = computeDeps package; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "json" | |
require "pp" | |
package_name = "vim" | |
nix_info = JSON.load `PACKAGE=#{package_name} nix-instantiate --strict --json --eval find_trans_deps.nix` | |
runtime_deps = `nix-store -qR #{nix_info["packagePath"]}`.split("\n") | |
pp nix_info | |
pp runtime_deps |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[maarten@maarten-laptop:~/code/nixos]$ ruby find_trans_deps.rb | |
{"depList"=> | |
[{"license"=>"Vim License", | |
"name"=>"vim-7.4.2367", | |
"path"=>"/nix/store/g0dnigcj3xp8dag353wqwal4lv4jk83w-vim-7.4.2367"}, | |
[{"license"=>"not specified", | |
"name"=>"gettext-0.19.8", | |
"path"=>"/nix/store/iqh4fn2hbg33rsnyqb5fsmj40wny6h1f-gettext-0.19.8"}, | |
[{"license"=> | |
["GNU General Public License v2.0 or later", | |
"GNU Library General Public License v2.1 or later"], | |
"name"=>"xz-5.2.2", | |
"path"=>"/nix/store/xdppv5b3ag803vkan6dcm9wxzryv0zxs-xz-5.2.2-dev"}], | |
[{"license"=> | |
["GNU General Public License v2.0 or later", | |
"GNU Library General Public License v2.1 or later"], | |
"name"=>"xz-5.2.2", | |
"path"=>"/nix/store/cksisynf1z4h4n6xp132aynhqxjqscp8-xz-5.2.2-bin"}]], | |
[{"license"=>"MIT License", | |
"name"=>"ncurses-6.0", | |
"path"=>"/nix/store/h138nb121m5xqrgl2sf4drndgwmgijjc-ncurses-6.0-dev"}, | |
[{"license"=>"not specified", | |
"name"=>"pkg-config-0.29", | |
"path"=>"/nix/store/mc1566sppzfqsggxcqckvxamk989pr9h-pkg-config-0.29"}]], | |
[{"license"=>"not specified", | |
"name"=>"pkg-config-0.29", | |
"path"=>"/nix/store/mc1566sppzfqsggxcqckvxamk989pr9h-pkg-config-0.29"}]], | |
"packagePath"=>"/nix/store/g0dnigcj3xp8dag353wqwal4lv4jk83w-vim-7.4.2367"} | |
["/nix/store/27binbdy296qvjycdgr1535v8872vz3z-glibc-2.24", | |
"/nix/store/2c1jp8rzbb40h3xkan5z1w7bzrlqy065-bash-4.3-p48", | |
"/nix/store/51qrnwwwgv39vffnxn8zgap3dw39x5mx-gawk-4.1.3", | |
"/nix/store/mpva72r712z5j36ls5a2d72a0da053n8-ncurses-6.0", | |
"/nix/store/g0dnigcj3xp8dag353wqwal4lv4jk83w-vim-7.4.2367"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment