Module Name
Requested Feature
A wrapper helper under targets.genericLinux, modeled on targets.genericLinux.nixGL:
- Option
targets.genericLinux.nssSystemd.libraryPath — string, default /usr/lib/libnss_systemd.so.2.
- Helper
config.lib.nssSystemd.wrap drv — returns drv with its binaries able to dlopen the host's libnss_systemd.so.2.
services.emacs.package = config.lib.nssSystemd.wrap pkgs.emacs;
Current Limitations
Nix's bundled glibc ships no libnss_systemd.so.2 and only searches the nix store for NSS plugins. On a non-NixOS host where the current user is resolved via systemd-homed or systemd's userdb (anyone not in /etc/passwd), getpwnam/getpwuid from any nix-built binary fails. Concretely, on Arch + nix + a systemd-homed user, emacs aborts initialization with Error (initialization): User <name> has no home directory and init.el never loads; xdg-desktop-portal, gpg-agent, and others degrade similarly.
Additional Context
I have a working implementation locally and will happily clean it up into a PR if this shape looks right.
Module Name
Requested Feature
A wrapper helper under
targets.genericLinux, modeled ontargets.genericLinux.nixGL:targets.genericLinux.nssSystemd.libraryPath— string, default/usr/lib/libnss_systemd.so.2.config.lib.nssSystemd.wrap drv— returnsdrvwith its binaries able todlopenthe host'slibnss_systemd.so.2.Current Limitations
Nix's bundled glibc ships no
libnss_systemd.so.2and only searches the nix store for NSS plugins. On a non-NixOS host where the current user is resolved viasystemd-homedorsystemd's userdb (anyone not in/etc/passwd),getpwnam/getpwuidfrom any nix-built binary fails. Concretely, on Arch + nix + a systemd-homed user, emacs aborts initialization withError (initialization): User <name> has no home directoryandinit.elnever loads; xdg-desktop-portal, gpg-agent, and others degrade similarly.Additional Context
I have a working implementation locally and will happily clean it up into a PR if this shape looks right.