{
  inputs = {
    nixpkgs.url = "nixpkgs/nixos-23.05";
    nixpkgs-unstable.url = "nixpkgs/nixpkgs-unstable";

    vampysite.url = "git+https://git.lain.faith/sorceress/vampysite";

    home-manager = {
      url = "github:nix-community/home-manager/release-23.05";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    mms = {
      url = "github:mkaito/nixos-modded-minecraft-servers";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    url-eater = {
      url = "github:AgathaSorceress/url-eater";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
    };

    colorpickle = {
      url = "github:AgathaSorceress/colorpickle";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
    };

    matrix-ril100 = {
      url = "git+https://git.lain.faith/sorceress/matrix-ril100";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
    };

    # Latest colmena + prettier loading icons
    colmena = {
      url = "github:AgathaSorceress/colmena";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
    };

    frq-friend = {
      url = "git+https://git.xenua.me/xenua/fedi-frq-friend";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
    };

    spicetify-nix = {
      url = "github:the-argus/spicetify-nix";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
    };

    helix = {
      url = "github:helix-editor/helix";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
    };

    ccase = {
      url = "github:rutrum/ccase";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
    };
  };
  outputs = { nixpkgs, nixpkgs-unstable, home-manager, mms, helix, url-eater
    , colorpickle, matrix-ril100, frq-friend, colmena, vampysite, spicetify-nix
    , ccase, ... }: {
      colmena = let
        mkDesktop = hostname: {
          imports = [
            ./common
            ./hosts/${hostname}/configuration.nix
            ./common/options.nix
            (import "${home-manager}/nixos")
            url-eater.nixosModule
            colorpickle.nixosModules.default
            spicetify-nix.nixosModule
          ];

          deployment = {
            targetUser = "root";
            targetHost = hostname;

            tags = [ "home" ];

            allowLocalDeployment = true;

            keys = {
              "restic-password" = {
                keyCommand = [ "cat" "./secrets/restic-password" ];
                destDir = "/var/lib/secrets/";
              };
              "restic-env" = {
                keyCommand = [ "cat" "./secrets/restic-env" ];
                destDir = "/var/lib/secrets/";
              };
            };
          };
        };
      in {
        network = {
          description = "Agatha's Nix Infra";

          nixpkgs = import nixpkgs rec {
            system = "x86_64-linux";
            overlays = [
              (final: prev: {
                helix = let helix-pkgs = helix.packages.${final.system};
                in helix-pkgs.helix.passthru.wrapper
                (helix-pkgs.helix-unwrapped.overrideAttrs {
                  preInstall = ''
                    substituteInPlace contrib/Helix.desktop \
                      --replace "Exec=hx %F" "Exec=kitty hx %F" \
                      --replace "Terminal=true" "Terminal=false"
                  '';
                });
                colorpickle = colorpickle.packages.${final.system}.default;
                frq-friend = frq-friend.defaultPackage.${final.system};
                vampysite = vampysite.packages.${final.system}.default;
                spicetify-pkgs = spicetify-nix.packages.${final.system}.default;
                matrix-ril100 = matrix-ril100.packages.${final.system}.default;
                ccase = ccase.packages.${final.system}.default;

                # Unstable packages
                unstable = import nixpkgs-unstable { inherit system; };
              })
              colmena.overlay
            ];
          };
        };

        bloodletting = {
          imports = [
            ./common
            ./hosts/bloodletting/configuration.nix
            (import "${home-manager}/nixos")
            mms.module
            "${nixpkgs-unstable}/nixos/modules/services/web-apps/mastodon.nix"
          ];

          disabledModules = [ "services/web-apps/mastodon.nix" ];

          deployment = {
            targetUser = "root";
            targetHost = "bloodletting";

            tags = [ "prod" ];

            keys = {
              "nyandroid-token" = {
                keyCommand = [ "cat" "./secrets/nyandroid-token" ];
                destDir = "/var/lib/secrets/";
              };
              "rfc2136-technogothic-net" = {
                keyCommand = [ "cat" "./secrets/rfc2136-technogothic-net" ];
                destDir = "/var/lib/secrets/";
              };
              "fedi-data.toml" = {
                keyCommand = [ "cat" "./secrets/frq-friend-fedi-data.toml" ];
                destDir = "/var/lib/frq-friend";
              };
              "ril100-bot-secrets" = {
                keyCommand = [ "cat" "./secrets/ril100-bot-secrets" ];
                destDir = "/var/lib/matrix-ril100";
                name = ".env";
              };
            };
          };
        };

        ritual = mkDesktop "ritual";
        tears = mkDesktop "tears";
      };
      devShells."x86_64-linux".default =
        let pkgs = import nixpkgs { system = "x86_64-linux"; };
        in pkgs.mkShell {
          buildInputs = [
            (pkgs.writeShellScriptBin "colmena" ''
              ${
                colmena.defaultPackage.${pkgs.system}
              }/bin/colmena --disable-emoji $@
            '')
          ];
        };
    };
}
