{
  description = "teutat3s hosts in nix";

  nixConfig.extra-experimental-features = "nix-command flakes";

  inputs = {
    # Track channels with commits tested and built by hydra
    nixos-22-05.url = "github:nixos/nixpkgs/nixos-22.05";
    nixpkgs-24-05.url = "github:nixos/nixpkgs/nixos-24.05";
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    unstable.url = "github:nixos/nixpkgs/nixos-unstable";

    flake-compat.url = "github:edolstra/flake-compat";
    flake-compat.flake = false;

    nix-darwin.url = "github:lnl7/nix-darwin/master";
    nix-darwin.inputs.nixpkgs.follows = "nixpkgs";

    home-manager.url = "github:nix-community/home-manager/master";
    home-manager.inputs.nixpkgs.follows = "nixpkgs";

    flake-parts.url = "github:hercules-ci/flake-parts";

    deploy-rs.url = "github:serokell/deploy-rs";
    deploy-rs.inputs.nixpkgs.follows = "nixpkgs";
    deploy-rs.inputs.flake-compat.follows = "flake-compat";

    agenix.url = "github:ryantm/agenix";
    agenix.inputs.nixpkgs.follows = "nixpkgs";
    agenix.inputs.darwin.follows = "nix-darwin";
    agenix.inputs.home-manager.follows = "home-manager";

    nix-direnv.url = "github:nix-community/nix-direnv";
    nix-direnv.inputs.nixpkgs.follows = "nixpkgs";
    nix-direnv.inputs.flake-parts.follows = "flake-parts";

    nixos-hardware.url = "github:nixos/nixos-hardware";

    lix-module = {
      url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.1-1.tar.gz";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    invoiceplane-template.url = "git+https://git.pub.solar/momo/invoiceplane-templates.git";
    invoiceplane-template.inputs.nixpkgs.follows = "nixpkgs";
    invoiceplane-template.inputs.flake-parts.follows = "flake-parts";

    # PubSolarOS additions
    triton-vmtools.url = "git+https://git.pub.solar/pub-solar/infra-vintage?ref=main&dir=vmtools";
    triton-vmtools.inputs.nixpkgs.follows = "nixpkgs";

    tritonshell.url = "git+https://git.pub.solar/teutat3s/tritonshell?ref=main";
    tritonshell.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs =
    inputs@{ self, ... }:
    inputs.flake-parts.lib.mkFlake { inherit inputs; } {
      systems = [
        "x86_64-linux"
        "aarch64-linux"
        "x86_64-darwin"
        "aarch64-darwin"
      ];

      imports = [
        ./lib
        ./modules
        ./hosts
        ./users
        ./overlays
      ];

      perSystem =
        args@{
          system,
          pkgs,
          config,
          ...
        }:
        {
          _module.args = {
            inherit inputs;
            pkgs = import inputs.nixpkgs {
              inherit system;
              overlays = [ inputs.agenix.overlays.default ];
            };
            unstable = import inputs.unstable { inherit system; };
            master = import inputs.master { inherit system; };
          };

          devShells.default = pkgs.mkShell {
            buildInputs = with pkgs; [
              agenix
              cachix
              deploy-rs
              nixd
              nixos-generators
              nvfetcher

              editorconfig-checker
              nodePackages.prettier
              shellcheck
              shfmt
              treefmt
            ];
          };
        };

      flake = {
        formatter."x86_64-linux" = inputs.unstable.legacyPackages."x86_64-linux".nixfmt-rfc-style;

        deploy.nodes = self.lib.deploy.mkDeployNodes self.nixosConfigurations {
          #example = {
          #  hostname = "example.com:22";
          #  sshUser = "bartender";
          #  fastConnect = true;
          #  profilesOrder = ["system" "direnv"];
          #  profiles.direnv = {
          #    user = "bartender";
          #    path = self.pkgs.x86_64-linux.nixos.deploy-rs.lib.x86_64-linux.activate.home-manager self.homeConfigurationsPortable.x86_64-linux.bartender;
          #  };
          #};

          fae = {
            hostname = "192.168.13.35";
            sshUser = "pub-solar";
          };
          powder = {
            hostname = "80.71.153.194";
            sshUser = "root";
            profilesOrder = [
              "system"
              "direnv"
            ];
            profiles.direnv = {
              user = "pub-solar";
              path = self.pkgs.x86_64-linux.nixos.deploy-rs.lib.x86_64-linux.activate.home-manager self.homeConfigurationsPortable.x86_64-linux.pub-solar;
            };
          };
        };
      };
    };
}