Attribute gnome3 missing

I’m trying to config PAM to skip password-input step for GNOME Keyring. The following is my configuration (left out unrelated parts)

{ config, pkgs, gnome3, ... }:
....
  security.pam.services = {
    login = {
      text = ''
           auth     optional ${gnome3.gnome_keyring}/lib/security/pam_gnome_keyring.so
           session  optional ${gnome3.gnome_keyring}/lib/security/pam_gnome_keyring.so autostart
           password optional ${gnome3.gnome_keyring}/lib/security/pam_gnome_keyring.so
           '';
    };
  };
...

However, when I run sudo nixos-rebuild switch, I got the following error

I don’t know how to fix this. Could you please help?

What you want is pkgs.gnome3.gnome_keyring.

1 Like

Thank you very much. It works. But how can I find out gnome3 is an attribute of pkgs?

All packages are below the pkgs attribute. Personally I would recommend nix search to look for packages.

2 Likes

@hexa is correct. You will only be able to use variables that you receive in the function arguments (the bracket followed by a colon at the top of the file) or add them to the scope in another way – just like in most other programming languages.

Also note that gnome3.gnome-keyring is the correct name (the one with underscore is a legacy alias that will eventually be removed). Could you point us to where you found that so it can be corrected?

Alternately, you can use security.pam.services.login.enableGnomeKeyring = true, which adds the appropriate directives to the login PAM service.

Or just use services.gnome3.gnome-keyring.enable = true, which enables it for you, in addition to setting up the keyring daemon in your user session.

3 Likes