{
  description = "cry64's dobutterfliescry.net";

  inputs = {
    systems.url = "github:nix-systems/default";

    nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
    nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
  };

  outputs = {
    self,
    nixpkgs,
    nixpkgs-unstable,
    ...
  } @ inputs: let
    systems = import inputs.systems;

    mkPkgs = pkgs: system:
      import pkgs {
        inherit system;
        allowUnfree = false;
        allowBroken = false;
        overlays = builtins.attrValues self.overlays or {};
      };

    forAllSystems = f:
      nixpkgs.lib.genAttrs systems (system:
        f system (mkPkgs nixpkgs system) (mkPkgs nixpkgs-unstable system));
  in {
    overlays.default = self: super: {
      dobutterfliescry-net = super.stdenv.mkDerivation {
        name = "dobutterfliescry.net";
        src = ./.;
        nativeBuildInputs = with super; [
          imagemagick
        ];

        installPhase = ''
          mkdir -p $out
          bash scripts/bakeimgs
          cp -r www $out/
        '';
      };
    };

    checks = self.packages;
    packages = forAllSystems (system: pkgs: upkgs: rec {
      default = dobutterfliescry-net;
      dobutterfliescry-net = pkgs.dobutterfliescry-net;
    });

    devShells = forAllSystems (system: pkgs: upkgs: let
      devPackages = with pkgs; [
        # dev local server
        simple-http-server

        # css baking
        ruby.devEnv
        rubyPackages_3_3.sass
        # image baking (from .svg)
        imagemagick
      ];
    in {
      default = pkgs.mkShell {
        packages = devPackages;
        shell = "${pkgs.bash}/bin/bash";
      };

      fhs =
        (pkgs.buildFHSEnv
          (pkgs.appimageTools.defaultFhsEnvArgs
            // {
              name = "dobutterfliescry.net-fhs";
              targetPkgs = devPackages;
              runScript = "bash";
              extraOutputsToInstall = ["dev"];
            })).env;
    });
  };
}
