oxzy 0.3.0

Your oxidised fuzzer!
Documentation
{
  description = "Your oxidised fuzzer!";

  nixConfig = {
    extra-substituters = ["https://oxzy.cachix.org"];
    extra-trusted-public-keys = ["oxzy.cachix.org-1:ZDumoZJ9f1YTbu7n/mPVpcUkOroiUoKOuwNcbonsjb0="];
  };

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

    crane = {
      url = "github:ipetkov/crane";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    flake-utils.url = "github:numtide/flake-utils";

    advisory-db = {
      url = "github:rustsec/advisory-db";
      flake = false;
    };
  };

  outputs = {
    self,
    nixpkgs,
    crane,
    flake-utils,
    advisory-db,
    ...
  }:
    flake-utils.lib.eachDefaultSystem (system: let
      pkgs = import nixpkgs {
        inherit system;
      };

      inherit (pkgs) lib;

      craneLib = crane.lib.${system};
      src = lib.cleanSourceWith {
        src = ./.;
        filter = path: type:
          (lib.hasSuffix "\.wasm" path)
          || (lib.hasInfix "/rsc/" path)
          || (craneLib.filterCargoSources path type);
      };

      commonArgs = {
        inherit src;
        buildInputs = with pkgs;
          [
            pkg-config
            glib
            atk
            gtk3
            librsvg
            gtk-layer-shell
          ]
          ++ lib.optionals pkgs.stdenv.isDarwin [];
      };

      cargoArtifacts = craneLib.buildDepsOnly commonArgs;

      oxzy = craneLib.buildPackage (commonArgs
        // {
          inherit cargoArtifacts;
        });
    in {
      formatter = pkgs.alejandra;

      checks = {
        inherit oxzy;

        oxzy-clippy = craneLib.cargoClippy (commonArgs
          // {
            inherit cargoArtifacts;
            cargoClippyExtraArgs = "--all-targets -- --deny warnings";
          });

        oxzy-doc = craneLib.cargoDoc (commonArgs
          // {
            inherit cargoArtifacts;
          });

        oxzy-fmt = craneLib.cargoFmt {
          inherit src;
        };

        oxzy-audit = craneLib.cargoAudit {
          inherit src advisory-db;
        };
      };

      packages.default = oxzy;

      apps.default = flake-utils.lib.mkApp {
        name = "oxzy";
        drv = oxzy;
      };

      devShells.default = pkgs.mkShell {
        inputsFrom = builtins.attrValues self.checks.${system};

        nativeBuildInputs = with pkgs; [
          alejandra # nix formatter
          rustfmt # rust formatter
          statix # lints and suggestions
          deadnix # clean up unused nix code
          rustc # rust compiler
          gcc # GNU Compiler Collection
          cargo # rust package manager
          clippy # opinionated rust formatter
          bacon

          rust-analyzer # rust analyzer
          lldb # software debugger
        ];
      };
    });
}