{
  description = "Nixos server config";

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

    # inputs for following
    systems = {
      url = "github:nix-systems/x86_64-linux"; # only evaluate for this system
    };
    flake-compat = {
      url = "github:edolstra/flake-compat";
      flake = false;
    };
    crane = {
      url = "github:ipetkov/crane";
      inputs = {
        nixpkgs.follows = "nixpkgs";
      };
    };
    flake-utils = {
      url = "github:numtide/flake-utils";
      inputs = {
        systems.follows = "systems";
      };
    };
    rust-overlay = {
      url = "github:oxalica/rust-overlay";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        flake-utils.follows = "flake-utils";
      };
    };

    # modules
    disko = {
      url = "github:nix-community/disko";
      inputs = {
        nixpkgs.follows = "nixpkgs";
      };
    };
    agenix = {
      url = "github:ryantm/agenix";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        systems.follows = "systems";
      };
    };
    impermanence = {
      url = "github:nix-community/impermanence";
      inputs = {};
    };
    simple-nixos-mailserver = {
      url = "gitlab:simple-nixos-mailserver/nixos-mailserver/master";
      inputs = {
        flake-compat.follows = "flake-compat";
        nixpkgs.follows = "nixpkgs";
        utils.follows = "flake-utils";
      };
    };

    # bins
    ragenix = {
      url = "github:yaxitech/ragenix";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        agenix.follows = "agenix";
        flake-utils.follows = "flake-utils";
        rust-overlay.follows = "rust-overlay";
        crane.follows = "crane";
      };
    };
  };

  outputs = {
    self,
    nixpkgs,
    nixpkgs-unstable,
    # modules
    simple-nixos-mailserver,
    impermanence,
    disko,
    agenix,
    # bins
    ragenix,
    ...
  } @ attrs: let
    system = "x86_64-linux";
    pkgs = nixpkgs.legacyPackages.${system};
    pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
  in {
    nixosConfigurations."server1" = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs =
        attrs
        // {
          inherit pkgs-unstable;
        };
      modules = [
        ./hosts/server1/configuration.nix
        simple-nixos-mailserver.nixosModule
        disko.nixosModules.default
        impermanence.nixosModules.impermanence
        agenix.nixosModules.default
      ];
    };
    devShells."${system}" = {
      default = pkgs.mkShell {
        packages = with pkgs; [
          alejandra

          # used for certificate generation in the taskserver setup
          gnutls

          cocogitto
          ragenix.packages."${system}".default
        ];
      };
    };
    formatter."${system}" = pkgs.alejandra;
  };
}