Bug 2536840

Summary: commands run in `nix repl` are not added to repl history
Product: [Fedora] Fedora Reporter: Aidan D <aidandenlinger>
Component: nixAssignee: Jens Petersen <petersen>
Status: CLOSED ERRATA QA Contact:
Severity: low Docs Contact:
Priority: unspecified    
Version: 45CC: petersen
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: nix-2.31.6-1.el10_4 nix-2.31.6-1.el10_3 nix-2.35.3-2.fc44 nix-2.31.6-1.fc43 nix-2.31.6-1.el10_2 nix-2.35.3-2.fc45 Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2026-10-21 01:00:22 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Aidan D 2026-09-17 20:42:04 UTC
`nix repl` opens a repl to run nix expressions in. Similar to `bash` or `python` and `node`'s repl, it's expected behavior that you can scroll through your history with the up/down arrow. This is not working for me with Fedora's `nix`.

This issue does not occur when using `nix run nixpkgs#nix -- repl` (ie a `nix` binary from `cache.nixos.org`). Both of them are the same version of nix:

```
❯ rpm -q nix
nix-2.34.8-1.fc44.x86_64
❯ nix --version
nix (Nix) 2.34.8
❯ nix run nixpkgs#nix -- --version
nix (Nix) 2.34.8
```

nixpkg's `nix` successfully writes to `~/.local/share/nix/repl-history` and I can scroll through its history with the arrow keys. If I add to history using nixpkg's `nix`, fedora's `nix` allows me to scroll through that history, but anything I run from fedora's nix doesn't get added.

Reproducible: Always

Steps to Reproduce:
1. Delete `~/.local/share/nix/repl-history` if it exists
2. Run `nix repl`
3. Run any command, ie `1 + 1`
4. Hit the up arrow
Actual Results:
Nothing occurs, after exiting REPL nothing is written to `~/.local/share/nix/repl-history`

Expected Results:
To be able to scroll through this history with the up/down arrow, for `1 + 1` to be written to `.local/share/nix/repl-history` after exiting the REPL

Additional Information:
I've observed weird behavior when observing with `strace`. In this case, I deleted `~/.local/share/nix/repl-history`.

```
❯ strace -e trace=openat,write,rename,close nix repl
<omitted output where I run 1 + 1 in the repl>
openat(AT_FDCWD, "/home/user/.local/share/nix/repl-history", O_WRONLY|O_CREAT|O_TRUNC, 0600) = 3
write(3, "", 0)                         = 0
close(3)                                = 0
```

Even though I ran `1 + 1`, the binary writes "". `nixpkgs`'s nix acts as you'd expect, writing all expressions to repl history.

I have not modified `/etc/nix/nix.conf` from the fedora defaults.

Comment 1 Jens Petersen 2026-09-18 13:55:23 UTC
Thanks for the report.  I can reproduce also in newer rawhide.

Tbh, I don't use the repl often, so I was not aware of this.

Some investigation is needed I think: I can only comment
that the fedora nix package is built with the readline library.
Earlier I used editline, before the package was officially included in fedora.
But that could be unrelated.

Though it sounds like you are saying the problem is not writing repl-history iirc?

Comment 2 Aidan D 2026-09-18 15:21:12 UTC
> Though it sounds like you are saying the problem is not writing repl-history iirc?

Correct, the `strace` output seems to imply it thinks there is never anything to add to repl-history. It always writes an empty string.

Comment 3 Jens Petersen 2026-10-07 04:58:26 UTC
(I guess a quasi-workaround might be to use rlwrap to run nix repl, but not a proper solution obviously.)

Comment 4 Jens Petersen 2026-10-07 05:24:17 UTC
I think one thing we could try is to build nix without readline and see what happens.

I looked a bit at src/libcmd/repl-interacter.cc and see there differences in the code used at least.

To build it locally you basically just need to remove the '-Dlibcmd:readline-flavor=readline' line from nix.spec and install editline-devel.
I could provide a scratch build I suppose if needed.

I tried on Rawhide and indeed it seems to fix the problem for me.

Comment 5 Jens Petersen 2026-10-07 05:34:19 UTC
https://src.fedoraproject.org/rpms/nix/c/74c7b48688a76b54e49a3e6c0887caaf4adbd2ec?branch=rawhide is what I pushed for Rawhide.

Comment 6 Fedora Update System 2026-10-17 11:39:56 UTC
FEDORA-2026-d34d705a38 (nix-2.35.3-1.fc45) has been submitted as an update to Fedora 45.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-d34d705a38

Comment 7 Fedora Update System 2026-10-17 14:36:04 UTC
FEDORA-2026-d9fe9e0ac3 (nix-2.35.3-2.fc44) has been submitted as an update to Fedora 44.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-d9fe9e0ac3

Comment 8 Fedora Update System 2026-10-17 15:43:29 UTC
FEDORA-2026-065497e462 (nix-2.31.6-1.fc43) has been submitted as an update to Fedora 43.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-065497e462

Comment 9 Fedora Update System 2026-10-17 17:08:05 UTC
FEDORA-EPEL-2026-ffed74cdfb (nix-2.31.6-1.el10_4) has been submitted as an update to Fedora EPEL 10.4.
https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2026-ffed74cdfb

Comment 10 Fedora Update System 2026-10-17 17:33:27 UTC
FEDORA-EPEL-2026-51b9011519 (nix-2.31.6-1.el10_3) has been submitted as an update to Fedora EPEL 10.3.
https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2026-51b9011519

Comment 11 Fedora Update System 2026-10-18 01:51:45 UTC
FEDORA-2026-d34d705a38 has been pushed to the Fedora 45 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-d34d705a38`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-d34d705a38

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 12 Fedora Update System 2026-10-18 01:58:34 UTC
FEDORA-EPEL-2026-ffed74cdfb has been pushed to the Fedora EPEL 10.4 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2026-ffed74cdfb

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 13 Fedora Update System 2026-10-18 02:09:04 UTC
FEDORA-EPEL-2026-51b9011519 has been pushed to the Fedora EPEL 10.3 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2026-51b9011519

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 14 Fedora Update System 2026-10-18 02:18:54 UTC
FEDORA-2026-065497e462 has been pushed to the Fedora 43 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-065497e462`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-065497e462

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 15 Fedora Update System 2026-10-18 02:46:45 UTC
FEDORA-2026-d9fe9e0ac3 has been pushed to the Fedora 44 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-d9fe9e0ac3`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-d9fe9e0ac3

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 16 Fedora Update System 2026-10-18 05:04:09 UTC
FEDORA-EPEL-2026-06f144fbdf (nix-2.31.6-1.el10_2) has been submitted as an update to Fedora EPEL 10.2.
https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2026-06f144fbdf

Comment 17 Fedora Update System 2026-10-19 02:03:55 UTC
FEDORA-EPEL-2026-06f144fbdf has been pushed to the Fedora EPEL 10.2 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2026-06f144fbdf

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 18 Fedora Update System 2026-10-21 01:00:22 UTC
FEDORA-EPEL-2026-ffed74cdfb (nix-2.31.6-1.el10_4) has been pushed to the Fedora EPEL 10.4 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 19 Fedora Update System 2026-10-26 00:42:11 UTC
FEDORA-EPEL-2026-51b9011519 (nix-2.31.6-1.el10_3) has been pushed to the Fedora EPEL 10.3 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 20 Fedora Update System 2026-10-26 01:07:58 UTC
FEDORA-2026-d9fe9e0ac3 (nix-2.35.3-2.fc44) has been pushed to the Fedora 44 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 21 Fedora Update System 2026-10-26 01:30:08 UTC
FEDORA-2026-065497e462 (nix-2.31.6-1.fc43) has been pushed to the Fedora 43 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 22 Fedora Update System 2026-10-27 00:47:34 UTC
FEDORA-EPEL-2026-06f144fbdf (nix-2.31.6-1.el10_2) has been pushed to the Fedora EPEL 10.2 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 23 Fedora Update System 2026-10-31 18:45:35 UTC
FEDORA-2026-d34d705a38 (nix-2.35.3-2.fc45) has been pushed to the Fedora 45 stable repository.
If problem still persists, please make note of it in this bug report.