Skip to content

Commit c20cc6d

Browse files
committed
Excise use of importJSON
Putting information in external JSON files is IMHO not an improvement over the idiomatic style of Nix expressions. The use of JSON doesn't add anything over Nix expressions (in fact it removes expressive power). And scattering package info over lots of little files makes packages less readable over having the info in one file.
1 parent 2dc8788 commit c20cc6d

10 files changed

Lines changed: 30 additions & 53 deletions

File tree

lib/trivial.nix

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -102,25 +102,7 @@ rec {
102102
min = x: y: if x < y then x else y;
103103
max = x: y: if x > y then x else y;
104104

105-
/* Reads a JSON file. It is useful to import pure data into other nix
106-
expressions.
107-
108-
Example:
109-
110-
mkDerivation {
111-
src = fetchgit (importJSON ./repo.json)
112-
#...
113-
}
114-
115-
where repo.json contains:
116-
117-
{
118-
"url": "git://some-domain/some/repo",
119-
"rev": "265de7283488964f44f0257a8b4a055ad8af984d",
120-
"sha256": "0sb3h3067pzf3a7mlxn1hikpcjrsvycjcnj9hl9b1c3ykcgvps7h"
121-
}
122-
123-
*/
105+
/* Reads a JSON file. */
124106
importJSON = path:
125107
builtins.fromJSON (builtins.readFile path);
126108

pkgs/applications/graphics/ao/default.nix

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ stdenv.mkDerivation rec {
1010
libpthreadstubs libXau libXdmcp libXrandr libXext libXinerama libXxf86vm
1111
libXcursor libXfixes
1212
];
13-
src = fetchgit (stdenv.lib.importJSON ./src.json);
13+
14+
src = fetchgit {
15+
url = https://github.com/mkeeter/ao;
16+
rev = "69fadb81543cc9031e4a7ec2036c7f2ab505a620";
17+
sha256 = "1717k72vr0i5j7bvxmd6q16fpvkljnqfa1hr3i4yq8cjdsj69my7";
18+
};
19+
1420
cmakeFlags = "-G Ninja";
1521
buildPhase = "ninja";
1622
installPhase = ''

pkgs/applications/graphics/ao/src.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

pkgs/applications/virtualization/virtualbox/default.nix

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ let
1818
python = python2;
1919
buildType = "release";
2020

21-
inherit (importJSON ./upstream-info.json) version extpackRev extpack main;
21+
extpack = "3982657fd4853bcbc79b9162e618545a479b65aca08e9ced43a904aeeba3ffa5";
22+
extpackRev = 112026;
23+
main = "98073b1b2adee4e6553df73cb5bb6ea8ed7c3a41a475757716fd9400393bea40";
24+
version = "5.1.10";
2225

2326
# See https://github.com/NixOS/nixpkgs/issues/672 for details
2427
extensionPack = requireFile rec {
25-
name = "Oracle_VM_VirtualBox_Extension_Pack-${version}-${extpackRev}.vbox-extpack";
28+
name = "Oracle_VM_VirtualBox_Extension_Pack-${version}-${toString extpackRev}.vbox-extpack";
2629
sha256 = extpack;
2730
message = ''
2831
In order to use the extension pack, you need to comply with the VirtualBox Personal Use

pkgs/applications/virtualization/virtualbox/guest-additions/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ stdenv.mkDerivation {
1212

1313
src = fetchurl {
1414
url = "http://download.virtualbox.org/virtualbox/${version}/VBoxGuestAdditions_${version}.iso";
15-
sha256 = (lib.importJSON ../upstream-info.json).guest;
15+
sha256 = "29fa0af66a3dd273b0c383c4adee31a52061d52f57d176b67f444698300b8c41";
1616
};
1717

1818
KERN_DIR = "${kernel.dev}/lib/modules/*/build";

pkgs/applications/virtualization/virtualbox/upstream-info.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

pkgs/development/libraries/torch/default.nix

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ stdenv.mkDerivation rec{
1010
libjpeg zeromq3 ncurses openssl libpng readline pkgconfig
1111
zlib libX11 which
1212
];
13-
src = fetchgit (stdenv.lib.importJSON ./src.json);
13+
14+
src = fetchgit {
15+
url = "https://github.com/torch/distro";
16+
rev = "8b6a834f8c8755f6f5f84ef9d8da9cfc79c5ce1f";
17+
sha256 = "120hnz82d7izinsmv5smyqww71dhpix23pm43s522dfcglpql8xy";
18+
fetchSubmodules = true;
19+
};
20+
1421
buildPhase = ''
1522
cd ..
1623
export PREFIX=$out

pkgs/development/libraries/torch/src.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

pkgs/os-specific/linux/tp_smapi/default.nix

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
{ stdenv, fetchurl, kernel, writeScript, coreutils, gnugrep, jq, curl
22
}:
33

4-
let
5-
data = stdenv.lib.importJSON ./update.json;
6-
in stdenv.mkDerivation rec {
7-
name = "tp_smapi-${data.version}-${kernel.version}";
4+
stdenv.mkDerivation rec {
5+
name = "tp_smapi-${version}-${kernel.version}";
86

9-
src = fetchurl { inherit (data) url sha256; };
7+
version = "0.42";
8+
9+
src = fetchurl {
10+
url = "https://github.com/evgeni/tp_smapi/archive/tp-smapi/${version}.tar.gz";
11+
sha256 = "cd28bf6ee21b2c27b88d947cb0bfcb19648c7daa5d350115403dbcad05849381";
12+
};
1013

1114
hardeningDisable = [ "pic" ];
1215

pkgs/os-specific/linux/tp_smapi/update.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)