Skip to content

feat: output write-* to packages also#98

Merged
theutz merged 2 commits intodenful:mainfrom
theutz:write-packages
Apr 13, 2026
Merged

feat: output write-* to packages also#98
theutz merged 2 commits intodenful:mainfrom
theutz:write-packages

Conversation

@theutz
Copy link
Copy Markdown
Collaborator

@theutz theutz commented Apr 13, 2026

This is useful since the apps output doesn't give you easy access to a derivation, as far as I can tell, so it's harder to include in something like devshells

@theutz theutz added the enhancement New feature or request label Apr 13, 2026
@vic
Copy link
Copy Markdown
Member

vic commented Apr 13, 2026

I believe we should have only one.

#92

@Adda0, any take on this ?

@theutz
Copy link
Copy Markdown
Collaborator Author

theutz commented Apr 13, 2026 via email

@vic
Copy link
Copy Markdown
Member

vic commented Apr 13, 2026

I mean, we gain almost nothing for having them at apps we moved them because I had no opinion on not doing so, I've always by instict use packages. From previous PR what I understand is, apps is for things not intended to be consumed by downstream flakes.

How is it more difficult to add them at devshells when exposed via flake.apps ? Maybe we can document about config.flake-file.apps and recommend people to use those ?

Or simply move again to packages, I'm not against that, I just prefer not having both.

@theutz
Copy link
Copy Markdown
Collaborator Author

theutz commented Apr 13, 2026

Great question! Per the devshells docs, you can define a command by adding an entry with the shape { package = <p>; } where p is "null or (package or string convertible to it)".

In most instances, this is just a string that can be getAttrFromPath'd from pkgs. But in our case, since they come from our flake, they have to be in the form of a package / derivation. The output from apps is an attrset that exposes .program, which resolves to a stringified store path for the main exe for the app. Unfortunately, devshell can't use that string to understand it's a package, and so it fails.

I'll give you a side-by-side for more insight:

{ config, ... }:
{ devshell = {
  commands = [
    # with apps
    { name = "write-flake"; command = config.apps.write-file.program; }
    # with packages
    { package = config.packages.write-file; }
  ];
}

So, yeah, you can see it's not really a big deal either way! But the files tool for flake parts uses packages, so it would be in keeping with another existing paradigm if we used packages, too.

I'm torn. I'll leave the final decision to the wisdom of the group!

@theutz
Copy link
Copy Markdown
Collaborator Author

theutz commented Apr 13, 2026

I guess one other potential benefit for package is that devshell reads the meta.description and would use that to auto-generate help text in it's message of the day menu. We don't currently add any meta.description, so it's moot currently. But we could and it would!

@vic
Copy link
Copy Markdown
Member

vic commented Apr 13, 2026

Yep, so this issue actually exposing a difference (definitive advantage) about using packages vs apps, is a good thing. Like I said, previously I had no opinion on this, but thanks for mentioning things like access to description,meta.mainProgram and easy of use for devshells, that definitely help in making a better decision.

Having a reason, we can now know why to use packages vs apps.

I mean, we gain nothing from apps, but gain more from using packages. So let's use packages.

@theutz
Copy link
Copy Markdown
Collaborator Author

theutz commented Apr 13, 2026

Ok! I went ahead and added a meta.description property to each of the writers, too, that I adapted from the docs.

@theutz
Copy link
Copy Markdown
Collaborator Author

theutz commented Apr 13, 2026

I'll take a look at these failing tests.

@theutz
Copy link
Copy Markdown
Collaborator Author

theutz commented Apr 13, 2026

I'll take a look at these failing tests.

It was some kind of issue with the nothing-but-nix action. A 504 with something it was trying to curl. But it looks like it's fixed now.

@theutz theutz requested a review from vic April 13, 2026 16:45
Copy link
Copy Markdown
Member

@vic vic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FFTM (Feel free to merge -- just invented that)

@theutz
Copy link
Copy Markdown
Collaborator Author

theutz commented Apr 13, 2026

FFTM (Feel free to merge -- just invented that)

ILT (I like that)

@theutz theutz merged commit 3009b96 into denful:main Apr 13, 2026
12 checks passed
@theutz theutz deleted the write-packages branch April 13, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants