NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.87k stars 13.93k forks source link

[21.05] nixos-install-scripts: nixos-install ignores -I nixos-config= #131975

Open yayayayaka opened 3 years ago

yayayayaka commented 3 years ago

Describe the bug

While reinstalling my system I discovered a bug where nixos-install ignores anything you set behind the -I nixos-config= flag.

This is due to a hard-coded if-condition that only takes the NIXOS_CONFIG variable into consideration.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Move or remove /mnt/etc/nixos/configuration.nix
  2. Run nixos-install -I nixos-config=/path/to/your/configuration.nix
  3. nixos-install fails with configuration file /mnt/etc/nixos/configuration.nix doesn't exist

Expected behavior

nixos-install installs a NixOS system with /path/to/your/configuration.nix as configuration entry point.

Workaround

Notify maintainers

@ju1m @edolstra

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.52-1-lts, NixOS, 21.05.1790.382039c05a1 (Okapi)`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.14`
 - channels(root): `"nixos-21.05.1790.382039c05a1"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute: nixos-install-tools
# a list of nixos modules affected by the problem
module:
stale[bot] commented 2 years ago

I marked this as stale due to inactivity. → More info