Skip to content

[Feature Request] nssSystemd wrapper for non-NixOS systemd-homed users #9399

@sauyon

Description

@sauyon

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions