Something went wrong. Try again.
A CLI that shows which nixpkgs branches and channels a merged pull request has reached.
Something went wrong. Try again.
nix-track-pr flake.nix
3.0 kB · 98 lines
Nix
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899# SPDX-FileCopyrightText: © 2025 Jeffrey C. Ollie <jeff@ocjtech.us># SPDX-License-Identifier: MIT
{ description = "nix-track-pr";
inputs = { nixpkgs = { url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"; }; # The toolchain is the official 0.17.0 release binary, packaged by the # overlay, rather than nixpkgs' Zig, which has no 0.17 yet. zig = { url = "git+https://git.jcollie.dev/jeff/zig-overlay.git"; inputs = { nixpkgs.follows = "nixpkgs"; zon2nix.follows = "zon2nix"; }; }; # Reads build.zig.zon and writes the Nix expression that fetches every # dependency, so that a build in the sandbox needs no network. Not the # `zon2nix` in nixpkgs, which is a different program taking different # options. zon2nix = { url = "github:jcollie/zon2nix"; inputs = { nixpkgs.follows = "nixpkgs"; zig.follows = "zig"; }; }; };
outputs = { self, nixpkgs, zig, zon2nix, ... }: let packages = system: import nixpkgs { inherit system; }; forAllSystems = function: nixpkgs.lib.genAttrs [ "aarch64-linux" "aarch64-darwin" "x86_64-linux" ] (system: function (packages system)); zigFor = pkgs: zig.packages.${pkgs.stdenv.hostPlatform.system}."0.17.0";
# The dependency farm, generated from build.zig.zon by zon2nix. The # expression asks for `zig_0_17`, which nixpkgs does not have, so it is # handed the overlay's. zigDeps = pkgs: pkgs.callPackage ./build.zig.zon.nix { zig_0_17 = zigFor pkgs; };
# zon2nix shells out to `zig env`, and with no Zig on PATH it stops # having written nothing, which leaves the previous build.zig.zon.nix in # place looking untouched. Wrap it so the Zig it finds is this one. wrappedZon2nix = pkgs: pkgs.symlinkJoin { name = "zon2nix"; paths = [ zon2nix.packages.${pkgs.stdenv.hostPlatform.system}.zon2nix ]; nativeBuildInputs = [ pkgs.makeWrapper ]; postBuild = '' wrapProgram $out/bin/zon2nix \ --prefix PATH : ${pkgs.lib.makeBinPath [ (zigFor pkgs) ]} ''; }; in { packages = forAllSystems (pkgs: { default = self.packages.${pkgs.stdenv.hostPlatform.system}.nix-track-pr; nix-track-pr = pkgs.callPackage ./package.nix { zig = zigFor pkgs; zigDeps = zigDeps pkgs; }; zig-deps = zigDeps pkgs; }); devShells = forAllSystems (pkgs: { default = self.devShells.${pkgs.stdenv.hostPlatform.system}.zig_0_17; zig_0_17 = pkgs.mkShell { name = "nix-track-pr"; nativeBuildInputs = [ (zigFor pkgs) (wrappedZon2nix pkgs) pkgs.pinact pkgs.reuse ]; }; }); };}