treewide: switch builtins.fromJSON(builtins.readFile ./file.json) to lib.importJSON ./file.json #2

Changed files
+26 -26
doc
build-aux
pandoc-filters
pkgs
applications
emulators
retroarch
networking
browsers
librewolf
build-support
flutter
data
misc
hackage
development
libraries
tools
build-managers
scala-cli
mongosh
poetry2nix
poetry2nix
swiftpm2nix
tabnine
servers
tools
admin
google-cloud-sdk
nix
+1 -1
pkgs/applications/emulators/retroarch/cores.nix
···
}:
let
-
hashesFile = builtins.fromJSON (builtins.readFile ./hashes.json);
getCoreSrc = core:
fetchFromGitHub (builtins.getAttr core hashesFile);
···
}:
let
+
hashesFile = lib.importJSON ./hashes.json;
getCoreSrc = core:
fetchFromGitHub (builtins.getAttr core hashesFile);
+2 -2
pkgs/applications/networking/browsers/librewolf/src.nix
···
-
{ fetchurl, fetchFromGitLab }:
-
let src = builtins.fromJSON (builtins.readFile ./src.json);
in
{
inherit (src) packageVersion;
···
+
{ lib, fetchurl, fetchFromGitLab }:
+
let src = lib.importJSON ./src.json;
in
{
inherit (src) packageVersion;
+2 -2
pkgs/build-support/flutter/default.nix
···
packageOverrideRepository = (callPackage ../../development/compilers/flutter/package-overrides { }) // customPackageOverrides;
productPackages = builtins.filter (package: package.kind != "dev")
(if autoDepsList
-
then builtins.fromJSON (builtins.readFile deps.depsListFile)
else
if depsListFile == null
then [ ]
-
else builtins.fromJSON (builtins.readFile depsListFile));
in
builtins.foldl'
(prev: package:
···
packageOverrideRepository = (callPackage ../../development/compilers/flutter/package-overrides { }) // customPackageOverrides;
productPackages = builtins.filter (package: package.kind != "dev")
(if autoDepsList
+
then lib.importJSON deps.depsListFile
else
if depsListFile == null
then [ ]
+
else lib.importJSON depsListFile);
in
builtins.foldl'
(prev: package:
+1 -1
pkgs/data/misc/hackage/default.nix
···
# and callHackage
{ lib, fetchurl }:
let
-
pin = builtins.fromJSON (builtins.readFile ./pin.json);
in
fetchurl {
inherit (pin) url sha256;
···
# and callHackage
{ lib, fetchurl }:
let
+
pin = lib.importJSON ./pin.json;
in
fetchurl {
inherit (pin) url sha256;
+1 -1
pkgs/development/libraries/ndi/default.nix
···
{ lib, stdenv, requireFile, avahi, obs-studio-plugins }:
let
-
versionJSON = builtins.fromJSON (builtins.readFile ./version.json);
in
stdenv.mkDerivation rec {
pname = "ndi";
···
{ lib, stdenv, requireFile, avahi, obs-studio-plugins }:
let
+
versionJSON = lib.importJSON ./version.json;
in
stdenv.mkDerivation rec {
pname = "ndi";
+1 -1
pkgs/development/tools/build-managers/scala-cli/default.nix
···
let
pname = "scala-cli";
-
sources = builtins.fromJSON (builtins.readFile ./sources.json);
inherit (sources) version assets;
platforms = builtins.attrNames assets;
···
let
pname = "scala-cli";
+
sources = lib.importJSON ./sources.json;
inherit (sources) version assets;
platforms = builtins.attrNames assets;
+1 -1
pkgs/development/tools/mongosh/default.nix
···
}:
let
-
source = builtins.fromJSON (builtins.readFile ./source.json);
in
buildNpmPackage {
pname = "mongosh";
···
}:
let
+
source = lib.importJSON ./source.json;
in
buildNpmPackage {
pname = "mongosh";
+1 -1
pkgs/development/tools/poetry2nix/poetry2nix/default.nix
···
toPluginAble = (import ./plugins.nix { inherit pkgs lib; }).toPluginAble;
# List of known build systems that are passed through from nixpkgs unmodified
-
knownBuildSystems = builtins.fromJSON (builtins.readFile ./known-build-systems.json);
nixpkgsBuildSystems = lib.subtractLists [ "poetry" "poetry-core" ] knownBuildSystems;
mkInputAttrs =
···
toPluginAble = (import ./plugins.nix { inherit pkgs lib; }).toPluginAble;
# List of known build systems that are passed through from nixpkgs unmodified
+
knownBuildSystems = lib.importJSON ./known-build-systems.json;
nixpkgsBuildSystems = lib.subtractLists [ "poetry" "poetry-core" ] knownBuildSystems;
mkInputAttrs =
+1 -1
pkgs/development/tools/swiftpm2nix/support.nix
···
# Make packaging helpers from swiftpm2nix generated output.
helpers = generated: let
inherit (import generated) workspaceStateFile hashes;
-
workspaceState = builtins.fromJSON (builtins.readFile workspaceStateFile);
pinFile = mkPinFile workspaceState;
in rec {
···
# Make packaging helpers from swiftpm2nix generated output.
helpers = generated: let
inherit (import generated) workspaceStateFile hashes;
+
workspaceState = lib.importJSON workspaceStateFile;
pinFile = mkPinFile workspaceState;
in rec {
+1 -1
pkgs/development/tools/tabnine/default.nix
···
{ stdenv, lib, fetchurl, unzip }:
let
-
sources = builtins.fromJSON (builtins.readFile ./sources.json);
platform =
if (builtins.hasAttr stdenv.hostPlatform.system sources.platforms) then
builtins.getAttr (stdenv.hostPlatform.system) sources.platforms
···
{ stdenv, lib, fetchurl, unzip }:
let
+
sources = lib.importJSON ./sources.json;
platform =
if (builtins.hasAttr stdenv.hostPlatform.system sources.platforms) then
builtins.getAttr (stdenv.hostPlatform.system) sources.platforms
+1 -1
pkgs/servers/invidious/default.nix
···
# * update lsquic and boringssl if necessarry, lsquic.cr depends on
# the same version of lsquic and lsquic requires the boringssl
# commit mentioned in its README
-
versions = builtins.fromJSON (builtins.readFile ./versions.json);
in
crystal.buildCrystalPackage rec {
pname = "invidious";
···
# * update lsquic and boringssl if necessarry, lsquic.cr depends on
# the same version of lsquic and lsquic requires the boringssl
# commit mentioned in its README
+
versions = lib.importJSON ./versions.json;
in
crystal.buildCrystalPackage rec {
pname = "invidious";
+1 -1
pkgs/servers/invidious/lsquic.nix
···
{ lib, boringssl, stdenv, fetchgit, fetchFromGitHub, fetchurl, cmake, zlib, perl, libevent }:
let
-
versions = builtins.fromJSON (builtins.readFile ./versions.json);
fetchGitilesPatch = { name, url, sha256 }:
fetchurl {
···
{ lib, boringssl, stdenv, fetchgit, fetchFromGitHub, fetchurl, cmake, zlib, perl, libevent }:
let
+
versions = lib.importJSON ./versions.json;
fetchGitilesPatch = { name, url, sha256 }:
fetchurl {
+2 -2
pkgs/servers/invidious/videojs.nix
···
-
{ stdenvNoCC, cacert, crystal, openssl, pkg-config, invidious }:
let
-
versions = builtins.fromJSON (builtins.readFile ./versions.json);
in
stdenvNoCC.mkDerivation {
name = "videojs";
···
+
{ lib, stdenvNoCC, cacert, crystal, openssl, pkg-config, invidious }:
let
+
versions = lib.importJSON ./versions.json;
in
stdenvNoCC.mkDerivation {
name = "videojs";
+2 -2
pkgs/servers/nosql/cassandra/3.0.nix
···
-
{ callPackage, ... } @ args:
callPackage ./generic.nix (
args
-
// builtins.fromJSON (builtins.readFile ./3.0.json)
// {
generation = "3_0";
})
···
+
{ callPackage, lib, ... } @ args:
callPackage ./generic.nix (
args
+
// lib.importJSON ./3.0.json
// {
generation = "3_0";
})
+2 -2
pkgs/servers/nosql/cassandra/3.11.nix
···
-
{ callPackage, ... } @ args:
callPackage ./generic.nix (
args
-
// builtins.fromJSON (builtins.readFile ./3.11.json)
// {
generation = "3_11";
})
···
+
{ callPackage, lib, ... } @ args:
callPackage ./generic.nix (
args
+
// lib.importJSON ./3.11.json
// {
generation = "3_11";
})
+2 -2
pkgs/servers/nosql/cassandra/4.nix
···
# GENERATED BY update.sh
-
{ callPackage, ... } @ args:
callPackage ./generic.nix (
args
-
// builtins.fromJSON (builtins.readFile ./4.json)
// {
generation = "4";
})
···
# GENERATED BY update.sh
+
{ callPackage, lib, ... } @ args:
callPackage ./generic.nix (
args
+
// lib.importJSON ./4.json
// {
generation = "4";
})
+1 -1
pkgs/tools/admin/google-cloud-sdk/components.nix
···
# A description of all available google-cloud-sdk components.
# It's a JSON file with a list of components, along with some metadata
-
snapshot = builtins.fromJSON (builtins.readFile snapshotPath);
# Generate a snapshot file for a single component. It has the same format as
# `snapshot`, but only contains a single component. These files are
···
# A description of all available google-cloud-sdk components.
# It's a JSON file with a list of components, along with some metadata
+
snapshot = lib.importJSON snapshotPath;
# Generate a snapshot file for a single component. It has the same format as
# `snapshot`, but only contains a single component. These files are
+1 -1
pkgs/tools/nix/npins/default.nix
···
let
runtimePath = lib.makeBinPath [ nix nix-prefetch-git git ];
-
sources = (builtins.fromJSON (builtins.readFile ./sources.json)).pins;
in rustPlatform.buildRustPackage rec {
pname = "npins";
version = src.version;
···
let
runtimePath = lib.makeBinPath [ nix nix-prefetch-git git ];
+
sources = (lib.importJSON ./sources.json).pins;
in rustPlatform.buildRustPackage rec {
pname = "npins";
version = src.version;
+1 -1
pkgs/tools/nix/npins/source.nix
···
# Usage:
# ```nix
# let
-
# sources = builtins.fromJSON (builtins.readFile ./sources.json);
# in mkMyDerivation rec {
# version = src.version; # This obviously only works for releases
# src = pkgs.npins.mkSource sources.mySource;
···
# Usage:
# ```nix
# let
+
# sources = lib.importJSON ./sources.json;
# in mkMyDerivation rec {
# version = src.version; # This obviously only works for releases
# src = pkgs.npins.mkSource sources.mySource;