Non-valid modules are commented inside the generated list. Move module paths which are not the module directory into the legacy.nix file. svn path=/nixos/branches/modular-nixos/; revision=15751wip/yesman
parent
054528b28d
commit
b022f2e95a
@ -0,0 +1,55 @@ |
||||
#!/bin/sh |
||||
|
||||
prog=$0 |
||||
|
||||
usage(){ |
||||
echo 1>&2 " |
||||
$prog module-dir |
||||
|
||||
This script generate the index file inside the module directory. |
||||
" |
||||
exit 1 |
||||
} |
||||
|
||||
: ${NIXPKGS=/etc/nixos/nixpkgs} |
||||
|
||||
is_module(){ |
||||
local file=$1 |
||||
echo " |
||||
let |
||||
appIfFun = f: x: if builtins.isFunction f then f x else f; |
||||
in |
||||
builtins.isAttrs ( |
||||
appIfFun (import $file) { |
||||
pkgs = (import $NIXPKGS) {}; |
||||
config = {}; |
||||
dummy = 42; |
||||
} |
||||
) |
||||
" | nix-instantiate - --eval-only |
||||
} |
||||
|
||||
generate_index(){ |
||||
local path="$1" |
||||
cd "$path" |
||||
echo -n "$path: " 1>&2 |
||||
{ echo "[ # This file have been generated by $(basename $prog)"; |
||||
for file in : $(find ./ -wholename '*.impl[./]*' -or -wholename './module-list.nix' -or -type f -name '*.nix' -print); do |
||||
[ "$file" = ':' ] && continue; |
||||
echo -n . 1>&2 |
||||
if test "$(is_module "$file" 2> /dev/null)" = "Bool(True)"; then |
||||
echo " $file" |
||||
else |
||||
echo "##### $file" |
||||
is_module "$file" 2>&1 | sed 's/^/# /' |
||||
fi |
||||
done |
||||
echo ']'; |
||||
} > ./module-list.nix |
||||
echo 1>&2 |
||||
cd - > /dev/null |
||||
} |
||||
|
||||
[ $# -eq 1 ] || usage; |
||||
|
||||
generate_index "$1" |
@ -0,0 +1,20 @@ |
||||
{ |
||||
require = [ |
||||
../etc/default.nix |
||||
../system/assertion.nix |
||||
../system/nixos-environment.nix |
||||
../system/nixos-installer.nix |
||||
../system/system-options.nix |
||||
../upstart-jobs/cron/locate.nix |
||||
../upstart-jobs/filesystems.nix |
||||
../upstart-jobs/guest-users.nix |
||||
../upstart-jobs/kbd.nix |
||||
../upstart-jobs/ldap |
||||
../upstart-jobs/lvm.nix |
||||
../upstart-jobs/network-interfaces.nix |
||||
../upstart-jobs/pcmcia.nix |
||||
../upstart-jobs/swap.nix |
||||
../upstart-jobs/swraid.nix |
||||
../upstart-jobs/tty-backgrounds.nix |
||||
]; |
||||
} |
Loading…
Reference in new issue