From a5ca796f557f74e23328c8892447b0606d333f8d Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Fri, 27 Nov 2015 09:55:22 -0500 Subject: [PATCH] idris-modules: Read the filesystem to populate package list --- .../idris-modules/build-builtin-package.nix | 2 +- pkgs/development/idris-modules/default.nix | 18 ++++++++---------- ...-packages-wrapper.nix => with-packages.nix} | 0 3 files changed, 9 insertions(+), 11 deletions(-) rename pkgs/development/idris-modules/{with-packages-wrapper.nix => with-packages.nix} (100%) diff --git a/pkgs/development/idris-modules/build-builtin-package.nix b/pkgs/development/idris-modules/build-builtin-package.nix index 9a6b99d15230..7445e95e27c0 100644 --- a/pkgs/development/idris-modules/build-builtin-package.nix +++ b/pkgs/development/idris-modules/build-builtin-package.nix @@ -1,4 +1,4 @@ -{ idris, buildIdrisPackage }: name: deps: buildIdrisPackage (args: { +{ idris, build-idris-package }: name: deps: build-idris-package (args: { inherit name; propagatedBuildInputs = deps; diff --git a/pkgs/development/idris-modules/default.nix b/pkgs/development/idris-modules/default.nix index 96e8b5b8ad9d..8388eb96bbf3 100644 --- a/pkgs/development/idris-modules/default.nix +++ b/pkgs/development/idris-modules/default.nix @@ -13,9 +13,7 @@ callPackage = callPackageWithScope defaultScope; - buildBuiltinPackage = callPackage ./build-builtin-package.nix {}; - - builtins = pkgs.lib.mapAttrs buildBuiltinPackage { + builtins_ = pkgs.lib.mapAttrs self.build-builtin-package { prelude = []; base = [ self.prelude ]; @@ -26,13 +24,13 @@ pruviloj = [ self.prelude self.base ]; }; - in { - inherit idris; - withPackages = callPackage ./with-packages-wrapper.nix {}; + files = builtins.filter (n: n != null) (pkgs.lib.mapAttrsToList (name: type: let + m = builtins.match "(.*)\.nix" name; + in if m == null then null else builtins.head m) (builtins.readDir ./.)); + in (builtins.listToAttrs (map (name: { inherit name; value = callPackage (./. + "/${name}.nix") {}; }) files)) // { + inherit idris callPackage; - buildIdrisPackage = callPackage ./build-idris-package.nix {}; - - builtins = pkgs.lib.mapAttrsToList (name: value: value) builtins; - } // builtins; + builtins = pkgs.lib.mapAttrsToList (name: value: value) builtins_; + } // builtins_; in fix' (extends overrides idrisPackages) diff --git a/pkgs/development/idris-modules/with-packages-wrapper.nix b/pkgs/development/idris-modules/with-packages.nix similarity index 100% rename from pkgs/development/idris-modules/with-packages-wrapper.nix rename to pkgs/development/idris-modules/with-packages.nix