about summary refs log tree commit diff
path: root/modules/core/lazy-packages.nix
blob: a26e28661bc80b2ece0fee1e4f675dc504fbbc56 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{ config, pkgs, lib, ... }:

let
  inherit (lib) escapeShellArg;
  inherit (config.vuizvui) lazyPackages;

  vuizvuiWrapper = package: pkgs.vuizvui.lazy-packages.mkWrapper {
    inherit package;
    extraErrorMessage = "Please remove `${escapeShellArg package.name}' from `vuizvui.lazyPackages'.";
  };

  wrappers = map vuizvuiWrapper config.vuizvui.lazyPackages;

in {
  options.vuizvui.lazyPackages = lib.mkOption {
    type = lib.types.listOf lib.types.package;
    default = [];
    example = lib.literalExample "[ pkgs.gimp pkgs.libreoffice ]";
    description = ''
      Packages which are built for this system but instead of being a full
      runtime dependency, only wrappers of all executables that reside in the
      <literal>bin</literal> directory are actually runtime dependencies.

      As soon as one of these wrappers is executed, the real package is fetched
      and the corresponding binary is executed.
    '';
  };

  config.environment.systemPackages = map vuizvuiWrapper lazyPackages;
}