3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #230177 from SuperSandro2000/lib-fromJSON-2

treewide: switch builtins.fromJSON(builtins.readFile ./file.json) to …
This commit is contained in:
figsoda 2023-05-06 14:12:43 -04:00 committed by GitHub
commit 955f4f6512
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 26 additions and 26 deletions

View file

@ -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.

View file

@ -42,7 +42,7 @@
}:
let
hashesFile = builtins.fromJSON (builtins.readFile ./hashes.json);
hashesFile = lib.importJSON ./hashes.json;
getCoreSrc = core:
fetchFromGitHub (builtins.getAttr core hashesFile);

View file

@ -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;

View file

@ -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:

View file

@ -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;

View file

@ -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";

View file

@ -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;

View file

@ -6,7 +6,7 @@
}:
let
source = builtins.fromJSON (builtins.readFile ./source.json);
source = lib.importJSON ./source.json;
in
buildNpmPackage {
pname = "mongosh";

View file

@ -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 =

View file

@ -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 {

View file

@ -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

View file

@ -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";

View file

@ -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 {

View file

@ -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";

View file

@ -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";
})

View file

@ -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";
})

View file

@ -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";
})

View file

@ -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

View file

@ -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;

View file

@ -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;