How to get `nixos-install --flake` to work?

Did anyone manage to install nixos directly from a flake? I have run into some problems trying to:

  1. Boot NixOS 20.09
  2. Start shell with new nix version & git: nix-shell -p nixUnstable git (or nixFlakes)
  3. Clone Flake to /mnt/flake
  4. nixos-install --flake /mnt/flake#somehost

I am getting access to /mnt/nix/store/...-source/flake.nix is forbidden in restricted mode
Also there is a warning: unknown setting 'extra-sanbox-paths'

3 Likes

I had this problem too. If I remember correctly, I point nixos-install to my github flake repository:

nixos-install --flake https://github.com/bara/myflake_repo#somehost
1 Like

I have the same problem when I try to install nixos from flakes being booted on minimal iso image, using latest nixUnstable from nixos-20.09 but in my case it’s refusing to access /mnt/nix/store/<hash>-nmd

This seems to be related to how the nmd currently works. As far as I remember, it is used by home-manager to generate its documentation.

You might be able to circumvent the issue by disabling all kinds of documentation for your home-manager.

1 Like

i did disable all home-manager module, after booing into system was able to re-run with hm un-commented.

using the current nixos-unstable image i was able to get nix flakes support just by installing:

nix-env -iA nixpkgs.nixUnstable

pointing my flake.nix to /mnt/etc/nixos/flake.nix and it went fine.

1 Like

Try:

nixos-install --impure --flake /mnt/flake#somehost
3 Likes