setup-windows / test (pull_request) Successful in 27s
windows-drivers / probe-and-proto (pull_request) Successful in 16s
ci / web (pull_request) Successful in 57s
ci / decky-typecheck (pull_request) Successful in 14s
ci / sdk-plugin-kit (pull_request) Successful in 26s
ci / bun-nix (pull_request) Successful in 27s
ci / docs-drift (pull_request) Successful in 31s
installer-smoke / omarchy integration self-check (pull_request) Successful in 5s
windows-drivers / driver-build (pull_request) Successful in 2m44s
installer-smoke / build punktfunk-setup (musl) (pull_request) Successful in 3m53s
secret-scan / gitleaks (pull_request) Successful in 17s
ci / docs-site (pull_request) Successful in 7m37s
nix / flake (pull_request) Successful in 9m54s
installer-smoke / smoke (arch) (pull_request) Failing after 12s
installer-smoke / smoke (debian-13) (pull_request) Failing after 17s
installer-smoke / omarchy (armed update guard) (pull_request) Successful in 50s
installer-smoke / smoke (fedora-44) (pull_request) Failing after 33s
ci / rust-arm64 (pull_request) Successful in 23m30s
android / android (pull_request) Successful in 26m16s
ci / rust (pull_request) Successful in 38m41s
apple / swift (pull_request) Successful in 7m5s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
The host links no libavcodec since the encode backends went native, so the packages can stop carrying it: the .deb no longer bundles a from-source FFmpeg behind a patched rpath, the Arch package no longer pins seven libav sonames, the RPM no longer needs RPM Fusion at build time, and the Windows runner no longer fetches a BtbN tree. The CI images lose their libav dev packages with it, and the SteamOS installer loses the FFmpeg it compiled on device. Two guards go with the dependency they guarded. The Arch soname-parity and soname-pin steps existed because pacman does not derive deps from DT_NEEDED, so an FFmpeg major could walk a box past the host's link; with no libav link there is nothing to pin. The install gate that asks whether a pristine Arch box can satisfy the built package stays, and it is the one that would catch the next such break. The Ubuntu 24.04 builder image survives its FFmpeg: it is still what lowers the host's glibc floor to 2.39, which is the other half of why one .deb installs across three Ubuntu releases.
217 lines
7.8 KiB
Nix
217 lines
7.8 KiB
Nix
{
|
|
description = "punktfunk — low-latency desktop/game streaming host + native Linux client";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
crane.url = "github:ipetkov/crane";
|
|
rust-overlay = {
|
|
url = "github:oxalica/rust-overlay";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
# The bun packages' node_modules (punktfunk-web, punktfunk-scripting): one fetchurl per package,
|
|
# straight out of `bun.lock`'s integrity hashes — no hand-maintained aggregate deps hash to bump.
|
|
# PIN THE TAG. `bun.nix` has no schema stability guarantee across bun2nix versions, so this ref
|
|
# must move together with the `bun2nix` devDependency in web/package.json + sdk/package.json
|
|
# (which regenerates the file on every `bun install`). See packaging/nix/README.md.
|
|
bun2nix = {
|
|
url = "github:nix-community/bun2nix?ref=2.1.2";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
nixpkgs,
|
|
crane,
|
|
rust-overlay,
|
|
bun2nix,
|
|
}:
|
|
let
|
|
# Linux/x86_64 only — the host encodes with desktop NVENC and CI publishes no aarch64 leg
|
|
# (mirrors the RPM's `ExclusiveArch: x86_64`). Add a system here once there's an arm64 build.
|
|
systems = [ "x86_64-linux" ];
|
|
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
|
|
|
|
# The workspace version is the single source of truth (crates/*/Cargo.toml inherit it).
|
|
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).workspace.package.version;
|
|
|
|
pkgsFor =
|
|
system:
|
|
import nixpkgs {
|
|
inherit system;
|
|
overlays = [ (import rust-overlay) ];
|
|
};
|
|
|
|
# Pin cargo/rustc EXACTLY to rust-toolchain.toml (channel 1.96.0 + rustfmt/clippy) so a Nix
|
|
# build, a dev shell and CI all use the identical toolchain — the repo is deliberate about
|
|
# this (see rust-toolchain.toml's header on rustfmt format-drift).
|
|
toolchainFor = pkgs: pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
|
|
|
craneLibFor = pkgs: (crane.mkLib pkgs).overrideToolchain toolchainFor;
|
|
|
|
packagesFor =
|
|
system:
|
|
let
|
|
pkgs = pkgsFor system;
|
|
in
|
|
pkgs.callPackage ./packaging/nix/packages.nix {
|
|
craneLib = craneLibFor pkgs;
|
|
src = self;
|
|
inherit version;
|
|
# `.hook` + `.fetchBunDeps` (bun2nix v2 API) — see packages.nix.
|
|
bun2nix = bun2nix.packages.${system}.default;
|
|
}
|
|
// {
|
|
# gamescope + our `pipewire-hdr` patches, so the gamescope backend can stream HDR.
|
|
# Kept OUT of packages.nix (a Rust/crane file) — it is a C++ meson override with a
|
|
# disjoint dependency set — and out of `checks` below, because it rebuilds gamescope
|
|
# from source and would make `nix flake check` an hour long.
|
|
punktfunk-gamescope = pkgs.callPackage ./packaging/nix/gamescope.nix {
|
|
patchDir = ./packaging/gamescope/patches;
|
|
# Shared verbatim with build-punktfunk-gamescope.sh, which is the whole reason it is a
|
|
# file: the FHS packages and the Nix store must rename the WSI layer identically, or
|
|
# the host looks for a layer name that only one of them produces.
|
|
manifestRewriter = ./packaging/gamescope/rewrite-wsi-layer-manifest.py;
|
|
};
|
|
};
|
|
in
|
|
{
|
|
packages = forAllSystems (
|
|
system:
|
|
let
|
|
pf = packagesFor system;
|
|
in
|
|
{
|
|
inherit (pf)
|
|
punktfunk-host
|
|
punktfunk-client
|
|
punktfunk-web
|
|
punktfunk-scripting
|
|
punktfunk-tray
|
|
punktfunk-gamescope
|
|
;
|
|
default = pf.punktfunk-host;
|
|
}
|
|
);
|
|
|
|
# `nix run .#punktfunk-host -- serve` / `nix run .#punktfunk-client`.
|
|
apps = forAllSystems (
|
|
system:
|
|
let
|
|
pf = packagesFor system;
|
|
in
|
|
{
|
|
punktfunk-host = {
|
|
type = "app";
|
|
program = "${pf.punktfunk-host}/bin/punktfunk-host";
|
|
};
|
|
punktfunk-client = {
|
|
type = "app";
|
|
program = "${pf.punktfunk-client}/bin/punktfunk-client";
|
|
};
|
|
# `nix run .#punktfunk-web` — the console (auto-wire the mgmt token / cert via env or the
|
|
# NixOS module; see packaging/nix/README.md).
|
|
punktfunk-web = {
|
|
type = "app";
|
|
program = "${pf.punktfunk-web}/bin/punktfunk-web-server";
|
|
};
|
|
# `nix run .#punktfunk-scripting -- --list` — the plugin/script runner.
|
|
punktfunk-scripting = {
|
|
type = "app";
|
|
program = "${pf.punktfunk-scripting}/bin/punktfunk-scripting";
|
|
};
|
|
default = self.apps.${system}.punktfunk-host;
|
|
}
|
|
);
|
|
|
|
# `nix flake check` builds every package.
|
|
checks = forAllSystems (
|
|
system:
|
|
let
|
|
pf = packagesFor system;
|
|
pkgs = pkgsFor system;
|
|
in
|
|
{
|
|
inherit (pf)
|
|
punktfunk-host
|
|
punktfunk-client
|
|
punktfunk-web
|
|
punktfunk-scripting
|
|
;
|
|
|
|
# The NixOS module, actually evaluated. `nix flake check` does NOT do this for
|
|
# `nixosModules` — it only forces the value and asserts it is a lambda taking an open
|
|
# attribute set, so a module with a nonexistent option, a nonexistent `pkgs` attribute
|
|
# and a nonexistent `lib` function passes clean (measured). Routing the module through a
|
|
# `checks` entry instead means the eval-only CI leg has to instantiate it, and every
|
|
# assertion in module-check.nix is pure Nix so instantiation is enough to run them.
|
|
nixos-module = pkgs.callPackage ./packaging/nix/module-check.nix {
|
|
inherit nixpkgs system;
|
|
module = import ./packaging/nix/nixos-module.nix;
|
|
};
|
|
}
|
|
);
|
|
|
|
# `nix develop` — the pinned toolchain plus every system lib the workspace links, wired so
|
|
# `cargo build` (all crates, host + client) works out of the box.
|
|
devShells = forAllSystems (
|
|
system:
|
|
let
|
|
pkgs = pkgsFor system;
|
|
toolchain = toolchainFor pkgs;
|
|
gbm = pkgs.libgbm or pkgs.mesa;
|
|
in
|
|
{
|
|
default = pkgs.mkShell {
|
|
strictDeps = false;
|
|
nativeBuildInputs = [
|
|
toolchain
|
|
pkgs.rust-analyzer
|
|
pkgs.pkg-config
|
|
pkgs.cmake
|
|
pkgs.nasm
|
|
pkgs.perl
|
|
pkgs.rustPlatform.bindgenHook
|
|
];
|
|
buildInputs = [
|
|
# host
|
|
pkgs.pipewire
|
|
pkgs.libopus
|
|
pkgs.wayland
|
|
pkgs.libxkbcommon
|
|
pkgs.libGL
|
|
gbm
|
|
pkgs.vulkan-loader
|
|
# client
|
|
pkgs.sdl3
|
|
pkgs.gtk4
|
|
pkgs.libadwaita
|
|
pkgs.glib
|
|
pkgs.librsvg
|
|
pkgs.gsettings-desktop-schemas
|
|
pkgs.adwaita-icon-theme
|
|
];
|
|
# CMake ≥ 4 rejects the pre-3.5 minimums some vendored C libs (libopus) still declare.
|
|
CMAKE_POLICY_VERSION_MINIMUM = "3.5";
|
|
LD_LIBRARY_PATH = "/run/opengl-driver/lib:${
|
|
pkgs.lib.makeLibraryPath [
|
|
pkgs.vulkan-loader
|
|
pkgs.libGL
|
|
gbm
|
|
]
|
|
}";
|
|
};
|
|
}
|
|
);
|
|
|
|
formatter = forAllSystems (system: (pkgsFor system).nixfmt-rfc-style);
|
|
|
|
# NixOS integration — see packaging/nix/nixos-module.nix and packaging/nix/README.md.
|
|
# imports = [ punktfunk.nixosModules.default ];
|
|
# services.punktfunk.host.enable = true;
|
|
nixosModules.default = import ./packaging/nix/nixos-module.nix self;
|
|
nixosModules.punktfunk = self.nixosModules.default;
|
|
};
|
|
}
|