1# The supported PostgreSQL majors, read from `PG_MAJORS` in 2# build/defs.bzl, the one place they are written (the Cargo manifests, 3# the flake's package sets and nix/package.nix all follow it). 4# `default` is the last (newest), the major third-party/Cargo.toml 5# selects for buck's own graph. 6{ lib }: 7let 8 m = builtins.match ''.*PG_MAJORS = \[([^]]*)].*'' ( 9 lib.replaceStrings [ "\n" ] [ " " ] (builtins.readFile ../build/defs.bzl) 10 ); 11 all = 12 if m == null then 13 throw "nix/majors.nix: build/defs.bzl has no PG_MAJORS list" 14 else 15 map (s: lib.head (builtins.match ''[[:space:]]*"([0-9]+)"[[:space:]]*'' s)) ( 16 lib.filter (s: builtins.match "[[:space:]]*" s == null) (lib.splitString "," (lib.head m)) 17 ); 18in 19{ 20 inherit all; 21 default = lib.last all; 22}