Initial commit
Some checks failed
CI / check (push) Has been cancelled
CI / ida (push) Has been cancelled
CI / cpt (push) Has been cancelled
CI / build-nixos (ena) (push) Has been cancelled
CI / build-nixos (hako) (push) Has been cancelled
CI / build-nixos (kazusa) (push) Has been cancelled
CI / build-nixos (mizuki) (push) Has been cancelled
Some checks failed
CI / check (push) Has been cancelled
CI / ida (push) Has been cancelled
CI / cpt (push) Has been cancelled
CI / build-nixos (ena) (push) Has been cancelled
CI / build-nixos (hako) (push) Has been cancelled
CI / build-nixos (kazusa) (push) Has been cancelled
CI / build-nixos (mizuki) (push) Has been cancelled
This commit is contained in:
commit
70284509f3
144 changed files with 7061 additions and 0 deletions
34
hosts/machine/kanade/modules/mac/avatar.nix
Normal file
34
hosts/machine/kanade/modules/mac/avatar.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
pkgs,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
avatar = pkgs.runCommand "kanade-avatar.jpg" { nativeBuildInputs = [ pkgs.imagemagick ]; } ''
|
||||
magick "${inputs.self}/assets/avatar.webp" -quality 92 "$out"
|
||||
'';
|
||||
in
|
||||
{
|
||||
system.activationScripts.postActivation.text = ''
|
||||
avatarPath="/Library/User Pictures/imnyang.jpg"
|
||||
importFile="$(/usr/bin/mktemp /tmp/imnyang-avatar.XXXXXX)"
|
||||
|
||||
/usr/bin/install -d -m 0755 "/Library/User Pictures"
|
||||
/usr/bin/install -m 0644 "${avatar}" "$avatarPath"
|
||||
|
||||
# Replace both account-picture representations. JPEGPhoto is embedded in
|
||||
# the directory record and is used by the login screen and System Settings.
|
||||
/usr/bin/dscl . -delete /Users/imnyang JPEGPhoto >/dev/null 2>&1 || true
|
||||
/usr/bin/dscl . -delete /Users/imnyang Picture >/dev/null 2>&1 || true
|
||||
/usr/bin/dscl . -create /Users/imnyang Picture "$avatarPath"
|
||||
|
||||
/usr/bin/printf '%s\n%s:%s' \
|
||||
'0x0A 0x5C 0x3A 0x2C dsRecTypeStandard:Users 2 dsAttrTypeStandard:RecordName externalbinary:dsAttrTypeStandard:JPEGPhoto' \
|
||||
'imnyang' \
|
||||
"$avatarPath" > "$importFile"
|
||||
/usr/bin/dsimport "$importFile" /Local/Default M
|
||||
/bin/rm -f "$importFile"
|
||||
|
||||
/usr/bin/dscacheutil -flushcache
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue