search.forkos.org/packagesJSON.nix
2024-07-26 00:52:31 +02:00

19 lines
473 B
Nix

{ stdenv
, nixpkgs
, jq
, lix
}: stdenv.mkDerivation {
name = "packages.json";
src = nixpkgs;
buildInputs = [ jq lix ];
buildPhase = ''
NIX_STATE_DIR=$TMPDIR NIX_PATH= nix-env -f $src -qa --meta --json --show-trace --arg config "import $src/pkgs/top-level/packages-config.nix" | jq -e 'to_entries | map(.key as $k | .value + {"id":($k | gsub("[^a-zA-Z0-9-_]"; "-")), "name":$k})' > $out
'';
dontUnpack = true;
dontBuild = false;
doCheck = false;
}