nixos/services.gollum: remove `with lib;`

Changed files
+42 -45
nixos
modules
services
misc
+42 -45
nixos/modules/services/misc/gollum.nix
···
pkgs,
...
}:
-
-
with lib;
-
let
cfg = config.services.gollum;
in
{
imports = [
-
(mkRemovedOptionModule
+
(lib.mkRemovedOptionModule
[
"services"
"gollum"
···
];
options.services.gollum = {
-
enable = mkEnableOption "Gollum, a git-powered wiki service";
+
enable = lib.mkEnableOption "Gollum, a git-powered wiki service";
-
address = mkOption {
-
type = types.str;
+
address = lib.mkOption {
+
type = lib.types.str;
default = "0.0.0.0";
description = "IP address on which the web server will listen.";
};
-
port = mkOption {
-
type = types.port;
+
port = lib.mkOption {
+
type = lib.types.port;
default = 4567;
description = "Port on which the web server will run.";
};
-
extraConfig = mkOption {
-
type = types.lines;
+
extraConfig = lib.mkOption {
+
type = lib.types.lines;
default = "";
description = "Content of the configuration file";
};
-
math = mkOption {
-
type = types.bool;
+
math = lib.mkOption {
+
type = lib.types.bool;
default = false;
description = "Enable support for math rendering using KaTeX";
};
-
allowUploads = mkOption {
-
type = types.nullOr (
-
types.enum [
+
allowUploads = lib.mkOption {
+
type = lib.types.nullOr (
+
lib.types.enum [
"dir"
"page"
]
···
description = "Enable uploads of external files";
};
-
user-icons = mkOption {
-
type = types.nullOr (
-
types.enum [
+
user-icons = lib.mkOption {
+
type = lib.types.nullOr (
+
lib.types.enum [
"gravatar"
"identicon"
]
···
description = "Enable specific user icons for history view";
};
-
emoji = mkOption {
-
type = types.bool;
+
emoji = lib.mkOption {
+
type = lib.types.bool;
default = false;
description = "Parse and interpret emoji tags";
};
-
h1-title = mkOption {
-
type = types.bool;
+
h1-title = lib.mkOption {
+
type = lib.types.bool;
default = false;
description = "Use the first h1 as page title";
};
-
no-edit = mkOption {
-
type = types.bool;
+
no-edit = lib.mkOption {
+
type = lib.types.bool;
default = false;
description = "Disable editing pages";
};
-
local-time = mkOption {
-
type = types.bool;
+
local-time = lib.mkOption {
+
type = lib.types.bool;
default = false;
description = "Use the browser's local timezone instead of the server's for displaying dates.";
};
-
branch = mkOption {
-
type = types.str;
+
branch = lib.mkOption {
+
type = lib.types.str;
default = "master";
example = "develop";
description = "Git branch to serve";
};
-
stateDir = mkOption {
-
type = types.path;
+
stateDir = lib.mkOption {
+
type = lib.types.path;
default = "/var/lib/gollum";
description = "Specifies the path of the repository directory. If it does not exist, Gollum will create it on startup.";
};
-
package = mkPackageOption pkgs "gollum" { };
+
package = lib.mkPackageOption pkgs "gollum" { };
-
user = mkOption {
-
type = types.str;
+
user = lib.mkOption {
+
type = lib.types.str;
default = "gollum";
description = "Specifies the owner of the wiki directory";
};
-
group = mkOption {
-
type = types.str;
+
group = lib.mkOption {
+
type = lib.types.str;
default = "gollum";
description = "Specifies the owner group of the wiki directory";
};
};
-
config = mkIf cfg.enable {
+
config = lib.mkIf cfg.enable {
-
users.users.gollum = mkIf (cfg.user == "gollum") {
+
users.users.gollum = lib.mkIf (cfg.user == "gollum") {
group = cfg.group;
description = "Gollum user";
createHome = false;
···
--host ${cfg.address} \
--config ${pkgs.writeText "gollum-config.rb" cfg.extraConfig} \
--ref ${cfg.branch} \
-
${optionalString cfg.math "--math"} \
-
${optionalString cfg.emoji "--emoji"} \
-
${optionalString cfg.h1-title "--h1-title"} \
-
${optionalString cfg.no-edit "--no-edit"} \
-
${optionalString cfg.local-time "--local-time"} \
-
${optionalString (cfg.allowUploads != null) "--allow-uploads ${cfg.allowUploads}"} \
-
${optionalString (cfg.user-icons != null) "--user-icons ${cfg.user-icons}"} \
+
${lib.optionalString cfg.math "--math"} \
+
${lib.optionalString cfg.emoji "--emoji"} \
+
${lib.optionalString cfg.h1-title "--h1-title"} \
+
${lib.optionalString cfg.no-edit "--no-edit"} \
+
${lib.optionalString cfg.local-time "--local-time"} \
+
${lib.optionalString (cfg.allowUploads != null) "--allow-uploads ${cfg.allowUploads}"} \
+
${lib.optionalString (cfg.user-icons != null) "--user-icons ${cfg.user-icons}"} \
${cfg.stateDir}
'';
};