nix-git/modules/gnome-profile-image.nix

30 lines
1.2 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ config, pkgs, ... }:
let
dir = "/var/lib/AccountsService/icons";
user = "yoda";
in
{
# https://discourse.nixos.org/t/setting-the-user-profile-image-under-gnome/36233/4
# Important: File permissions and file format
# https://discourse.nixos.org/t/setting-the-user-profile-image-under-gnome/36233/7
# https://github.com/tolgaerok/nixos-kde/blob/3c4b55f2b0345facc5bc5157750dfaecef9d4d6c/machines/LAPTOPS/HP-i5-ProBook-6460b/user/user-profile-pic/default.nix
# https://github.com/tolgaerok/nixos-kde/blob/3c4b55f2b0345facc5bc5157750dfaecef9d4d6c/user/user-home-settings/create-user-profile-pics.nix
# After changing my profile image in KDE Plasma 6, this file was created:
# /var/lib/AccountsService/users
# With content:
# [User]
# Icon=/var/lib/AccountsService/icons/yoda
# SystemAccount=false
# Permissions: root:root 0600
# `system.activationScripts`:
# - Since these are executed every time you boot the system or run `nixos-rebuild`, its important that they are idempotent and fast.
system.activationScripts.setGnomeProfilePicture = ''
mkdir -p ${dir}
cp ${(pkgs.callPackage ./profile-image.nix { })}/img.png ${dir}/${user}
'';
}