Skip to content

[Feature Request] Add option to set user profile picture via AccountsService #8370

@birneee

Description

@birneee

Module Name

home-environment.nix

Requested Feature

Enable homemanager to manage user profile pictures.

I currently if have this in my configuration, but I would like to see this feature upstreamed. I am not very familiar with the inner workings of homemanager, so I am not sure if this is the right approach:

{
  config,
  lib,
  pkgs,
  ...
}:

{
  options.home.usericon = lib.mkOption {
    type = lib.types.nullOr lib.types.path;
    default = null;
    description = "Path to the user's profile picture.";
  };

  config = lib.mkIf (config.home.usericon != null && pkgs.stdenv.isLinux) {
    home.activation.configureUserIcon = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
      if [ -z "''${DRY_RUN:-}" ]; then
        ${pkgs.systemd}/bin/busctl call \
          org.freedesktop.Accounts \
          /org/freedesktop/Accounts/User$UID \
          org.freedesktop.Accounts.User \
          SetIconFile \
          s "${config.home.usericon}"
      fi
    '';
  };
}

Current Limitations

Currently, homemanager cannot set the user profile picture.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions