Skip to content

Commit

Permalink
treewide: switch builtins.fromJSON(builtins.readFile ./file.json) to …
Browse files Browse the repository at this point in the history
…lib.importJSON ./file.json #2
  • Loading branch information
SuperSandro2000 committed May 6, 2023
1 parent 24685bc commit 0000000
Show file tree
Hide file tree
Showing 20 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion doc/build-aux/pandoc-filters/link-manpages.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ pkgs ? import ../../.. {} }:
let
inherit (pkgs) lib;
manpageURLs = builtins.fromJSON (builtins.readFile (pkgs.path + "/doc/manpage-urls.json"));
manpageURLs = lib.importJSON (pkgs.path + "/doc/manpage-urls.json");
in pkgs.writeText "link-manpages.lua" ''
--[[
Adds links to known man pages that aren't already in a link.
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/emulators/retroarch/cores.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
}:

let
hashesFile = builtins.fromJSON (builtins.readFile ./hashes.json);
hashesFile = lib.importJSON ./hashes.json;

getCoreSrc = core:
fetchFromGitHub (builtins.getAttr core hashesFile);
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/networking/browsers/librewolf/src.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ fetchurl, fetchFromGitLab }:
let src = builtins.fromJSON (builtins.readFile ./src.json);
{ lib, fetchurl, fetchFromGitLab }:
let src = lib.importJSON ./src.json;
in
{
inherit (src) packageVersion;
Expand Down
4 changes: 2 additions & 2 deletions pkgs/build-support/flutter/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ let
packageOverrideRepository = (callPackage ../../development/compilers/flutter/package-overrides { }) // customPackageOverrides;
productPackages = builtins.filter (package: package.kind != "dev")
(if autoDepsList
then builtins.fromJSON (builtins.readFile deps.depsListFile)
then lib.importJSON deps.depsListFile
else
if depsListFile == null
then [ ]
else builtins.fromJSON (builtins.readFile depsListFile));
else lib.importJSON depsListFile);
in
builtins.foldl'
(prev: package:
Expand Down
2 changes: 1 addition & 1 deletion pkgs/data/misc/hackage/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# and callHackage
{ lib, fetchurl }:
let
pin = builtins.fromJSON (builtins.readFile ./pin.json);
pin = lib.importJSON ./pin.json;
in
fetchurl {
inherit (pin) url sha256;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/libraries/ndi/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ lib, stdenv, requireFile, avahi, obs-studio-plugins }:

let
versionJSON = builtins.fromJSON (builtins.readFile ./version.json);
versionJSON = lib.importJSON ./version.json;
in
stdenv.mkDerivation rec {
pname = "ndi";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

let
pname = "scala-cli";
sources = builtins.fromJSON (builtins.readFile ./sources.json);
sources = lib.importJSON ./sources.json;
inherit (sources) version assets;

platforms = builtins.attrNames assets;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/tools/mongosh/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}:

let
source = builtins.fromJSON (builtins.readFile ./source.json);
source = lib.importJSON ./source.json;
in
buildNpmPackage {
pname = "mongosh";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/tools/poetry2nix/poetry2nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let
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);
knownBuildSystems = lib.importJSON ./known-build-systems.json;
nixpkgsBuildSystems = lib.subtractLists [ "poetry" "poetry-core" ] knownBuildSystems;

mkInputAttrs =
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/tools/swiftpm2nix/support.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ in rec {
# Make packaging helpers from swiftpm2nix generated output.
helpers = generated: let
inherit (import generated) workspaceStateFile hashes;
workspaceState = builtins.fromJSON (builtins.readFile workspaceStateFile);
workspaceState = lib.importJSON workspaceStateFile;
pinFile = mkPinFile workspaceState;
in rec {

Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/tools/tabnine/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ stdenv, lib, fetchurl, unzip }:
let
sources = builtins.fromJSON (builtins.readFile ./sources.json);
sources = lib.importJSON ./sources.json;
platform =
if (builtins.hasAttr stdenv.hostPlatform.system sources.platforms) then
builtins.getAttr (stdenv.hostPlatform.system) sources.platforms
Expand Down
2 changes: 1 addition & 1 deletion pkgs/servers/invidious/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let
# * 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);
versions = lib.importJSON ./versions.json;
in
crystal.buildCrystalPackage rec {
pname = "invidious";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/servers/invidious/lsquic.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ lib, boringssl, stdenv, fetchgit, fetchFromGitHub, fetchurl, cmake, zlib, perl, libevent }:
let
versions = builtins.fromJSON (builtins.readFile ./versions.json);
versions = lib.importJSON ./versions.json;

fetchGitilesPatch = { name, url, sha256 }:
fetchurl {
Expand Down
4 changes: 2 additions & 2 deletions pkgs/servers/invidious/videojs.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ stdenvNoCC, cacert, crystal, openssl, pkg-config, invidious }:
{ lib, stdenvNoCC, cacert, crystal, openssl, pkg-config, invidious }:

let
versions = builtins.fromJSON (builtins.readFile ./versions.json);
versions = lib.importJSON ./versions.json;
in
stdenvNoCC.mkDerivation {
name = "videojs";
Expand Down
4 changes: 2 additions & 2 deletions pkgs/servers/nosql/cassandra/3.0.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ callPackage, ... } @ args:
{ callPackage, lib, ... } @ args:
callPackage ./generic.nix (
args
// builtins.fromJSON (builtins.readFile ./3.0.json)
// lib.importJSON ./3.0.json
// {
generation = "3_0";
})
4 changes: 2 additions & 2 deletions pkgs/servers/nosql/cassandra/3.11.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ callPackage, ... } @ args:
{ callPackage, lib, ... } @ args:
callPackage ./generic.nix (
args
// builtins.fromJSON (builtins.readFile ./3.11.json)
// lib.importJSON ./3.11.json
// {
generation = "3_11";
})
4 changes: 2 additions & 2 deletions pkgs/servers/nosql/cassandra/4.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# GENERATED BY update.sh
{ callPackage, ... } @ args:
{ callPackage, lib, ... } @ args:
callPackage ./generic.nix (
args
// builtins.fromJSON (builtins.readFile ./4.json)
// lib.importJSON ./4.json
// {
generation = "4";
})
2 changes: 1 addition & 1 deletion pkgs/tools/admin/google-cloud-sdk/components.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ let

# 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);
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
Expand Down
2 changes: 1 addition & 1 deletion pkgs/tools/nix/npins/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

let
runtimePath = lib.makeBinPath [ nix nix-prefetch-git git ];
sources = (builtins.fromJSON (builtins.readFile ./sources.json)).pins;
sources = (lib.importJSON ./sources.json).pins;
in rustPlatform.buildRustPackage rec {
pname = "npins";
version = src.version;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/tools/nix/npins/source.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Usage:
# ```nix
# let
# sources = builtins.fromJSON (builtins.readFile ./sources.json);
# sources = lib.importJSON ./sources.json;
# in mkMyDerivation rec {
# version = src.version; # This obviously only works for releases
# src = pkgs.npins.mkSource sources.mySource;
Expand Down

0 comments on commit 0000000

Please sign in to comment.