Something went wrong. Try again.
Plays short audio files such as a terminal bell through PipeWire on Linux and WASAPI on Windows.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172# generated by zon2nix (https://github.com/jcollie/zon2nix){ lib, fetchgit, fetchurl, fetchzip, runCommand, zig_0_17, zstd, name ? "zig-packages", # Accepted and ignored. Expressions from zon2nix before 0.8 built the # packages with `linkFarm`, and some callers override it with a version that # copies, to work around Zig mishandling symlinked package directories # (https://codeberg.org/ziglang/zig/issues/32121). The packages are real # directories now, so the override is not needed, and is taken here only so # that passing it is not an error. linkFarm ? null,}:let # A git repository, checked out the way Zig reads it: every file as # committed. An ordinary checkout applies the repository's `.gitattributes`, # which can rewrite a file's line endings or run it through a filter, and # the package would then no longer match its hash. Pointing git at its # built-in empty tree for attributes turns them all off, and `core.autocrlf` # is turned off too, since it converts line endings even without them. # zon2nix computes the hash with exactly these settings. fetchZigGit = args: fetchgit ( args // { fetchSubmodules = false; preFetch = '' export GIT_ATTR_SOURCE=4b825dc642cb6eb9a060e54bf8d69288fbee4904 export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=core.autocrlf GIT_CONFIG_VALUE_0=false ''; } );
# Every package, by the hash Zig knows it by, as Nix fetches it. packages = { "flac-0.3.0-16osTGHcBQDqxVR-qhyvJhZ1vsH4wWNNUkyLB8VQDor4" = fetchZigGit { name = "flac"; url = "https://git.jcollie.dev/jeff/zig-flac.git"; rev = "89fffae87114a8d15329c95cde86b3a963fba16b"; hash = "sha256-OMp75Q46C1qn9ZVZGlPUuK6BQTyQ0gmyj/80t9mtVNc="; }; "N-V-__8AAADWXwF69u4_iufnV_gwfb3M2ATbbZF-yGFRrEFH" = fetchzip { name = "libopus"; url = "https://downloads.xiph.org/releases/opus/opus-1.5.2.tar.gz"; hash = "sha256-S7RhVT+YnTMwIbf9dVzk3VOvgfOqdIrdmqOSmwcfQ9s="; }; "zig_mp3-0.2.0-yG5WDJfgDgAhAmcQYpSUFiO1bfXoW9XpTOXgLRgmAFU6" = fetchZigGit { name = "mp3"; url = "https://git.jcollie.dev/jeff/zig-mp3.git"; rev = "630798ae9e98bffe641c44d70571f206421f4e24"; hash = "sha256-zkJZ0IbFp14+CNo9nKa2ParMp17oURNn2QMoHoFahno="; }; "ogg-0.3.0-AI2CC7inAgCAi7EVrxJdEgzXHSw4t3h3fr4IYA4W_dWw" = fetchZigGit { name = "ogg"; url = "https://git.jcollie.dev/jeff/zig-ogg.git"; rev = "705662b256cab123aa29bd020d7b8521a7a5760c"; hash = "sha256-/vFjt4Hmo9YVbBHm0qw5dDP0luJn4E8ccPG2nQqpbsY="; }; "opus-0.4.0-JoIcxmQyFwBPc8olZV40rXMhTxg5io5m5qsc0AUdTa6v" = fetchZigGit { name = "opus"; url = "https://git.jcollie.dev/jeff/zig-opus.git"; rev = "da36b08c851be33eaaf712c2b9aa93dc78512df1"; hash = "sha256-w19UWfvP8Mt8czkOUnVkMm5WcZd5wUDYst/p3/rFMX8="; }; "pipewire-0.2.0-lH35Hg-dBgAl54C6I1srRR_4pjWFIHkgWoqOtYY8aJ1g" = fetchZigGit { name = "pipewire"; url = "https://git.jcollie.dev/jeff/zig-pipewire.git"; rev = "b97236221878cae8cea64b46a912df8f342dad8c"; hash = "sha256-s2SW94jE233cVA48UTu2Pvt6BZS5cul3rB3VkOptdBo="; }; "riff-0.3.0-HAfI3hvpAAC0x2BglCLXC8KbAh-2QsqaM7iGWlOdcji3" = fetchZigGit { name = "riff"; url = "https://git.jcollie.dev/jeff/zig-riff.git"; rev = "95720d487115c285f5b890e5788499f3931a4d26"; hash = "sha256-zIhM3MRgivvegHV+PCPWofjb6H9UxvhAnKQl/60cZGI="; }; "wasapi-0.2.0-Y48zc6T8BgC7s-Eo-qUz5GDtxbwP4Qx80WZM0tchtr_p" = fetchZigGit { name = "wasapi"; url = "https://git.jcollie.dev/jeff/zig-wsapi.git"; rev = "ee982775975bb633ab60bbcb5cc8410dbb4ac7b5"; hash = "sha256-0maPb8x7EDLEGANHykMVhwKBxmfha4RzK8OYOYJlT8U="; }; "win32-42.0.39-preview-mX5pFc794wMcrMyFgsO1c4csBdowhpiqqwIyN_xjqI5z" = fetchzip { name = "win32"; url = "https://github.com/marlersoft/zigwin32/archive/fb2645891520f3e99931db17a7eba04057e87e89.tar.gz"; hash = "sha256-AHrMKAYCceE1V5PQHzdPnYljIzEQbDyyLvRVzRKGTn0="; }; };
# The packages whose own manifest declares a dependency by `.path`. Zig # 0.17.0 cannot build these through `zig build --system`: it roots the system # package directory at its absolute store path, so a `.path` dependency # inside one of these resolves to an absolute path, which it refuses with # "expected path relative to build root; found absolute path". A package # that wants `--system` copies each of these into its build root and passes # `--fork=` with a relative path; see the README. pathDependencyPackages = [ ];in# One directory holding every package the way Zig unpacks it -- filtered by# its manifest's `.paths` and checked against its hash -- which is what# `zig build --system` wants.## They have to be real directories holding real files, not links into each# package's own store path. Zig runs a dependency's build steps from inside# it and counts its way back out through `..`, which lands in the wrong place# when the directory is a symlink; and `installHeadersDirectory` copies only# what the directory walk calls a file, so symlinked headers are skipped# without a word. Building them all in one derivation gives real files from# the start, without a second copy of everything.## `runCommand` and not `runCommandLocal`: the result is worth taking from a# binary cache. Building it locally means first fetching a whole Zig, and# under 0.17 compiling its fetch build runner too, which is minutes on a small# CI machine; `runCommandLocal` forbids substituting it, so every job that# wants the packages builds them again even when a cache already holds them.runCommand name { nativeBuildInputs = [ zig_0_17 ]; passthru = { inherit pathDependencyPackages; }; } '' mkdir "$out"
# Zig 0.17 runs `zig fetch` in a build runner it compiles into the global # cache the first time, which takes a minute or more. Every package shares # one cache, then, and it is compiled once here before they are fetched # several at a time, rather than by each of them at once. export ZIG_GLOBAL_CACHE_DIR="$TMPDIR/cache" mkdir -p "$ZIG_GLOBAL_CACHE_DIR" zig fetch --help >/dev/null
# Without `--save`, which wants a project to save into, Zig 0.17 unpacks # nothing where it can be found: what it keeps is `p/<hash>.tar.gz` in # the global cache, the package filtered by its manifest's `.paths` under # a single directory named by its hash. Unpacking that gives the # directory `zig build --system` wants. unpack() { local work="$TMPDIR/work/$1" mkdir -p "$work"
local hash if ! hash="$(cd "$work" && zig fetch "$2" 2>"$work/log")"; then cat "$work/log" >&2 return 1 fi if [ "$hash" != "$1" ]; then echo "$2 is $hash to Zig, not $1" >&2 return 1 fi tar -xzf "$ZIG_GLOBAL_CACHE_DIR/p/$1.tar.gz" -C "$out" rm -f "$ZIG_GLOBAL_CACHE_DIR/p/$1.tar.gz" rm -rf "$work" } export -f unpack
# Several at a time: `zig fetch` spends most of a package on one core. # `-r` because otherwise xargs runs `unpack` once, with no arguments, when # there are no packages at all, and the build fails. cores="''${NIX_BUILD_CORES:-0}" if [ "$cores" -le 0 ]; then cores="$(nproc)"; fi xargs -r -P "$cores" -n 2 bash -c 'unpack "$@"' unpack <<'EOF' ${lib.concatStrings (lib.mapAttrsToList (hash: src: "${hash} ${src}\n") packages)} EOF ''