This repository provides a simple customizable Nix package,
lazy-app
, that you can use to create a set of applications that
appear to be installed on your system but are actually not until you
try to run them.
This is something of an intermediate step between packages installed in your system/user profile and packages run through something like comma or nix run.
Note, this is experimental software and it may change at any time in incompatible ways.
Lazy Apps is currently made available as a Nix Flake or as a plain old
default.nix
.
Add
lazy-apps = {
url = "sourcehut:~rycee/lazy-apps";
inputs.nixpkgs.follows = "nixpkgs";
};
to your Flake inputs. You can then make use of the lazy-app
package.
For example, installing
lazy-apps.packages.${system}.lazy-app.override { pkg = pkgs.hello; }
will make the hello
command available. If a desktop item is
specified then the application will also show up in your desktop
manager. Here is an example for GpsPrune:
lazy-apps.packages.${system}.lazy-app.override {
pkg = pkgs.gpsprune;
desktopItem = pkgs.makeDesktopItem {
name = "gpsprune";
exec = "gpsprune %F";
icon = "gpsprune";
desktopName = "GpsPrune";
genericName = "GPS Data Editor";
comment = "Application for viewing, editing and converting GPS coordinate data";
categories = [ "Education" "Geoscience" ];
mimeTypes = [
"application/gpx+xml"
"application/vnd.google-earth.kml+xml"
"application/vnd.google-earth.kmz"
];
};
}
The equivalent for plain old Nix is to do
let lazy-app = (import <lazy-apps>).mkLazyApps { inherit pkgs; }
in lazy-app.override { pkg = pkgs.hello; }
The fields currently available for override are:
pkg
: Nix package providing the application. Mandatory.
exe
: Name of the command to run. If not given, then meta.mainProgram
or
the name of the package is used.
desktopItem
: The application desktop item, as generated by
pkgs.makeDesktopItem
. Optional.
One can imagine additional features and improvements:
-
Support for application icons. Bonus point if the application icon is different before and after the wrapped package is realized.
-
When realizing a package we could place it in a "lazy-apps" profile so that it won't get garbage collected.
-
A tool that, given a package, can generate corresponding app attribute sets.