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:50 +0200
commit01533f55c4ea50e7087c54972cb631b7469c20bc (patch)
treebe02d751c0f04cc85e60cc0664192b14c9793843 /nixos
parent22d14ed8a2e51684d4bb3c17295adabfa705691d (diff)
nixos/services.gpsd: remove `with lib;`
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/misc/gpsd.nix43
1 files changed, 20 insertions, 23 deletions
diff --git a/nixos/modules/services/misc/gpsd.nix b/nixos/modules/services/misc/gpsd.nix
index 6f7aec0784a0..76aa151f204a 100644
--- a/nixos/modules/services/misc/gpsd.nix
+++ b/nixos/modules/services/misc/gpsd.nix
@@ -1,7 +1,4 @@
 { config, lib, pkgs, utils, ... }:
-
-with lib;
-
 let
 
   uid = config.ids.uids.gpsd;
@@ -21,16 +18,16 @@ in {
 
     services.gpsd = {
 
-      enable = mkOption {
-        type = types.bool;
+      enable = lib.mkOption {
+        type = lib.types.bool;
         default = false;
         description = ''
           Whether to enable `gpsd`, a GPS service daemon.
         '';
       };
 
-      devices = mkOption {
-        type = types.listOf types.str;
+      devices = lib.mkOption {
+        type = lib.types.listOf lib.types.str;
         default = [ "/dev/ttyUSB0" ];
         description = ''
           List of devices that `gpsd` should subscribe to.
@@ -43,8 +40,8 @@ in {
         '';
       };
 
-      readonly = mkOption {
-        type = types.bool;
+      readonly = lib.mkOption {
+        type = lib.types.bool;
         default = true;
         description = ''
           Whether to enable the broken-device-safety, otherwise
@@ -60,40 +57,40 @@ in {
         '';
       };
 
-      nowait = mkOption {
-        type = types.bool;
+      nowait = lib.mkOption {
+        type = lib.types.bool;
         default = false;
         description = ''
           don't wait for client connects to poll GPS
         '';
       };
 
-      port = mkOption {
-        type = types.port;
+      port = lib.mkOption {
+        type = lib.types.port;
         default = 2947;
         description = ''
           The port where to listen for TCP connections.
         '';
       };
 
-      debugLevel = mkOption {
-        type = types.int;
+      debugLevel = lib.mkOption {
+        type = lib.types.int;
         default = 0;
         description = ''
           The debugging level.
         '';
       };
 
-      listenany = mkOption {
-        type = types.bool;
+      listenany = lib.mkOption {
+        type = lib.types.bool;
         default = false;
         description = ''
           Listen on all addresses rather than just loopback.
         '';
       };
 
-      extraArgs = mkOption {
-        type = types.listOf types.str;
+      extraArgs = lib.mkOption {
+        type = lib.types.listOf lib.types.str;
         default = [ ];
         example = [ "-r" "-s" "19200" ];
         description = ''
@@ -108,7 +105,7 @@ in {
 
   ###### implementation
 
-  config = mkIf cfg.enable {
+  config = lib.mkIf cfg.enable {
 
     users.users.gpsd = {
       inherit uid;
@@ -131,9 +128,9 @@ in {
         in ''
           ${pkgs.gpsd}/sbin/gpsd -D "${toString cfg.debugLevel}"  \
             -S "${toString cfg.port}"                             \
-            ${optionalString cfg.readonly "-b"}                   \
-            ${optionalString cfg.nowait "-n"}                     \
-            ${optionalString cfg.listenany "-G"}                  \
+            ${lib.optionalString cfg.readonly "-b"}                   \
+            ${lib.optionalString cfg.nowait "-n"}                     \
+            ${lib.optionalString cfg.listenany "-G"}                  \
             ${extraArgs}                                          \
             ${devices}
         '';