mirror of
https://codeberg.org/privacy1st/nix-git
synced 2025-02-01 07:35:15 +01:00
add profile-image
This commit is contained in:
parent
4403c58b0d
commit
d068ee91db
9
assets/img/profile-image/LICENSE.md
Normal file
9
assets/img/profile-image/LICENSE.md
Normal file
@ -0,0 +1,9 @@
|
||||
Pixabay License: https://pixabay.com/service/license/
|
||||
|
||||
Credits:
|
||||
* https://pixabay.com/users/ribastank-805206/
|
||||
|
||||
Source:
|
||||
* https://pixabay.com/photos/yoda-starwars-actionfigure-667955/
|
||||
* https://free-images.com/display/yoda_starwars_actionfigure_667955.html
|
||||
|
BIN
assets/img/profile-image/face.jpg
Normal file
BIN
assets/img/profile-image/face.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 MiB |
BIN
assets/img/profile-image/yoda_starwars_actionfigure_667955.jpg
Normal file
BIN
assets/img/profile-image/yoda_starwars_actionfigure_667955.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 818 KiB |
@ -26,10 +26,7 @@
|
||||
#../../modules/programs-kde.nix
|
||||
#
|
||||
../../modules/gnome-base.nix
|
||||
../../modules/gnome-config.nix
|
||||
../../modules/gnome-extensions.nix
|
||||
../../modules/fwupd-gnome.nix
|
||||
../../modules/gnome-wallpaper.nix
|
||||
../../modules/programs-gnome.nix
|
||||
|
||||
../../modules/programs-base.nix
|
||||
|
@ -28,12 +28,9 @@
|
||||
#../../modules/programs-kde.nix
|
||||
#
|
||||
../../modules/gnome-base.nix
|
||||
../../modules/gnome-config.nix
|
||||
../../modules/gnome-extensions.nix
|
||||
# Not required as display scale is set 2.0 (multiple of 1).
|
||||
#../../modules/gnome-fractional-scaling.nix
|
||||
../../modules/fwupd-gnome.nix
|
||||
../../modules/gnome-wallpaper.nix
|
||||
../../modules/programs-gnome.nix
|
||||
|
||||
../../modules/programs-base.nix
|
||||
|
@ -34,11 +34,8 @@
|
||||
#../../modules/programs-kde.nix
|
||||
#
|
||||
../../modules/gnome-base.nix
|
||||
../../modules/gnome-config.nix
|
||||
../../modules/gnome-extensions.nix
|
||||
../../modules/gnome-fractional-scaling.nix
|
||||
#../../modules/fwupd-gnome.nix # TODO: Constantly keeps installing the same fw update again
|
||||
../../modules/gnome-wallpaper.nix
|
||||
../../modules/programs-gnome.nix
|
||||
|
||||
../../modules/programs-base.nix
|
||||
|
@ -7,6 +7,10 @@
|
||||
|
||||
imports = [
|
||||
./audio.nix
|
||||
./gnome-config.nix
|
||||
./gnome-extensions.nix
|
||||
./gnome-wallpaper.nix
|
||||
./gnome-profile-image.nix
|
||||
];
|
||||
|
||||
# Enable the X11 windowing system.
|
||||
|
29
modules/gnome-profile-image.nix
Normal file
29
modules/gnome-profile-image.nix
Normal file
@ -0,0 +1,29 @@
|
||||
{ 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`, it’s important that they are idempotent and fast.
|
||||
system.activationScripts.setGnomeProfilePicture = ''
|
||||
mkdir -p ${dir}
|
||||
cp ${(pkgs.callPackage ./profile-image.nix { })}/img.png ${dir}/${user}
|
||||
'';
|
||||
}
|
18
modules/profile-image.nix
Normal file
18
modules/profile-image.nix
Normal file
@ -0,0 +1,18 @@
|
||||
{ pkgs, lib }:
|
||||
let
|
||||
max-width = "256";
|
||||
in
|
||||
pkgs.stdenv.mkDerivation rec{
|
||||
name = "yoda-profile-image";
|
||||
src = "${../assets/img/profile-image/face.jpg}";
|
||||
nativeBuildInputs = with pkgs; [ imagemagick ];
|
||||
phases = "installPhase";
|
||||
# magick limit width: https://stackoverflow.com/a/38415211/6334421
|
||||
# magick jpg options: quality, progressive, strip metadata. https://stackoverflow.com/a/7262050/6334421
|
||||
installPhase = ''
|
||||
set -eu -o pipefail
|
||||
mkdir -p $out
|
||||
${pkgs.imagemagick}/bin/magick $src -resize '${max-width}>' -quality 90% -interlace Plane -strip $out/img.jpg
|
||||
${pkgs.imagemagick}/bin/magick $src -resize '${max-width}>' $out/img.png
|
||||
'';
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user