nh icon indicating copy to clipboard operation
nh copied to clipboard

`nh clean user` panicked

Open arunoruto opened this issue 1 year ago • 2 comments

I installed my home-manager config on a fresh Ubuntu 24.04 instance and had some initial trouble with a few things. Among those is nh since I use it to clean things up occasionally on non-NixOS systems. When I am running nh clean user I get the following message:

❯ RUST_LOG=debug nh clean user
DEBUG nh:23: args=NHParser { verbose: false, command: Clean(CleanProxy { command: User(CleanArgs { keep: 1, keep_since: Duration(0ns), dry: false, ask: false, nogc: false, nogcroots: false }) }) }
DEBUG nh:24: NH_VERSION=3.6.0
The application panicked (crashed).
Message:  called `Option::unwrap()` on a `None` value
Location: src/clean.rs:73

Have I installed nh incorrectly, and it can't recognize my user? An additional note: I am using an LDAP user, but I have the same user on a different machine, and everything works fine there, albeit that machine is running 22.04.

arunoruto avatar Dec 16 '24 19:12 arunoruto

This is is the line that crashes but I have no idea why: https://github.com/viperML/nh/blob/ed2116065353603859852efbff5702489d965684/src/clean.rs#L73

viperML avatar Dec 16 '24 19:12 viperML

I sadly do not have any experience using rust, so I am not sure what how the nix::unistd::User::from_uid(uid) part works. It could probably be due to LDAP being used, since some commands to not work with such users... For example such users are not listed in /etc/passwd or /etc/shadow, but running commands like id works!

arunoruto avatar Jan 06 '25 13:01 arunoruto