Flakes and symlinked store

Hi!

I have a debian with /nix being a symlink to some other location. With NIX_IGNORE_SYMLINK_STORE=1 everything is ok for non-flake usage.

However, I recently tried to migrate to flakes and made the following pet repo based on the tutorial Nix Flakes

# flake.nix
{
  description = "try flakes";

  inputs.flake-utils.url = "github:numtide/flake-utils";

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem
      (system:
        let pkgs = nixpkgs.legacyPackages.${system}; in
        {
          devShell = import ./shell.nix { inherit pkgs; };
        }
      );
}
# shell.nix
{ pkgs ? import <nixpkgs> { } }:
with pkgs;
mkShell {
  buildInputs = [
    hello
  ];
}
# .envrc
use flake

These three files are added and commited to git, yet the console shows

direnv: loading PATH_TO_REPO/.envrc
direnv: using flake
error: 'flake.nix' file of flake 'git+file://PATH_TO_REPO?ref=refs/heads/main&rev=59ba8240efba403efe7c245dbb12b9b568f5ec2b' escapes from '/nix/store/bny5gwjfwq5isaxnl9s73j4mlxykxsrx-source'
error: getting status of 'PATH_TO_REPO/.direnv/flake-profile.94794': No such file or directory
error: 'flake.nix' file of flake 'git+file://PATH_TO_REPO?ref=refs/heads/main&rev=59ba8240efba403efe7c245dbb12b9b568f5ec2b' escapes from '/nix/store/bny5gwjfwq5isaxnl9s73j4mlxykxsrx-source'

and the hello binary is not available.

I tried setting allow-symlinked-store = true in my ~/.config/nix/nix.conf to no avail.

Is there anything else I can tweak in my config to make flakes work? Or “flakes + symlinked store == lost cause”?

$ nix --version
nix (Nix) 2.18.1

I briefly tried symlinked store a few years ago and I wasn’t able to make it work. A much better approach is to use bind mounted store (e.g. filesystems - What is a bind mount? - Unix & Linux Stack Exchange) which works with no issues.

Thanks, I’ll take a look at binds.