Docker error: reading a line: Input/output error for anything I do inside a container

I have been trying to use nix inside a container and nix-shell command seems to work correctly but anything other than that (nix profile, nix-env, nix develop etc) fails with this error

error:
       … while waiting for the build environment for '/nix/store/7r2gqdwc4m6yykzghiz9j3d0jdwg5cjv-builder.pl.drv' to initialize (succeeded, previous messages: )

       error: reading a line: Input/output error

I tried to create my dockerfile using the official nix docker image as base and ran into the same issue

This issue occurs regardless of whether root user or a normal user is trying to execute these commands

The flake which I am using to create the environment in the container

{
  inputs = {
    nixpkgs.url = "/var/cache/nixpkgs/NixOS-nixpkgs-b27ba4e";
    flake-parts.url = "/var/cache/flake-parts-main";
    process-compose-flake.url = "/var/cache/process-compose-flake-main";
    services-flake.url = "/var/cache/services-flake-main";
  };

  outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } {
    systems = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" "aarch64-linux" ];
    imports = [
      inputs.process-compose-flake.flakeModule
    ];
    perSystem = { self', pkgs, lib, system, ... }: {
      _module.args.pkgs = import inputs.nixpkgs {
        inherit system;
        config.allowUnfree = true;
      };

      packages.default = pkgs.buildEnv {
        name = "Odin-Sandbox-Env";
        paths = with pkgs; [
          vim
          gnupatch
        ];
      };

      devShells.default = pkgs.mkShell {
        buildInputs = with pkgs; [
          vim
          gnupatch
        ];
      };
      process-compose."odin" = pc: {
        imports = [
          inputs.services-flake.processComposeModules.default
        ];
        services = {
        };
      };
    };
    flake = {
    };
  };
}

This works on my system correctly but fails inside the container and if I try to install the profile when I am building the dockerfile it works but when I exec into the container and try to install the profile it fails