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 ../../.. {} }: { pkgs ? import ../../.. {} }:
let let
inherit (pkgs) lib; 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" '' in pkgs.writeText "link-manpages.lua" ''
--[[ --[[
Adds links to known man pages that aren't already in a link. Adds links to known man pages that aren't already in a link.

View file

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

View file

@ -1,5 +1,5 @@
{ fetchurl, fetchFromGitLab }: { lib, fetchurl, fetchFromGitLab }:
let src = builtins.fromJSON (builtins.readFile ./src.json); let src = lib.importJSON ./src.json;
in in
{ {
inherit (src) packageVersion; inherit (src) packageVersion;

View file

@ -135,11 +135,11 @@ let
packageOverrideRepository = (callPackage ../../development/compilers/flutter/package-overrides { }) // customPackageOverrides; packageOverrideRepository = (callPackage ../../development/compilers/flutter/package-overrides { }) // customPackageOverrides;
productPackages = builtins.filter (package: package.kind != "dev") productPackages = builtins.filter (package: package.kind != "dev")
(if autoDepsList (if autoDepsList
then builtins.fromJSON (builtins.readFile deps.depsListFile) then lib.importJSON deps.depsListFile
else else
if depsListFile == null if depsListFile == null
then [ ] then [ ]
else builtins.fromJSON (builtins.readFile depsListFile)); else lib.importJSON depsListFile);
in in
builtins.foldl' builtins.foldl'
(prev: package: (prev: package:

View file

@ -2,7 +2,7 @@
# and callHackage # and callHackage
{ lib, fetchurl }: { lib, fetchurl }:
let let
pin = builtins.fromJSON (builtins.readFile ./pin.json); pin = lib.importJSON ./pin.json;
in in
fetchurl { fetchurl {
inherit (pin) url sha256; inherit (pin) url sha256;

View file

@ -1,7 +1,7 @@
{ lib, stdenv, requireFile, avahi, obs-studio-plugins }: { lib, stdenv, requireFile, avahi, obs-studio-plugins }:
let let
versionJSON = builtins.fromJSON (builtins.readFile ./version.json); versionJSON = lib.importJSON ./version.json;
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "ndi"; pname = "ndi";

View file

@ -12,7 +12,7 @@
let let
pname = "scala-cli"; pname = "scala-cli";
sources = builtins.fromJSON (builtins.readFile ./sources.json); sources = lib.importJSON ./sources.json;
inherit (sources) version assets; inherit (sources) version assets;
platforms = builtins.attrNames assets; platforms = builtins.attrNames assets;

View file

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

View file

@ -17,7 +17,7 @@ let
toPluginAble = (import ./plugins.nix { inherit pkgs lib; }).toPluginAble; toPluginAble = (import ./plugins.nix { inherit pkgs lib; }).toPluginAble;
# List of known build systems that are passed through from nixpkgs unmodified # 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; nixpkgsBuildSystems = lib.subtractLists [ "poetry" "poetry-core" ] knownBuildSystems;
mkInputAttrs = mkInputAttrs =

View file

@ -19,7 +19,7 @@ in rec {
# Make packaging helpers from swiftpm2nix generated output. # Make packaging helpers from swiftpm2nix generated output.
helpers = generated: let helpers = generated: let
inherit (import generated) workspaceStateFile hashes; inherit (import generated) workspaceStateFile hashes;
workspaceState = builtins.fromJSON (builtins.readFile workspaceStateFile); workspaceState = lib.importJSON workspaceStateFile;
pinFile = mkPinFile workspaceState; pinFile = mkPinFile workspaceState;
in rec { in rec {

View file

@ -1,6 +1,6 @@
{ stdenv, lib, fetchurl, unzip }: { stdenv, lib, fetchurl, unzip }:
let let
sources = builtins.fromJSON (builtins.readFile ./sources.json); sources = lib.importJSON ./sources.json;
platform = platform =
if (builtins.hasAttr stdenv.hostPlatform.system sources.platforms) then if (builtins.hasAttr stdenv.hostPlatform.system sources.platforms) then
builtins.getAttr (stdenv.hostPlatform.system) sources.platforms builtins.getAttr (stdenv.hostPlatform.system) sources.platforms

View file

@ -12,7 +12,7 @@ let
# * update lsquic and boringssl if necessarry, lsquic.cr depends on # * update lsquic and boringssl if necessarry, lsquic.cr depends on
# the same version of lsquic and lsquic requires the boringssl # the same version of lsquic and lsquic requires the boringssl
# commit mentioned in its README # commit mentioned in its README
versions = builtins.fromJSON (builtins.readFile ./versions.json); versions = lib.importJSON ./versions.json;
in in
crystal.buildCrystalPackage rec { crystal.buildCrystalPackage rec {
pname = "invidious"; pname = "invidious";

View file

@ -1,6 +1,6 @@
{ lib, boringssl, stdenv, fetchgit, fetchFromGitHub, fetchurl, cmake, zlib, perl, libevent }: { lib, boringssl, stdenv, fetchgit, fetchFromGitHub, fetchurl, cmake, zlib, perl, libevent }:
let let
versions = builtins.fromJSON (builtins.readFile ./versions.json); versions = lib.importJSON ./versions.json;
fetchGitilesPatch = { name, url, sha256 }: fetchGitilesPatch = { name, url, sha256 }:
fetchurl { fetchurl {

View file

@ -1,7 +1,7 @@
{ stdenvNoCC, cacert, crystal, openssl, pkg-config, invidious }: { lib, stdenvNoCC, cacert, crystal, openssl, pkg-config, invidious }:
let let
versions = builtins.fromJSON (builtins.readFile ./versions.json); versions = lib.importJSON ./versions.json;
in in
stdenvNoCC.mkDerivation { stdenvNoCC.mkDerivation {
name = "videojs"; name = "videojs";

View file

@ -1,7 +1,7 @@
{ callPackage, ... } @ args: { callPackage, lib, ... } @ args:
callPackage ./generic.nix ( callPackage ./generic.nix (
args args
// builtins.fromJSON (builtins.readFile ./3.0.json) // lib.importJSON ./3.0.json
// { // {
generation = "3_0"; generation = "3_0";
}) })

View file

@ -1,7 +1,7 @@
{ callPackage, ... } @ args: { callPackage, lib, ... } @ args:
callPackage ./generic.nix ( callPackage ./generic.nix (
args args
// builtins.fromJSON (builtins.readFile ./3.11.json) // lib.importJSON ./3.11.json
// { // {
generation = "3_11"; generation = "3_11";
}) })

View file

@ -1,8 +1,8 @@
# GENERATED BY update.sh # GENERATED BY update.sh
{ callPackage, ... } @ args: { callPackage, lib, ... } @ args:
callPackage ./generic.nix ( callPackage ./generic.nix (
args args
// builtins.fromJSON (builtins.readFile ./4.json) // lib.importJSON ./4.json
// { // {
generation = "4"; generation = "4";
}) })

View file

@ -38,7 +38,7 @@ let
# A description of all available google-cloud-sdk components. # A description of all available google-cloud-sdk components.
# It's a JSON file with a list of components, along with some metadata # 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 # Generate a snapshot file for a single component. It has the same format as
# `snapshot`, but only contains a single component. These files are # `snapshot`, but only contains a single component. These files are

View file

@ -15,7 +15,7 @@
let let
runtimePath = lib.makeBinPath [ nix nix-prefetch-git git ]; 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 { in rustPlatform.buildRustPackage rec {
pname = "npins"; pname = "npins";
version = src.version; version = src.version;

View file

@ -3,7 +3,7 @@
# Usage: # Usage:
# ```nix # ```nix
# let # let
# sources = builtins.fromJSON (builtins.readFile ./sources.json); # sources = lib.importJSON ./sources.json;
# in mkMyDerivation rec { # in mkMyDerivation rec {
# version = src.version; # This obviously only works for releases # version = src.version; # This obviously only works for releases
# src = pkgs.npins.mkSource sources.mySource; # src = pkgs.npins.mkSource sources.mySource;