mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-31 04:04:32 +00:00
onlyoffice: add module (#6667)
This commit is contained in:
parent
94605dcade
commit
c36cc49e55
7 changed files with 87 additions and 0 deletions
|
@ -24,6 +24,12 @@
|
|||
github = "afresquet";
|
||||
githubId = 29437693;
|
||||
};
|
||||
aguirre-matteo = {
|
||||
name = "aguirre-matteo";
|
||||
email = "aguirre.matteo.nix@gmail.com";
|
||||
github = "aguirre-matteo";
|
||||
githubId = 158215792;
|
||||
};
|
||||
amesgen = {
|
||||
name = "amesgen";
|
||||
email = "amesgen@amesgen.de";
|
||||
|
|
|
@ -195,6 +195,7 @@ let
|
|||
./programs/octant.nix
|
||||
./programs/offlineimap.nix
|
||||
./programs/oh-my-posh.nix
|
||||
./programs/onlyoffice.nix
|
||||
./programs/opam.nix
|
||||
./programs/openstackclient.nix
|
||||
./programs/pandoc.nix
|
||||
|
|
50
modules/programs/onlyoffice.nix
Normal file
50
modules/programs/onlyoffice.nix
Normal file
|
@ -0,0 +1,50 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
|
||||
let
|
||||
inherit (lib)
|
||||
types isBool boolToString concatStringsSep mapAttrsToList mkIf
|
||||
mkEnableOption mkPackageOption mkOption;
|
||||
|
||||
cfg = config.programs.onlyoffice;
|
||||
|
||||
attrToString = name: value:
|
||||
let newvalue = if (isBool value) then (boolToString value) else value;
|
||||
in "${name}=${newvalue}";
|
||||
|
||||
getFinalConfig = set:
|
||||
(concatStringsSep "\n" (mapAttrsToList attrToString set)) + "\n";
|
||||
in {
|
||||
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
|
||||
|
||||
options.programs.onlyoffice = {
|
||||
enable = mkEnableOption "onlyoffice";
|
||||
|
||||
package =
|
||||
mkPackageOption pkgs "onlyoffice-desktopeditors" { nullable = true; };
|
||||
|
||||
settings = mkOption {
|
||||
type = with types; attrsOf (either bool str);
|
||||
default = { };
|
||||
example = ''
|
||||
UITheme = "theme-contrast-dark";
|
||||
editorWindowMode = false;
|
||||
forcedRtl = false;
|
||||
maximized = true;
|
||||
titlebar = "custom";
|
||||
'';
|
||||
description = ''
|
||||
Configuration settings for Onlyoffice.
|
||||
|
||||
All configurable options can be deduced by enabling them through the
|
||||
GUI and observing the changes in ~/.config/onlyoffice/DesktopEditors.conf.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
||||
|
||||
xdg.configFile."onlyoffice/DesktopEditors.conf".source =
|
||||
pkgs.writeText "DesktopEditors.conf" (getFinalConfig cfg.settings);
|
||||
};
|
||||
}
|
|
@ -142,6 +142,7 @@ let
|
|||
"nix-index"
|
||||
"nix-your-shell"
|
||||
"ollama"
|
||||
"onlyoffice-desktopeditors"
|
||||
"openstackclient"
|
||||
"papis"
|
||||
"pay-respects"
|
||||
|
@ -353,6 +354,7 @@ in import nmtSrc {
|
|||
./modules/programs/nnn
|
||||
./modules/programs/nushell
|
||||
./modules/programs/oh-my-posh
|
||||
./modules/programs/onlyoffice
|
||||
./modules/programs/openstackclient
|
||||
./modules/programs/pandoc
|
||||
./modules/programs/papis
|
||||
|
|
1
tests/modules/programs/onlyoffice/default.nix
Normal file
1
tests/modules/programs/onlyoffice/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{ onlyoffice-example-config = ./example-config.nix; }
|
7
tests/modules/programs/onlyoffice/example-config.conf
Normal file
7
tests/modules/programs/onlyoffice/example-config.conf
Normal file
|
@ -0,0 +1,7 @@
|
|||
UITheme=theme-contrast-dark
|
||||
editorWindowMode=false
|
||||
forcedRtl=false
|
||||
locale=es-ES
|
||||
maximized=true
|
||||
position=@Rect(100 56 1266 668)
|
||||
titlebar=custom
|
20
tests/modules/programs/onlyoffice/example-config.nix
Normal file
20
tests/modules/programs/onlyoffice/example-config.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
programs.onlyoffice = {
|
||||
enable = true;
|
||||
settings = {
|
||||
UITheme = "theme-contrast-dark";
|
||||
editorWindowMode = false;
|
||||
forcedRtl = false;
|
||||
locale = "es-ES";
|
||||
maximized = true;
|
||||
position = "@Rect(100 56 1266 668)";
|
||||
titlebar = "custom";
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/onlyoffice/DesktopEditors.conf
|
||||
assertFileContent home-files/.config/onlyoffice/DesktopEditors.conf \
|
||||
${./example-config.conf}
|
||||
'';
|
||||
}
|
Loading…
Add table
Reference in a new issue