feat: make the result the iamge directly #3

Merged
aviac merged 1 commit from krauterbaquette/result-as-img into main 2025-10-16 06:50:37 +00:00

this simplifies the consumtion in nix code, as one can go img = assets.packages.catppuccin-latte-ico
and does not have to write img = "${assets.packages.catppuccin-latte-ico}/catppuccin-latte.ico"

However this is a "breaking change" so be carefull there.
But I think the current scope of users is limited so better do it now than later

this simplifies the consumtion in nix code, as one can go `img = assets.packages.catppuccin-latte-ico` and does not have to write `img = "${assets.packages.catppuccin-latte-ico}/catppuccin-latte.ico"` However this is a "breaking change" so be carefull there. But I think the current scope of users is limited so better do it now than later
this simplifies the consumtion in nix code, as one can go `img = assets.packages.catppuccin-latte-ico`
and does not have to write `img = "${assets.packages.catppuccin-latte-ico}/catppuccin-latte.ico"
aviac left a comment
Owner

Everything besides the comment looks really good, thanks!

I just need more clarifications here to understand.

Everything besides the comment looks really good, thanks! I just need more clarifications here to understand.
@ -29,17 +33,17 @@
];
mkNamedImageWith =
{ name, cmd }:
{
inherit name;
# dot in package names are not supported by the nix cli
name = builtins.replaceStrings [ "." ] [ "-" ] name;
value = pkgs.stdenv.mkDerivation {
inherit name;
src = inputs.self + "/logo";
buildPhase = ''
mkdir -p $out
${cmd}
'';
};
};
in
{
all = pkgs.symlinkJoin {
Owner

What's the motivation behind this change?

What's the motivation behind this change?
Author
Owner

I removed the mkdir -p $out because we write the resulting image files directly to $out, so result is a direct symlink to the image file (and therefore $out is no longer a directory we have to create).

To allow image tools to better "get the type" of the resulting file i therefore changed to name (of the derivation) to end in .png for example and not -png (as it was previous).

However the name of the package itslef shouldn't contain any dots, because it will "break" the nix command, meaning that you simply cannot build that package from cli because it wont find it:

nix build .#catppuccin-latte.ico

will search for a package under packages."${system}".catppuccin-latte.ico which does not exists, because that package would live under packages."${system}"."catppuccin-latte.ico" (see the ").
thats why i overwrite the "package location" to contain no dots

I removed the `mkdir -p $out` because we write the resulting image files directly to `$out`, so `result` is a direct symlink to the image file (and therefore $out is no longer a directory we have to create). To allow image tools to better "get the type" of the resulting file i therefore changed to name (of the derivation) to end in `.png` for example and not `-png` (as it was previous). However the name of the package itslef shouldn't contain any dots, because it will "break" the nix command, meaning that you simply cannot build that package from cli because it wont find it: ``` nix build .#catppuccin-latte.ico ``` will search for a package under `packages."${system}".catppuccin-latte.ico` which does not exists, because that package would live under `packages."${system}"."catppuccin-latte.ico"` (see the `"`). thats why i overwrite the "package location" to contain no dots
aviac marked this conversation as resolved
aviac approved these changes 2025-10-16 06:50:28 +00:00
aviac left a comment
Owner

LGTM!

LGTM!
aviac merged commit d0e8bdbb64 into main 2025-10-16 06:50:37 +00:00
aviac deleted branch krauterbaquette/result-as-img 2025-10-16 06:50:37 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
solarpunk-kollektiv-dd/assets!3
No description provided.