texlive: always require at least one extra package

Fixes #526
This commit is contained in:
Robert Helgesson 2019-01-09 02:09:23 +01:00
parent b3d73e0aff
commit e150dd4a66
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
3 changed files with 28 additions and 3 deletions

View file

@ -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;
};
}

View file

@ -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;
};
}

View file

@ -0,0 +1,13 @@
{ config, lib, ... }:
with lib;
{
config = {
programs.texlive.enable = true;
nmt.script = ''
assertFileExists home-path/bin/tex
'';
};
}