nixos-rebuild-ng: repl not working correctly with --override-input
0.kind: bug
### Nixpkgs version
- Unstable (26.11)
### Describe the bug
nixos-rebuild repl fails with a flake where `--override-input` is required, even with the other sub-commands working just fine, pointing to the possibility that `--override-input` may be silently ignored when using `repl`.
### Steps to reproduce
- have a flake with a non-resolvable flake input, e.g. by disabling the global registry with, at `/etc/nixos/flake.nix`:
```nix
{
# must be substituted with context via flag --override-input
inputs.nixpkgs.url = "nixpkgs";
# just a bad example
outputs = { ... }: {
nixosConfigurations.machine = abort "invalid config";
};
}
```
- run `nixos-rebuild --override-input nixpkgs /some/path/to/nixpkgs repl`
### Expected behaviour
that nixos-rebuild repl works just fine, like the other sub-commands work just fine with that flake
### Screenshots
<img width="1277" height="850" alt="Image" src="https://github.com/user-attachments/assets/afc258f9-5ae9-446c-b85a-f414c0477321" />
### Relevant log output
```console
error: cannot find flake 'flake:nixpkgs' in the flake registries
```
### Additional context
`nix-info` output is from inside a NixOS test VM, where I was trying to use `nixos-rebuild` to debug a test I am currently developing. The nixpkgs base is from: 5d3fba2b02270afb013d352a61dfeac5b5cc3e08.
I assume this happens because the `getFlake` in the repl.nix base file does not honor the `--override-input` passed to `nix repl`: https://github.com/NixOS/nixpkgs/blob/43afb19d00be55384fdb773b33a3dc74dff53155/pkgs/by-name/ni/nixos-rebuild-ng/src/nixos_rebuild/repl.nix.template#L3
If that is the reason, then its probably open for discussion whether this can be actually fixed by nixos-rebuild or not. If not, it would still be better to warn users about that or to abort execution completely.
### System metadata
- system: `"x86_64-linux"`
- host os: `Linux 6.18.44, NixOS, 26.11 (Zokor), 26.11test`
- multi-user?: `no`
- sandbox: `yes`
- version: `nix-env (Nix) 2.34.8`
- nixpkgs: `not found`
### Notify maintainers
@thiagokokada
---
**Note for maintainers:** Please tag this issue in your pull request description. (i.e. `Resolves #ISSUE`.)
### I assert that this issue is relevant for Nixpkgs
- [x] I assert that this is a bug and not a support request.
- [x] I assert that this is not a [duplicate of an existing issue](https://github.com/NixOS/nixpkgs/issues?q=is%3Aissue+label%3A%220.kind%3A+bug%22+-label%3A%226.topic%3A+darwin%22+-label%3A%226.topic%3A+nixos%22).
- [x] I assert that I have read the [NixOS Code of Conduct](https://github.com/NixOS/.github/blob/master/CODE_OF_CONDUCT.md) and agree to abide by it.
- [x] I assert that I have read the [automation/AI policy](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#automationai-policy) and that this issue report complies with it.
### Is this issue important to you?
Add a :+1: [reaction] to [issues you find important].
[reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
[issues you find important]: https://github.com/NixOS/nixpkgs/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc
1 条评论