diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d5172c..2f625c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,4 +14,5 @@ jobs: - name: Install Nix uses: DeterminateSystems/nix-installer-action@v2 - run: | + nix develop -c get-refs nix develop -c cargo run -- ./flake.bad.lock diff --git a/.gitignore b/.gitignore index 4d2afde..6b46650 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ result # Generated summary.md +src/policy.json diff --git a/flake.nix b/flake.nix index f8044ed..522fc55 100644 --- a/flake.nix +++ b/flake.nix @@ -10,6 +10,13 @@ inputs.rust-overlay.overlays.default (final: prev: { rustToolchain = prev.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; + + get-refs = prev.writeScriptBin "get-refs" '' + ${prev.curl}/bin/curl --fail --silent \ + 'https://monitoring.nixos.org/prometheus/api/v1/query?query=channel_revision' \ + | ${prev.jq}/bin/jq -r '{ "allowed_branches": [(.data.result[] | select(.metric.current == "1") | .metric.channel)] | sort, "max_days": 30 }' \ + > src/policy.json + ''; }) ]; systems = [ "aarch64-linux" "aarch64-darwin" "x86_64-linux" "x86_64-darwin" ]; @@ -26,6 +33,9 @@ cargo-edit cargo-watch rust-analyzer + + # Helpers + get-refs ]; }; }); diff --git a/src/policy.json b/src/policy.json index c657963..0e60662 100644 --- a/src/policy.json +++ b/src/policy.json @@ -1,5 +1,5 @@ { - "allowed_refs": [ + "allowed_branches": [ "nixos-22.11", "nixos-22.11-small", "nixos-unstable",