{
  description = "NixOS system flake.";

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

    nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.11";

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

    firefox-addons = {
        url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
        inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, nixpkgs-stable, home-manager, ... } @ inputs:
  let
    inherit (self) outputs;
    system = "x86_64-linux";
    userName = "nate";
    hostName = "winmax";
    pkgs = nixpkgs.legacyPackages.${system};
    stablePkgs = import nixpkgs-stable {
        legacyPackages = system;
        config.allowUnfree = true;
    };
  in
  {
    nixosConfigurations = {
      nixServer = nixpkgs.lib.nixosSystem {
        specialArgs = { inherit inputs; };
        modules = [
          ./nixos/configuration.nix
          inputs.home-manager.nixosModules.default
        ];
      };

      nixSway = nixpkgs.lib.nixosSystem {
        # Pass args to sway_configuration
        specialArgs = {
            inherit inputs;
            inherit userName;
            inherit hostName;
        };
        modules = [
          ./nixos/sway_configuration.nix
          # Setup home manager
          home-manager.nixosModules.home-manager {
              home-manager.useGlobalPkgs = true;
              home-manager.useUserPackages = true;
              home-manager.users.${userName} = import ./modules/home-manager/home.nix;
              home-manager.extraSpecialArgs = {
                  inherit inputs outputs userName hostName;
              };
          }
        ];
      };
    };
  };
}