Something went wrong. Try again.
Sample-rate conversion for audio in Zig: any rate to any other, as a stream
Something went wrong. Try again.
zig-resample flake.nix
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293# SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie <jeff@ocjtech.us># SPDX-License-Identifier: MIT
{ description = "Sample-rate conversion for audio, in Zig";
inputs = { nixpkgs = { url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"; }; zon2nix = { url = "github:jcollie/zon2nix"; inputs.nixpkgs.follows = "nixpkgs"; }; };
outputs = { self, nixpkgs, zon2nix, ... }: let inherit (nixpkgs) lib; makePackages = system: import nixpkgs { inherit system; }; forAllSystems = lib.genAttrs lib.systems.flakeExposed;
# zon2nix shells out to `zig env`, and without a Zig on PATH it prints # "unable to execute zig, is it in your PATH?" and stops having written # nothing -- which leaves the previous build.zig.zon.nix in place looking # untouched rather than obviously broken. Wrap it so the Zig it finds is # this project's. wrappedZon2nix = pkgs: pkgs.symlinkJoin { name = "zon2nix"; paths = [ zon2nix.packages.${pkgs.stdenv.hostPlatform.system}.zon2nix ]; nativeBuildInputs = [ pkgs.makeWrapper ]; postBuild = '' wrapProgram $out/bin/zon2nix \ --prefix PATH : ${lib.makeBinPath [ pkgs.zig_0_17 ]} ''; }; in { devShells = forAllSystems ( system: let pkgs = makePackages system; in { default = pkgs.mkShell { name = "zig-resample"; nativeBuildInputs = [ (wrappedZon2nix pkgs) pkgs.git-pages-cli pkgs.pinact pkgs.reuse pkgs.zig_0_17 ]; }; } );
packages = forAllSystems ( system: let pkgs = makePackages system; in rec { zig-resample = pkgs.callPackage ./package.nix { }; default = zig-resample;
# The Zig dependency farm on its own, so a job that runs `zig build` # for something other than the package -- the documentation, say -- # can hand it straight to `--system`. zig-deps = pkgs.callPackage ./build.zig.zon.nix { }; } );
checks = forAllSystems (system: { zig-resample = (makePackages system).callPackage ./package.nix { }; });
formatter = forAllSystems (system: (makePackages system).nixfmt-tree); };}