{
  description = "A nixvim configuration";
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    nixvim.url = "github:nix-community/nixvim";
    flake-parts.url = "github:hercules-ci/flake-parts";
    rust-overlay.url = "github:oxalica/rust-overlay";
  };
  outputs = {
    nixvim,
    flake-parts,
    rust-overlay,
    ...
  } @ inputs:
    flake-parts.lib.mkFlake {inherit inputs;} {
      systems = [
        "x86_64-linux"
        "aarch64-linux"
        "x86_64-darwin"
        "aarch64-darwin"
      ];
      perSystem = {
        self,
        system,
        ...
      }: let
        specialArgs = {
          inherit inputs self;
        };
        overlays = [(import rust-overlay)];
        nixvimLib = nixvim.lib.${system};
        nixvim' = nixvim.legacyPackages.${system};
        pkgs = import inputs.nixpkgs {
          inherit system overlays;
          config.allowUnfree = true;
        };
        deps = with pkgs; [
          sops
          lazygit
          nerd-fonts.jetbrains-mono
          rust-bin.stable.latest.default # From rust-overlay
          ansible-lint
          beautysh
        ];

        fullNixvimModule = {
          inherit pkgs;
          module = {pkgs, ...}: {
            imports = [
              ./config
              ./config/rust
              ./config/csharp
              ./config/golang
              ./config/python
              ./config/javascript
              ./config/iac
            ];
            extraPackages = deps;
          };
          extraSpecialArgs = specialArgs; # Keep specialArgs for self-reference
        };
        baseNixvimModule = {
          inherit pkgs;
          module = {pkgs, ...}: {
            imports = [./config];
            extraPackages = deps;
          };
          extraSpecialArgs = specialArgs;
        };
        rustNixvimModule = {
          inherit pkgs;
          module = {pkgs, ...}: {
            imports = [
              ./config
              ./config/rust
            ];
            extraPackages = with pkgs; [
              sops
              rust-bin.stable.latest.default
            ];
          };
          extraSpecialArgs = {};
        };
        csharpNixvimModule = {
          inherit pkgs;
          module = {pkgs, ...}: {
            imports = [
              ./config
              ./config/csharp
            ];
            extraPackages = with pkgs; [sops];
          };
          extraSpecialArgs = {};
        };
        goNixvimModule = {
          inherit pkgs;
          module = {pkgs, ...}: {
            imports = [
              ./config
              ./config/golang
            ];
            extraPackages = with pkgs; [sops];
          };
          extraSpecialArgs = {};
        };
        pythonNixvimModule = {
          inherit pkgs;
          module = {pkgs, ...}: {
            imports = [
              ./config
              ./config/python
            ];
            extraPackages = with pkgs; [sops];
          };
          extraSpecialArgs = {};
        };
        javascriptNixvimModule = {
          inherit pkgs;
          module = {pkgs, ...}: {
            imports = [
              ./config
              ./config/javascript
            ];
            extraPackages = with pkgs; [sops];
          };
          extraSpecialArgs = {};
        };
        iacNixvimModule = {
          inherit pkgs;
          module = {pkgs, ...}: {
            imports = [
              ./config
              ./config/iac
            ];
            extraPackages = with pkgs; [sops ansible-lint];
          };
          extraSpecialArgs = {};
        };

        fullNvim = nixvim'.makeNixvimWithModule fullNixvimModule;
        baseNvim = nixvim'.makeNixvimWithModule baseNixvimModule;
        rustNvim = nixvim'.makeNixvimWithModule rustNixvimModule;
        csharpNvim = nixvim'.makeNixvimWithModule csharpNixvimModule;
        goNvim = nixvim'.makeNixvimWithModule goNixvimModule;
        pythonNvim = nixvim'.makeNixvimWithModule pythonNixvimModule;
        javascriptNvim = nixvim'.makeNixvimWithModule javascriptNixvimModule;
        iacNvim = nixvim'.makeNixvimWithModule iacNixvimModule;
      in {
        checks = {
          default = nixvimLib.check.mkTestDerivationFromNixvimModule baseNixvimModule;
        };
        packages = {
          default = baseNvim;
          full = fullNvim;
          rust = rustNvim;
          csharp = csharpNvim;
          golang = goNvim;
          python = pythonNvim;
          javascript = javascriptNvim; # This should be javascriptNvim not javascriptNixvimModule
          iac = iacNvim;
        };
      };
    };
}
