Yeah, this is a pattern I often use, but the apps feature in general is probably still a bit unexplored in the community. You probably won’t see many examples yet. They also tend to be a bit on the explicit side, which looks ugly in a flake.nix
so people probably hide them behind imports a lot.
There’s no convenient little method to create mini-apps from a package yet, but the principle is the same as with making one from packages created within the flake - it’s all just derivations after all.
Here’s an example where I run my web server with the corresponding HTML templates to do a full integration test for my web server: tlaternet-webserver/flake.nix at master - tlaternet/tlaternet-webserver - Forgejo: Beyond coding. We Forge.
In your case, you’d probably do something like this:
{
description = "tlater.net web server";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
};
outputs = { self, nixpkgs, ... }: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in {
# I have no idea how to inject a plugin into vim from the command line
# Naturally, you can .override the `pkgs.neovim` instead if needed, and
# that *would* make importing it from a separate file tempting.
apps.${system}.testvim = pkgs.writeShellScript "testvim" ''
${pkgs.neovim}/bin/vim --plugin ${self.packages.${system}.vim-plugin}
'';
};