shanggu-fonts: make installPhase more readable

in https://github.com/NixOS/nixpkgs/pull/350296/files#r1809338555 I was
scratching my head what is going on.
This commit is contained in:
Jörg Thalheim 2024-10-22 08:59:00 +02:00
parent 8e125ab277
commit 84a9c95794

View File

@ -23,12 +23,14 @@ let
Sans = "sha256-x5z6GYsfQ+8a8W0djJTY8iutuLNYvaemIpdYh94krk0=";
Serif = "sha256-3WK7vty3zZFNKkwViEsozU3qa+5hymYwXk6ta9AxmNM=";
};
extraOutputs = builtins.attrNames source;
in
stdenvNoCC.mkDerivation {
pname = "shanggu-fonts";
inherit version;
outputs = [ "out" ] ++ builtins.attrNames source;
outputs = [ "out" ] ++ extraOutputs;
nativeBuildInputs = [ p7zip ];
@ -49,13 +51,10 @@ stdenvNoCC.mkDerivation {
mkdir -p $out/share/fonts/truetype
''
+ lib.strings.concatLines (
lib.lists.forEach (builtins.attrNames source) (
name: (''
install -Dm444 ${name}/*.ttc -t $'' + name + ''/share/fonts/truetype
ln -s $'' + name + ''/share/fonts/truetype/*.ttc $out/share/fonts/truetype
''
)
)
lib.lists.forEach extraOutputs (name: ''
install -Dm444 ${name}/*.ttc -t ${placeholder name}/share/fonts/truetype
ln -s "${placeholder name}" /share/fonts/truetype/*.ttc $out/share/fonts/truetype
'')
) + ''
runHook postInstall
'';