[Programs/LibreOffice] Init LibreOffice package configuration

This commit is contained in:
Antoine Viallon 2023-05-15 00:41:04 +02:00
parent 78049d829a
commit 27b7e334b3
Signed by: aviallon
GPG key ID: 186FC35EDEB25716
4 changed files with 72 additions and 2 deletions

View file

@ -138,6 +138,8 @@ in {
"veracrypt"
];
aviallon.programs.libreoffice.enable = mkIf (!generalCfg.minimal) true;
services.packagekit.enable = mkDefault (!generalCfg.minimal);
security.sudo.extraConfig =
''

View file

@ -96,13 +96,12 @@ in {
krdc
sddm-kcm
libreoffice-qt
myFirefox
];
aviallon.desktop.browser.firefox.overrides.enablePlasmaBrowserIntegration = true;
aviallon.programs.libreoffice.qt = true;
xdg.portal.enable = mkDefault true;
xdg.icons.enable = true;

View file

@ -6,5 +6,6 @@
./git.nix
./nano.nix
./nvtop.nix
./libreoffice.nix
];
}

68
programs/libreoffice.nix Normal file
View file

@ -0,0 +1,68 @@
{ config, pkgs, lib, myLib, ... }:
with lib;
let
cfg = config.aviallon.programs.libreoffice;
toStringOrFunc = x:
if isFunction x
then "<function>"
else (builtins.toJSON x)
;
applyOverrides = overrides: pkg:
foldl'
(prev: override:
let
r = (trace "override: ${toStringOrFunc override}" override) (trace "prev: ${toString prev}" prev);
in trace "result: ${toString r}" r
)
pkg
overrides
;
in {
options.aviallon.programs.libreoffice = {
enable = mkEnableOption "LibreOffice";
variant = mkOption {
type = with types; types.enum [ "still" "fresh" ];
default = "fresh";
description = "Which LibreOffice variant to use";
};
qt = mkEnableOption "Qt support";
gnome = mkOption {
description = "Wether to enable Gnome support";
default = true;
type = types.bool;
internal = true;
};
opencl = mkEnableOption "OpenCL support";
package = mkOption {
description = "Which final LibreOffice package to use";
type = myLib.types.package';
};
package' = mkOption {
internal = true;
description = "Which base (unwrapped) LibreOffice package to use";
default = if cfg.qt then pkgs.libreoffice-qt.libreoffice else pkgs.libreoffice-unwrapped;
type = myLib.types.package';
};
};
config = mkIf cfg.enable {
aviallon.programs.libreoffice.package =
let
overridesList = []
++ [(pkg: pkg.override {
variant = cfg.variant;
})]
++ optional cfg.opencl (pkg: pkg.overrideAttrs (old: {
buildInputs = old.buildInputs ++ [ pkgs.ocl-icd ];
}))
;
in pkgs.libreoffice.override {
libreoffice = applyOverrides overridesList cfg.package';
};
environment.systemPackages = [
cfg.package
];
};
}