diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2016-03-08 09:57:58 +0100 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2016-03-08 09:58:19 +0100 |
commit | 09af15654f0c8091f1b9e0bbb2e523cdee194442 (patch) | |
tree | e648edef1ce4c64c533f2593aa22b8015cf0e506 /lib/trivial.nix | |
parent | f306e67e15bdbe9a8358c9f81319fc4fcbadc2eb (diff) | |
parent | 0ee75214f336474e127c2e3546c0406a0c4d5fa7 (diff) | |
download | nixlib-09af15654f0c8091f1b9e0bbb2e523cdee194442.tar nixlib-09af15654f0c8091f1b9e0bbb2e523cdee194442.tar.gz nixlib-09af15654f0c8091f1b9e0bbb2e523cdee194442.tar.bz2 nixlib-09af15654f0c8091f1b9e0bbb2e523cdee194442.tar.lz nixlib-09af15654f0c8091f1b9e0bbb2e523cdee194442.tar.xz nixlib-09af15654f0c8091f1b9e0bbb2e523cdee194442.tar.zst nixlib-09af15654f0c8091f1b9e0bbb2e523cdee194442.zip |
Merge master into closure-size
The kde-5 stuff still didn't merge well. I hand-fixed what I saw, but there may be more problems.
Diffstat (limited to 'lib/trivial.nix')
-rw-r--r-- | lib/trivial.nix | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/trivial.nix b/lib/trivial.nix index cda8aa08a205..9821e3c138dd 100644 --- a/lib/trivial.nix +++ b/lib/trivial.nix @@ -75,4 +75,25 @@ rec { min = x: y: if x < y then x else y; max = x: y: if x > y then x else y; + /* Reads a JSON file. It is useful to import pure data into other nix + expressions. + + Example: + + mkDerivation { + src = fetchgit (importJSON ./repo.json) + #... + } + + where repo.json contains: + + { + "url": "git://some-domain/some/repo", + "rev": "265de7283488964f44f0257a8b4a055ad8af984d", + "sha256": "0sb3h3067pzf3a7mlxn1hikpcjrsvycjcnj9hl9b1c3ykcgvps7h" + } + + */ + importJSON = path: + builtins.fromJSON (builtins.readFile path); } |