summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2017-07-12 19:11:29 +0200
committerlassulus <lassulus@lassul.us>2017-07-12 19:11:29 +0200
commitb19ebc2abd8f383d477d35040e833cd9c05319ab (patch)
tree778a882e0faebc82360c06165b4b00726468b8aa /lib
parent5efedd139a20d71268af2afd069dbd595414650f (diff)
parentcd47613a4d8daf185f4ac0f8ef43af11985a2f65 (diff)
Merge branch 'staging/source'
Diffstat (limited to 'lib')
-rw-r--r--lib/default.nix3
-rw-r--r--lib/eval-source.nix15
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/default.nix b/lib/default.nix
index 803a614a1..4c54f60aa 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -1,6 +1,9 @@
let
nixpkgs-lib = import <nixpkgs/lib>;
lib = with lib; nixpkgs-lib // builtins // {
+
+ evalSource = import ./eval-source.nix;
+
git = import ./git.nix { inherit lib; };
shell = import ./shell.nix { inherit lib; };
types = nixpkgs-lib.types // import ./types.nix { inherit lib; };
diff --git a/lib/eval-source.nix b/lib/eval-source.nix
new file mode 100644
index 000000000..468fc92d1
--- /dev/null
+++ b/lib/eval-source.nix
@@ -0,0 +1,15 @@
+with import <stockholm/lib>;
+let
+ eval = _file: source: evalModules {
+ modules = singleton {
+ inherit _file;
+ imports = map (source: { inherit source; }) (toList source);
+ options.source = mkOption {
+ type = types.attrsOf types.source;
+ default = {};
+ };
+ };
+ };
+in
+ # This function's return value can be used as pkgs.populate input.
+ _file: source: (eval _file source).config.source