NixOSConfig/lib/packages/ttf-ms-win11.nix

62 lines
2 KiB
Nix

{ fetchgit, fetchurl, p7zip, stdenv, ... }:
let
name = "ttf-ms-win11";
iso = "win11.iso";
version = "10.0.22631.2428-2";
fonts = ''"''${_ttf_ms_win11[@]}"'';
ttf-ms-win11-auto =
stdenv.mkDerivation {
name = "${name}-auto";
inherit version;
src = fetchgit {
url = "https://aur.archlinux.org/ttf-ms-win11-auto.git";
rev = "aee165d1396b34000b07294d36f9c19812a186f7";
sha256 = "3QZP5j/q/BTwBLSULVACKJ7DRVh3w/wxKEOZc1Fo9Io=";
};
buildPhase = ''
mkdir $out
cp PKGBUILD $out
'';
};
in
# Borrowed from https://aur.archlinux.org/packages/ttf-ms-win11-auto
stdenv.mkDerivation rec {
inherit
name
version
;
src = fetchurl {
url = "https://software-static.download.prss.microsoft.com/dbazure/888969d5-f34g-4e03-ac9d-1f9786c66749/22631.2428.231001-0608.23H2_NI_RELEASE_SVC_REFRESH_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso";
name = "${name}.tar";
sha256 = "KpxK+LCq6FCwV607YH7nqQa415+jVYQ5lUnCL4MSXxk=";
downloadToTemp = true;
nativeBuildInputs = [
p7zip
];
postFetch = ''
mv $downloadedFile "${iso}"
7z x "${iso}" sources/install.wim
7z e sources/install.wim Windows/{Fonts/"*".{ttf,ttc},System32/Licenses/neutral/"*"/"*"/license.rtf}
. ${ttf-ms-win11-auto}/PKGBUILD
mkdir "${name}"
cp ${fonts} license.rtf "${name}"
tar -czvf $out \
--sort=name --format=posix --pax-option='delete=atime,delete=ctime' --clamp-mtime --mtime="$SOURCE_EPOCH" --numeric-owner --owner=0 --group=0 --mode='go+u,go-w' \
"${name}"
'';
};
installPhase = ''
runHook preInstall
. ${ttf-ms-win11-auto}/PKGBUILD
install -vDm644 ${fonts} -t $out/share/fonts/truetype
install -vDm644 license.rtf -t $out/share/licenses/${name}/
runHook postInstall
'';
}