Initial commit

This commit is contained in:
Oystein Kristoffer Tveit 2024-10-07 18:34:53 +02:00 committed by h7x4
commit 571295a3a1
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
5 changed files with 104 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
result

9
LICENSE Normal file
View File

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

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# nixpkgs-meta-dump
Beeeeg json

27
flake.lock Normal file
View File

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

64
flake.nix Normal file
View File

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