{
  description = "A very basic flake";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
    flake-base = {
      url = "git+https://khs.codes/nix/flake-base";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        treefmt-nix.follows = "treefmt-nix";
      };
    };
    flake-utils = {
      url = "github:numtide/flake-utils";
      inputs = {
        systems.follows = "systems";
      };
    };
    flake-parts = {
      url = "github:hercules-ci/flake-parts";
    };
    disko = {
      url = "github:nix-community/disko";
      inputs = {
        nixpkgs.follows = "nixpkgs";
      };
    };
    terranix = {
      url = "github:terranix/terranix";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        flake-parts.follows = "flake-parts";
      };
    };
    home-manager = {
      url = "github:nix-community/home-manager/release-25.05";
      inputs = {
        nixpkgs.follows = "nixpkgs";
      };
    };
    terranix-hcloud = {
      url = "github:terranix/terranix-hcloud";
      inputs = {
        flake-utils.follows = "flake-utils";
        nixpkgs.follows = "nixpkgs";
        terranix.follows = "terranix";
      };
    };
    systems = {
      url = "github:nix-systems/default";
    };
    crane.url = "github:ipetkov/crane";
    advisory-db = {
      url = "github:rustsec/advisory-db";
      flake = false;
    };
    rust-overlay = {
      url = "github:oxalica/rust-overlay";
      inputs = {
        nixpkgs.follows = "nixpkgs";
      };
    };
    treefmt-nix = {
      url = "github:numtide/treefmt-nix";
      inputs = {
        nixpkgs.follows = "nixpkgs";
      };
    };
    nixos-anywhere = {
      url = "github:nix-community/nixos-anywhere/1.11.0";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        flake-parts.follows = "flake-parts";
        treefmt-nix.follows = "treefmt-nix";
        disko.follows = "disko";
      };
    };
    stylix = {
      url = "github:nix-community/stylix/release-25.05";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        flake-parts.follows = "flake-parts";
        systems.follows = "systems";
      };
    };
    cosmic-manager = {
      url = "github:HeitorAugustoLN/cosmic-manager";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        home-manager.follows = "home-manager";
        flake-parts.follows = "flake-parts";
      };
    };
    simple-nixos-mailserver = {
      url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-25.05";
      inputs = {
        nixpkgs.follows = "nixpkgs";
      };
    };
  };

  outputs =
    inputs:
    let
      inputNixosModules = [
        inputs.disko.nixosModules.disko
        inputs.stylix.nixosModules.stylix
      ];
      inputHomeModules = [
        inputs.cosmic-manager.homeManagerModules.cosmic-manager
      ];
      allowUnfreePackages = [
        "spotify"
        "google-chrome"
        "terraform"
      ];
    in
    (inputs.flake-base.lib.mkFlake {
      inherit inputs;
      src = ./.;
      channels-config = {
        allowUnfreePredicate = pkg: builtins.elem (inputs.nixpkgs.lib.getName pkg) allowUnfreePackages;
      };
      systems.modules.nixos = inputNixosModules;
      homes.modules = inputHomeModules;
      snowfall = {
        root = ./nix;
        namespace = "khscodes";
        meta = {
          title = "Nix machines for KHS";
          name = "Machines";
        };
      };
      overlays = [ inputs.rust-overlay.overlays.default ];
    })
    // {
      terranixModules.cloudflare = import ./nix/modules/terranix/cloudflare;
      terranixModules.hcloud = import ./nix/modules/terranix/hcloud;
      terranixModules.vault = import ./nix/modules/terranix/vault;
      terranixModules.s3 = import ./nix/modules/terranix/s3;
      terranixModules.openstack = import ./nix/modules/terranix/openstack;
      terranixModules.unifi = import ./nix/modules/terranix/unifi;
    };
}
