about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorFelix Buehler2024-08-24 22:05:44 +0200
committerFelix Buehler2024-08-30 23:00:49 +0200
commit22d14ed8a2e51684d4bb3c17295adabfa705691d (patch)
treeeda1b700fde7dcb03765d1cdac20ed10bba45af2 /nixos
parent9358cb9b7df2652139093d3dd4accb2981642807 (diff)
nixos/services.gollum: remove `with lib;`
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/misc/gollum.nix87
1 files changed, 42 insertions, 45 deletions
diff --git a/nixos/modules/services/misc/gollum.nix b/nixos/modules/services/misc/gollum.nix
index fb9b9e19813f..ccfa63d3823d 100644
--- a/nixos/modules/services/misc/gollum.nix
+++ b/nixos/modules/services/misc/gollum.nix
@@ -4,16 +4,13 @@
   pkgs,
   ...
 }:
-
-with lib;
-
 let
   cfg = config.services.gollum;
 in
 
 {
   imports = [
-    (mkRemovedOptionModule
+    (lib.mkRemovedOptionModule
       [
         "services"
         "gollum"
@@ -24,35 +21,35 @@ in
   ];
 
   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"
         ]
@@ -61,9 +58,9 @@ in
       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"
         ]
@@ -72,61 +69,61 @@ in
       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;
@@ -158,13 +155,13 @@ in
             --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}
         '';
       };