summary refs log tree commit diff
path: root/nixos/modules/services/backup
diff options
context:
space:
mode:
authorNaïm Favier <n@monade.li>2021-10-03 18:06:03 +0200
committerNaïm Favier <n@monade.li>2021-10-04 12:47:20 +0200
commit2ddc335e6f32b875e14ad9610101325b306a0add (patch)
tree2a4591c137cb363a6ec09f529d587a10aa7a0bc7 /nixos/modules/services/backup
parent330b1e08b8df4e1f0100a0a7810ec3157749e5ee (diff)
downloadnixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar
nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.gz
nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.bz2
nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.lz
nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.xz
nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.zst
nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.zip
nixos/doc: clean up defaults and examples
Diffstat (limited to 'nixos/modules/services/backup')
-rw-r--r--nixos/modules/services/backup/automysqlbackup.nix4
-rw-r--r--nixos/modules/services/backup/borgbackup.nix13
-rw-r--r--nixos/modules/services/backup/btrbk.nix2
-rw-r--r--nixos/modules/services/backup/postgresql-backup.nix2
-rw-r--r--nixos/modules/services/backup/postgresql-wal-receiver.nix10
-rw-r--r--nixos/modules/services/backup/restic-rest-server.nix2
-rw-r--r--nixos/modules/services/backup/syncoid.nix2
-rw-r--r--nixos/modules/services/backup/tarsnap.nix6
-rw-r--r--nixos/modules/services/backup/znapzend.nix12
9 files changed, 25 insertions, 28 deletions
diff --git a/nixos/modules/services/backup/automysqlbackup.nix b/nixos/modules/services/backup/automysqlbackup.nix
index 4fcaf9eb930..fd2764a40ad 100644
--- a/nixos/modules/services/backup/automysqlbackup.nix
+++ b/nixos/modules/services/backup/automysqlbackup.nix
@@ -2,7 +2,7 @@
 
 let
 
-  inherit (lib) concatMapStringsSep concatStringsSep isInt isList literalExample;
+  inherit (lib) concatMapStringsSep concatStringsSep isInt isList literalExpression;
   inherit (lib) mapAttrs mapAttrsToList mkDefault mkEnableOption mkIf mkOption optional types;
 
   cfg = config.services.automysqlbackup;
@@ -48,7 +48,7 @@ in
           <filename>''${pkgs.automysqlbackup}/etc/automysqlbackup.conf</filename>
           for details on supported values.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           {
             db_names = [ "nextcloud" "matomo" ];
             table_exclude = [ "nextcloud.oc_users" "nextcloud.oc_whats_new" ];
diff --git a/nixos/modules/services/backup/borgbackup.nix b/nixos/modules/services/backup/borgbackup.nix
index c4174286fc0..5461dbaf0bd 100644
--- a/nixos/modules/services/backup/borgbackup.nix
+++ b/nixos/modules/services/backup/borgbackup.nix
@@ -203,7 +203,7 @@ in {
       See also the chapter about BorgBackup in the NixOS manual.
     '';
     default = { };
-    example = literalExample ''
+    example = literalExpression ''
       { # for a local backup
         rootBackup = {
           paths = "/";
@@ -260,7 +260,7 @@ in {
           archiveBaseName = mkOption {
             type = types.strMatching "[^/{}]+";
             default = "${globalConfig.networking.hostName}-${name}";
-            defaultText = "\${config.networking.hostName}-<name>";
+            defaultText = literalExpression ''"''${config.networking.hostName}-<name>"'';
             description = ''
               How to name the created archives. A timestamp, whose format is
               determined by <option>dateFormat</option>, will be appended. The full
@@ -326,10 +326,7 @@ in {
               you to specify a <option>passCommand</option>
               or a <option>passphrase</option>.
             '';
-            example = ''
-              encryption.mode = "repokey-blake2" ;
-              encryption.passphrase = "mySecretPassphrase" ;
-            '';
+            example = "repokey-blake2";
           };
 
           encryption.passCommand = mkOption {
@@ -437,7 +434,7 @@ in {
               for the available options.
             '';
             default = { };
-            example = literalExample ''
+            example = literalExpression ''
               {
                 within = "1d"; # Keep all archives from the last day
                 daily = 7;
@@ -455,7 +452,7 @@ in {
               Use <literal>""</literal> to consider all archives.
             '';
             default = config.archiveBaseName;
-            defaultText = "\${archiveBaseName}";
+            defaultText = literalExpression "archiveBaseName";
           };
 
           environment = mkOption {
diff --git a/nixos/modules/services/backup/btrbk.nix b/nixos/modules/services/backup/btrbk.nix
index a8ff71f609a..0c00b934405 100644
--- a/nixos/modules/services/backup/btrbk.nix
+++ b/nixos/modules/services/backup/btrbk.nix
@@ -57,7 +57,7 @@ in
         description = "Extra packages for btrbk, like compression utilities for <literal>stream_compress</literal>";
         type = lib.types.listOf lib.types.package;
         default = [ ];
-        example = lib.literalExample "[ pkgs.xz ]";
+        example = lib.literalExpression "[ pkgs.xz ]";
       };
       niceness = lib.mkOption {
         description = "Niceness for local instances of btrbk. Also applies to remote ones connecting via ssh when positive.";
diff --git a/nixos/modules/services/backup/postgresql-backup.nix b/nixos/modules/services/backup/postgresql-backup.nix
index bcc135005e1..562458eb457 100644
--- a/nixos/modules/services/backup/postgresql-backup.nix
+++ b/nixos/modules/services/backup/postgresql-backup.nix
@@ -85,7 +85,7 @@ in {
 
       backupAll = mkOption {
         default = cfg.databases == [];
-        defaultText = "services.postgresqlBackup.databases == []";
+        defaultText = literalExpression "services.postgresqlBackup.databases == []";
         type = lib.types.bool;
         description = ''
           Backup all databases using pg_dumpall.
diff --git a/nixos/modules/services/backup/postgresql-wal-receiver.nix b/nixos/modules/services/backup/postgresql-wal-receiver.nix
index 3d9869d5343..32643adfdae 100644
--- a/nixos/modules/services/backup/postgresql-wal-receiver.nix
+++ b/nixos/modules/services/backup/postgresql-wal-receiver.nix
@@ -7,7 +7,7 @@ let
     options = {
       postgresqlPackage = mkOption {
         type = types.package;
-        example = literalExample "pkgs.postgresql_11";
+        example = literalExpression "pkgs.postgresql_11";
         description = ''
           PostgreSQL package to use.
         '';
@@ -15,7 +15,7 @@ let
 
       directory = mkOption {
         type = types.path;
-        example = literalExample "/mnt/pg_wal/main/";
+        example = literalExpression "/mnt/pg_wal/main/";
         description = ''
           Directory to write the output to.
         '';
@@ -88,7 +88,7 @@ let
       extraArgs = mkOption {
         type = with types; listOf str;
         default = [ ];
-        example = literalExample ''
+        example = literalExpression ''
           [
             "--no-sync"
           ]
@@ -101,7 +101,7 @@ let
       environment = mkOption {
         type = with types; attrsOf str;
         default = { };
-        example = literalExample ''
+        example = literalExpression ''
           {
             PGPASSFILE = "/private/passfile";
             PGSSLMODE = "require";
@@ -121,7 +121,7 @@ in {
       receivers = mkOption {
         type = with types; attrsOf (submodule receiverSubmodule);
         default = { };
-        example = literalExample ''
+        example = literalExpression ''
           {
             main = {
               postgresqlPackage = pkgs.postgresql_11;
diff --git a/nixos/modules/services/backup/restic-rest-server.nix b/nixos/modules/services/backup/restic-rest-server.nix
index d1b775f150d..86744637f85 100644
--- a/nixos/modules/services/backup/restic-rest-server.nix
+++ b/nixos/modules/services/backup/restic-rest-server.nix
@@ -59,7 +59,7 @@ in
 
     package = mkOption {
       default = pkgs.restic-rest-server;
-      defaultText = "pkgs.restic-rest-server";
+      defaultText = literalExpression "pkgs.restic-rest-server";
       type = types.package;
       description = "Restic REST server package to use.";
     };
diff --git a/nixos/modules/services/backup/syncoid.nix b/nixos/modules/services/backup/syncoid.nix
index 6e44a99aaee..4df10f5ee02 100644
--- a/nixos/modules/services/backup/syncoid.nix
+++ b/nixos/modules/services/backup/syncoid.nix
@@ -286,7 +286,7 @@ in
         };
       }));
       default = { };
-      example = literalExample ''
+      example = literalExpression ''
         {
           "pool/test".target = "root@target:pool/test";
         }
diff --git a/nixos/modules/services/backup/tarsnap.nix b/nixos/modules/services/backup/tarsnap.nix
index 3cf21c1baa7..9cce8683661 100644
--- a/nixos/modules/services/backup/tarsnap.nix
+++ b/nixos/modules/services/backup/tarsnap.nix
@@ -214,7 +214,7 @@ in
               maxbwRateUp = mkOption {
                 type = types.nullOr types.int;
                 default = null;
-                example = literalExample "25 * 1000";
+                example = literalExpression "25 * 1000";
                 description = ''
                   Upload bandwidth rate limit in bytes.
                 '';
@@ -223,7 +223,7 @@ in
               maxbwRateDown = mkOption {
                 type = types.nullOr types.int;
                 default = null;
-                example = literalExample "50 * 1000";
+                example = literalExpression "50 * 1000";
                 description = ''
                   Download bandwidth rate limit in bytes.
                 '';
@@ -256,7 +256,7 @@ in
 
         default = {};
 
-        example = literalExample ''
+        example = literalExpression ''
           {
             nixos =
               { directories = [ "/home" "/root/ssl" ];
diff --git a/nixos/modules/services/backup/znapzend.nix b/nixos/modules/services/backup/znapzend.nix
index 1fccc7cd607..09e60177c39 100644
--- a/nixos/modules/services/backup/znapzend.nix
+++ b/nixos/modules/services/backup/znapzend.nix
@@ -166,8 +166,8 @@ let
           <option>postsnap</option>.
         '';
         default = null;
-        example = literalExample ''
-          ''${pkgs.mariadb}/bin/mysql -e "set autocommit=0;flush tables with read lock;\\! ''${pkgs.coreutils}/bin/sleep 600" &  ''${pkgs.coreutils}/bin/echo $! > /tmp/mariadblock.pid ; sleep 10
+        example = literalExpression ''
+          '''''${pkgs.mariadb}/bin/mysql -e "set autocommit=0;flush tables with read lock;\\! ''${pkgs.coreutils}/bin/sleep 600" &  ''${pkgs.coreutils}/bin/echo $! > /tmp/mariadblock.pid ; sleep 10'''
         '';
       };
 
@@ -178,8 +178,8 @@ let
           e.g. for database unlocking. See also <option>presnap</option>.
         '';
         default = null;
-        example = literalExample ''
-          ''${pkgs.coreutils}/bin/kill `''${pkgs.coreutils}/bin/cat /tmp/mariadblock.pid`;''${pkgs.coreutils}/bin/rm /tmp/mariadblock.pid
+        example = literalExpression ''
+          "''${pkgs.coreutils}/bin/kill `''${pkgs.coreutils}/bin/cat /tmp/mariadblock.pid`;''${pkgs.coreutils}/bin/rm /tmp/mariadblock.pid"
         '';
       };
 
@@ -223,7 +223,7 @@ let
         type = attrsOf (destType config);
         description = "Additional destinations.";
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           {
             local = {
               dataset = "btank/backup";
@@ -331,7 +331,7 @@ in
         type = attrsOf srcType;
         description = "Znapzend configuration.";
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           {
             "tank/home" = {
               # Make snapshots of tank/home every hour, keep those for 1 day,