texlive: always require at least one extra package
Fixes #526
(cherry picked from commit e150dd4a66
)
This commit is contained in:
parent
e57e34f799
commit
9e913a9a30
|
@ -6,6 +6,8 @@ let
|
|||
|
||||
cfg = config.programs.texlive;
|
||||
|
||||
texlivePkgs = cfg.extraPackages pkgs.texlive;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
|
@ -16,7 +18,8 @@ in
|
|||
enable = mkEnableOption "Texlive";
|
||||
|
||||
extraPackages = mkOption {
|
||||
default = self: {};
|
||||
default = tpkgs: { inherit (tpkgs) collection-basic; };
|
||||
defaultText = "tpkgs: { inherit (tpkgs) collection-basic; }";
|
||||
example = literalExample ''
|
||||
tpkgs: { inherit (tpkgs) collection-fontsrecommended algorithms; }
|
||||
'';
|
||||
|
@ -32,8 +35,16 @@ in
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = texlivePkgs != {};
|
||||
message = "Must provide at least one extra package in"
|
||||
+ " 'programs.texlive.extraPackages'.";
|
||||
}
|
||||
];
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
programs.texlive.package =
|
||||
pkgs.texlive.combine (cfg.extraPackages pkgs.texlive);
|
||||
|
||||
programs.texlive.package = pkgs.texlive.combine texlivePkgs;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import nmt {
|
|||
tests = {
|
||||
"git/with-most-options" = ./modules/programs/git.nix;
|
||||
"git/with-str-extra-config" = ./modules/programs/git-with-str-extra-config.nix;
|
||||
texlive-minimal = ./modules/programs/texlive-minimal.nix;
|
||||
xresources = ./modules/xresources.nix;
|
||||
};
|
||||
}
|
||||
|
|
13
tests/modules/programs/texlive-minimal.nix
Normal file
13
tests/modules/programs/texlive-minimal.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.texlive.enable = true;
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-path/bin/tex
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue