commit 571295a3a13ad839f9c224943364e7664e32f88b Author: Oystein Kristoffer Tveit Date: Mon Oct 7 18:34:53 2024 +0200 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2be92b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7dfbfd1 --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2024 oysteikt + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..171defd --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# nixpkgs-meta-dump + +Beeeeg json diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..bef6b6a --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1728342757, + "narHash": "sha256-f5iwrocqHetkQs9HHbMoBTQ3VrvMES7hTs/AGt3QuYo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a0292317d85dce746ef501ac52f2cb461bd5496c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..8702251 --- /dev/null +++ b/flake.nix @@ -0,0 +1,64 @@ +{ + inputs.nixpkgs.url = "github:NixOS/nixpkgs/master"; + outputs = { self, nixpkgs }: let + pkgs = import nixpkgs { + system = "x86_64-linux"; + }; + inherit (nixpkgs) lib; + in { + packages."x86_64-linux".default = let + metadata = lib.pipe nixpkgs.legacyPackages."x86_64-linux" [ + (pkgs: builtins.removeAttrs pkgs [ "lib" ]) + (builtins.mapAttrs (_: pkg: if (builtins.tryEval pkg).success then pkg else null)) + (builtins.mapAttrs (_: pkg: if pkg ? meta then pkg.meta else null)) + (builtins.mapAttrs (_: meta: if (builtins.tryEval meta).success then meta else null)) + (lib.filterAttrs (_: meta: meta != null)) + (lib.filterAttrs (_: meta: !(lib.isDerivation meta))) + # (builtins.mapAttrs (_: meta: lib.traceValSeqN 1 (builtins.removeAttrs meta ["name"]))) + # (builtins.mapAttrs (_: lib.traceVal)) + (builtins.mapAttrs (_: meta: meta // { + name = if (builtins.tryEval meta.name or null).success then (meta.name or null) else "@EVAL_FAILURE@"; + })) + # (builtins.mapAttrs (name: + # (lib.filterAttrs (n: v: if builtins.isDerivation v then lib.trace "${name}.${n}" false else true)) + # )) + # (builtins.mapAttrs (name: + # (lib.filterAttrs (n: v: if builtins.isFunction v then lib.trace "${name}.${n}" false else true)) + # )) + (builtins.mapAttrs (_: meta: { + available = meta.available or null; + badPlatforms = meta.badPlatforms or []; + branch = meta.branch or null; + broken = meta.broken or null; + changelog = meta.changelog or null; + description = meta.description or null; + downloadPage = meta.downloadPage or null; + homepage = meta.homepage or null; + hydraPlatforms = meta.hydraPlatforms or []; + insecure = meta.insecure or null; + license = meta.license or []; + longDescription = meta.longDescription or null; + mainProgram = meta.mainProgram or null; + maintainers = meta.maintainers or []; + name = if (builtins.tryEval meta.name or null).success then (meta.name or null) else "@EVAL_FAILURE@"; + outputsToInstall = meta.outputsToInstall or []; + pkgConfigModules = meta.pkgConfigModules or []; + platforms = meta.platforms or []; + position = meta.position or null; + priority = meta.priority or null; + sourceProvenance = meta.sourceProvenance or []; + timeout = meta.timeout or null; + unfree = meta.unfree or null; + unsupported = meta.unsupported or null; + })) + ]; + in pkgs.runCommandLocal "nixpkgs-meta.json" { + metadata = builtins.toJSON metadata; + # metadata = builtins.toJSON (lib.foldl' (acc: meta: acc // meta) { } (builtins.attrValues metadata)) + passAsFile = [ "metadata" ]; + nativeBuildInputs = [ pkgs.jq ]; + } '' + jq <"$metadataPath" >"$out" + ''; + }; +}