NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.06k stars 14.11k forks source link

nixos: It would be nice if `hashedPasswordFile` could be set to a path #342064

Open Jayman2000 opened 1 month ago

Jayman2000 commented 1 month ago

Issue description

At the moment, users.users.<name>.hashedPasswordFile has to be set to either null or a string:

      hashedPasswordFile = mkOption {
        type = with types; nullOr str;

As a result, I end up doing this in my config:

{
  users.users.root.hashedPasswordFile = builtins.toString pathToFile;
}

It would be nice if I didn’t have to do builtins.toString here. It’s kind of weird that you have to represent this particular path as a string because the Nix expression language already has a data type specifically for paths.

Technical details

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

 - system: `"x86_64-linux"`
 - host os: `Linux 6.10.9, NixOS, 24.05 (Uakari), 24.05.4847.44a71ff39c18`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.5`
 - channels(root): `"nixos-24.05"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
dotlambda commented 1 month ago

That's not a good idea because the file would end up in the Nix store. see https://github.com/NixOS/nixpkgs/pull/78640