Skip to content

[flake] nix flake init failed with ~/.local/share/nix/root used as a chroot store #6853

@augu5te

Description

@augu5te

Describe the bug

When ~/.local/share/nix/root is used as a chroot store, template's source is not found despite it being present in the store.

[root@tmp:~]# nix --extra-experimental-features 'flakes nix-command' flake init
error: '/home/orichard/.local/share/nix/root/nix/store/kgr2zyykdhyck7wx14x2pmnx0bl49hgs-source/trivial' was not found in the Nix store
       If you've set 'defaultTemplate.path' to a string, try using a path instead.

[root@tmp:~]# ls /home/orichard/.local/share/nix/root/nix/store/kgr2zyykdhyck7wx14x2pmnx0bl49hgs-source/trivial
flake.nix

Steps To Reproduce

  1. Build nix-static to simplify test on machine without nix and nix store
    nix build "github:NixOS/nix/0b62dab6db3da5b20e62697b14aaaf80f1a2eea6#packages.x86_64-linux.nix-static"
  2. Copy `result/bin/nix on machine without nix
  3. On this machine execute ./nix --extra-experimental-features 'flakes nix-command' flake init

Expected behavior
Copy flake.nix from trivial template in current directory.

Tested with:
nix (Nix) 2.10.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions