# SPDX-FileCopyrightText: © 2025 Jeffrey C. Ollie # SPDX-License-Identifier: MIT { description = "zig-dump1090"; 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; in { # An overlay so that `pkgs.zig-dump1090` resolves inside a NixOS # configuration, which is what the module's `package` option defaults to. overlays.default = final: _prev: { zig-dump1090 = final.callPackage ./package.nix { }; }; nixosModules.default = { imports = [ ./module.nix ]; nixpkgs.overlays = [ self.overlays.default ]; }; packages = forAllSystems ( system: let pkgs = makePackages system; in rec { zig-dump1090 = pkgs.callPackage ./package.nix { }; default = zig-dump1090; # Exposed on its own so that a workflow job can build something # other than the package -- the documentation, say -- without # building the package to get at the dependency set. zig-deps = pkgs.callPackage ./build.zig.zon.nix { }; } ); devShells = forAllSystems ( system: let pkgs = makePackages system; in { default = pkgs.mkShell { nativeBuildInputs = [ pkgs.git-pages-cli pkgs.pinact pkgs.reuse pkgs.zig_0_16 # Regenerate build.zig.zon.nix with: # nix develop -c zon2nix --16 --nix=build.zig.zon.nix build.zig.zon # # Wrapped so that the `zig env` it shells out to is this # project's Zig rather than whatever happens to be on PATH. # Without a Zig at all it writes nothing and leaves the previous # file looking untouched rather than obviously stale. (pkgs.symlinkJoin { name = "zon2nix"; paths = [ zon2nix.packages.${system}.zon2nix ]; nativeBuildInputs = [ pkgs.makeWrapper ]; postBuild = '' wrapProgram $out/bin/zon2nix \ --prefix PATH : ${lib.makeBinPath [ pkgs.zig_0_16 ]} ''; }) ]; }; } ); }; }