littlebiglogicengine/flake.nix
2025-02-11 07:55:25 -07:00

41 lines
1.4 KiB
Nix

{
inputs = {
zig2nix.url = "github:Cloudef/zig2nix";
};
outputs = { zig2nix, ... }: let
flake-utils = zig2nix.inputs.flake-utils;
in (flake-utils.lib.eachDefaultSystem (system: let
env = zig2nix.outputs.zig-env.${system} { zig = zig2nix.outputs.packages.${system}.zig.master.bin; };
system-triple = env.lib.zigTripleFromString system;
in with builtins; with env.lib; with env.pkgs.lib; rec {
packages.target = genAttrs allTargetTriples (target: env.packageForTarget target ({
src = cleanSource ./.;
nativeBuildInputs = with env.pkgs; [];
buildInputs = with env.pkgsForTarget target; [];
zigPreferMusl = true;
zigDisableWrap = true;
}));
packages.default = packages.target.${system-triple}.override {
zigPreferMusl = false;
zigDisableWrap = false;
};
apps.bundle.default = apps.bundle.target.${system-triple};
apps.default = env.app [] "zig build run -- \"$@\"";
apps.build = env.app [] "zig build \"$@\"";
apps.test = env.app [] "zig build test -- \"$@\"";
apps.docs = env.app [] "zig build docs -- \"$@\"";
apps.deps = env.showExternalDeps;
apps.zon2json = env.app [env.zon2json] "zon2json \"$@\"";
apps.zon2json-lock = env.app [env.zon2json-lock] "zon2json-lock \"$@\"";
apps.zon2nix = env.app [env.zon2nix] "zon2nix \"$@\"";
devShells.default = env.mkShell {};
}));
}