From 36670f3e1cccad579b994a29320eeb8e287803b7 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 21 May 2015 01:56:08 +0200 Subject: sh: functions -> bin/ --- bin/list-module-imports | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 bin/list-module-imports (limited to 'bin/list-module-imports') diff --git a/bin/list-module-imports b/bin/list-module-imports new file mode 100755 index 00000000..39d11bf3 --- /dev/null +++ b/bin/list-module-imports @@ -0,0 +1,20 @@ +#! /bin/sh +# list-module-imports : nix-file -> lines nix-file +set -euf + +if echo "$1" | grep -q ^/; then + : +else + set -- "./$1" +fi + +imports=$(nix-instantiate \ + -I secrets=secrets \ + --strict \ + --json \ + --eval \ + -E \ + "with builtins; with import ./lib/modules.nix; map toString (list-imports $1)") + +echo "$imports" \ + | jq -r .[] -- cgit v1.2.3