{
  description = "The Flake";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    nixos-unstable-small.url = "github:nixos/nixpkgs/nixos-unstable-small";
    nixpkgs.follows = "nixos-cosmic/nixpkgs";
    nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11";
    nixos-hardware.url = "github:NixOS/nixos-hardware/master";
    home-manager = {
      url = "github:nix-community/home-manager/master";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    plasma-manager = {
      url = "github:nix-community/plasma-manager";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.home-manager.follows = "home-manager";
    };
    stylix = {
      url = "github:danth/stylix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    quickemu = {
      url = "https://flakehub.com/f/quickemu-project/quickemu/4.9.6.tar.gz";
    };
    # radicle = {
    #   type = "git";
    #   url = "https://seed.radicle.garden/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git";
    #   inputs.nixpkgs.follows = "nixpkgs";
    # };
    # eww = {
    #   url = "github:elkowar/eww";
    #   inputs.nixpkgs.follows = "nixpkgs";
    # };
    # ags = {
    #   url = "github:Aylur/ags";
    #   inputs.nixpkgs.follows = "nixpkgs";
    # };
    emacs = {
      url =
        "github:nix-community/emacs-overlay/dd38645351b6f14cda47c81456131c86b11386db";
      inputs.nixpkgs.follows = "nixpkgs";
      #inputs.nixpkgs.follows = "nixos-unstable-small";
    };
    nix-bitcoin = { url = "github:fort-nix/nix-bitcoin/release"; };
    simple-nixos-mailserver = {
      url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-24.11";
    };
    nixos-cosmic = { url = "github:lilyinstarlight/nixos-cosmic"; };
    anipy-cli = { url = "github:sdaqo/anipy-cli"; };
    darkly = { url = "github:Bali10050/Darkly"; };
    # rust-overlay = {
    #   url = "github:oxalica/rust-overlay";
    #   inputs.nixpkgs.follows = "nixpkgs";
    # };
  };

  outputs = inputs@{ nixpkgs, nixpkgs-stable, home-manager, plasma-manager
    , nixos-cosmic, quickemu, nixos-hardware, emacs, nix-bitcoin #, eww
    , simple-nixos-mailserver, anipy-cli, darkly,
    # ags,
    stylix, ... }:
    let
      system = "x86_64-linux";
      username = "chris";
      stable = import nixpkgs-stable {
        inherit system;
        config = { allowUnfree = true; };
      };

      pkgsForSystem = import nixpkgs {
        inherit system;

        config = {
          allowUnfree = true;
          permittedInsecurePackages = [ "olm-3.2.16" ];
        };
        overlays = [
          emacs.overlays.default
          # rust-overlay.overlays.default
          # eww.overlays.default

          (final: prev: {
            python312 = prev.python312.override {
              packageOverrides = final: prev: {
                pysaml2 = final.toPythonModule final.emptyDirectory;
              };
            };
            matrix-synapse-unwrapped = prev.matrix-synapse-unwrapped.overrideAttrs (old: {
              postPatch = (old.postPatch or "") + ''
            substituteInPlace tests/storage/databases/main/test_events_worker.py --replace-fail \
            $'    def test_recovery(' \
            $'    from tests.unittest import skip_unless\n'\
            $'    @skip_unless(False, "broken")\n'\
            $'    def test_recovery('
          '';
            });
          })
        ];
      };

      lib = nixpkgs.lib;

    in {
      # devShell = pkgsForSystem.mkShell {
      #   name = "devy";
      #   nativeBuildInputs = [];
      #   buildInputs = with pkgsForSystem; [
      #     cargo
      #     rustc
      #     clippy
      #     rustfmt
      #     rust-analyzer
      #   ];
      # };
      nixosConfigurations = {
        syl = lib.nixosSystem {
          inherit system;
          pkgs = pkgsForSystem;
          specialArgs = {
            stable = stable;
            inherit inputs;
          };
          modules = [
            ./systems/syl/configuration.nix
            home-manager.nixosModules.home-manager
            # hyprland.nixosModules.default
            # stylix.nixosModules.stylix
            nixos-hardware.nixosModules.framework-11th-gen-intel
            nixos-cosmic.nixosModules.default
            # libre-presenter.defaultPackage
            {
              home-manager.useGlobalPkgs = true;
              home-manager.useUserPackages = true;
              home-manager.extraSpecialArgs = { inherit inputs; };
              home-manager.users.chris = import ./home/home.nix;
              home-manager.backupFileExtension = "bck";
              home-manager.sharedModules =
                [ plasma-manager.homeManagerModules.plasma-manager ];
            }
          ];
        };
        kaladin = lib.nixosSystem {
          inherit system;
          pkgs = pkgsForSystem;
          specialArgs = { inherit inputs; };
          modules = [
            ./systems/kaladin/configuration.nix
            home-manager.nixosModules.home-manager
            # hyprland.nixosModules.default
            # stylix.nixosModules.stylix
            nixos-cosmic.nixosModules.default
            nixos-hardware.nixosModules.common-gpu-amd
            {
              home-manager.useGlobalPkgs = true;
              home-manager.useUserPackages = true;
              home-manager.extraSpecialArgs = { inherit inputs; };
              home-manager.backupFileExtension = "bck";
              home-manager.users.chris = import ./home/home.nix;
            }
          ];
        };
        dalinar = nixpkgs-stable.lib.nixosSystem {
          inherit system;
          specialArgs = { inherit inputs; };
          modules = [
            ./systems/dalinar/configuration.nix
            # nix-bitcoin.nixosModules.default
            simple-nixos-mailserver.nixosModule
          ];
        };
        kohlin = nixpkgs-stable.lib.nixosSystem {
          inherit system;
          specialArgs = { inherit inputs; };
          modules = [
            ./systems/kohlin/configuration.nix
            # nix-bitcoin.nixosModules.default
          ];
        };
      };
    };
}
