From f9f354faadb32ae2f0ac11eab0d824cc40f1d56c Mon Sep 17 00:00:00 2001
From: Joachim Fasting <joachifm@fastmail.fm>
Date: Mon, 21 Nov 2016 16:26:03 +0100
Subject: [PATCH] nixos/modules: use defaultText where applicable

Primarily to fix rendering of these default values in the manual but
it's also nice to avoid having to eval these things just to build the
manual.
---
 nixos/modules/config/i18n.nix                                 | 1 +
 nixos/modules/programs/java.nix                               | 1 +
 .../services/continuous-integration/gocd-agent/default.nix    | 1 +
 .../services/continuous-integration/gocd-server/default.nix   | 1 +
 nixos/modules/services/misc/dictd.nix                         | 3 ++-
 nixos/modules/services/misc/disnix.nix                        | 1 +
 nixos/modules/services/misc/gitlab.nix                        | 3 +++
 nixos/modules/services/networking/flannel.nix                 | 1 +
 nixos/modules/services/networking/quassel.nix                 | 3 ++-
 nixos/modules/services/search/hound.nix                       | 2 ++
 nixos/modules/services/torrent/opentracker.nix                | 1 +
 nixos/modules/services/web-apps/quassel-webserver.nix         | 2 ++
 nixos/modules/services/x11/compton.nix                        | 1 +
 nixos/modules/system/boot/plymouth.nix                        | 4 ++++
 14 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/nixos/modules/config/i18n.nix b/nixos/modules/config/i18n.nix
index e341931aacce..d7fd38ebed9a 100644
--- a/nixos/modules/config/i18n.nix
+++ b/nixos/modules/config/i18n.nix
@@ -44,6 +44,7 @@ in
       consolePackages = mkOption {
         type = types.listOf types.package;
         default = with pkgs.kbdKeymaps; [ dvp neo ];
+        defaultText = ''with pkgs.kbdKeymaps; [ dvp neo ]'';
         description = ''
 	  List of additional packages that provide console fonts, keymaps and
           other resources.
diff --git a/nixos/modules/programs/java.nix b/nixos/modules/programs/java.nix
index 3292aa369d28..d31698c3b392 100644
--- a/nixos/modules/programs/java.nix
+++ b/nixos/modules/programs/java.nix
@@ -34,6 +34,7 @@ in
 
       package = mkOption {
         default = pkgs.jdk;
+        defaultText = "pkgs.jdk";
         description = ''
           Java package to install. Typical values are pkgs.jdk or pkgs.jre.
         '';
diff --git a/nixos/modules/services/continuous-integration/gocd-agent/default.nix b/nixos/modules/services/continuous-integration/gocd-agent/default.nix
index d60b55e83d11..05adb18fbe91 100644
--- a/nixos/modules/services/continuous-integration/gocd-agent/default.nix
+++ b/nixos/modules/services/continuous-integration/gocd-agent/default.nix
@@ -37,6 +37,7 @@ in {
 
       packages = mkOption {
         default = [ pkgs.stdenv pkgs.jre pkgs.git config.programs.ssh.package pkgs.nix ];
+        defaultText = "[ pkgs.stdenv pkgs.jre pkgs.git config.programs.ssh.package pkgs.nix ]";
         type = types.listOf types.package;
         description = ''
           Packages to add to PATH for the Go.CD agent process.
diff --git a/nixos/modules/services/continuous-integration/gocd-server/default.nix b/nixos/modules/services/continuous-integration/gocd-server/default.nix
index 4bb792055d25..07e00f17f1e8 100644
--- a/nixos/modules/services/continuous-integration/gocd-server/default.nix
+++ b/nixos/modules/services/continuous-integration/gocd-server/default.nix
@@ -68,6 +68,7 @@ in {
 
       packages = mkOption {
         default = [ pkgs.stdenv pkgs.jre pkgs.git config.programs.ssh.package pkgs.nix ];
+        defaultText = "[ pkgs.stdenv pkgs.jre pkgs.git config.programs.ssh.package pkgs.nix ]";
         type = types.listOf types.package;
         description = ''
           Packages to add to PATH for the Go.CD server's process.
diff --git a/nixos/modules/services/misc/dictd.nix b/nixos/modules/services/misc/dictd.nix
index 24dca15dd913..7e3b6431a133 100644
--- a/nixos/modules/services/misc/dictd.nix
+++ b/nixos/modules/services/misc/dictd.nix
@@ -25,7 +25,8 @@ in
       DBs = mkOption {
         type = types.listOf types.package;
         default = with pkgs.dictdDBs; [ wiktionary wordnet ];
-        example = [ pkgs.dictdDBs.nld2eng ];
+        defaultText = "with pkgs.dictdDBs; [ wiktionary wordnet ]";
+        example = literalExample "[ pkgs.dictdDBs.nld2eng ]";
         description = ''List of databases to make available.'';
       };
 
diff --git a/nixos/modules/services/misc/disnix.nix b/nixos/modules/services/misc/disnix.nix
index e5a125ad3245..e96645c79c77 100644
--- a/nixos/modules/services/misc/disnix.nix
+++ b/nixos/modules/services/misc/disnix.nix
@@ -41,6 +41,7 @@ in
         type = types.path;
         description = "The Disnix package";
         default = pkgs.disnix;
+        defaultText = "pkgs.disnix";
       };
 
     };
diff --git a/nixos/modules/services/misc/gitlab.nix b/nixos/modules/services/misc/gitlab.nix
index 3e4584c7a512..cb8fa901bbd2 100644
--- a/nixos/modules/services/misc/gitlab.nix
+++ b/nixos/modules/services/misc/gitlab.nix
@@ -164,18 +164,21 @@ in {
       packages.gitlab = mkOption {
         type = types.package;
         default = pkgs.gitlab;
+        defaultText = "pkgs.gitlab";
         description = "Reference to the gitlab package";
       };
 
       packages.gitlab-shell = mkOption {
         type = types.package;
         default = pkgs.gitlab-shell;
+        defaultText = "pkgs.gitlab-shell";
         description = "Reference to the gitlab-shell package";
       };
 
       packages.gitlab-workhorse = mkOption {
         type = types.package;
         default = pkgs.gitlab-workhorse;
+        defaultText = "pkgs.gitlab-workhorse";
         description = "Reference to the gitlab-workhorse package";
       };
 
diff --git a/nixos/modules/services/networking/flannel.nix b/nixos/modules/services/networking/flannel.nix
index 28b6c4f657dd..ca47a18bc1f6 100644
--- a/nixos/modules/services/networking/flannel.nix
+++ b/nixos/modules/services/networking/flannel.nix
@@ -20,6 +20,7 @@ in {
       description = "Package to use for flannel";
       type = types.package;
       default = pkgs.flannel.bin;
+      defaultText = "pkgs.flannel.bin";
     };
 
     publicIp = mkOption {
diff --git a/nixos/modules/services/networking/quassel.nix b/nixos/modules/services/networking/quassel.nix
index 3f0906fdb80d..edcc12170b20 100644
--- a/nixos/modules/services/networking/quassel.nix
+++ b/nixos/modules/services/networking/quassel.nix
@@ -26,10 +26,11 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.kde4.quasselDaemon;
+        defaultText = "pkgs.kde4.quasselDaemon";
         description = ''
           The package of the quassel daemon.
         '';
-        example = pkgs.quasselDaemon;
+        example = literalExample "pkgs.quasselDaemon";
       };
 
       interfaces = mkOption {
diff --git a/nixos/modules/services/search/hound.nix b/nixos/modules/services/search/hound.nix
index 1226cba682ec..a94a851e80ec 100644
--- a/nixos/modules/services/search/hound.nix
+++ b/nixos/modules/services/search/hound.nix
@@ -50,6 +50,8 @@ in {
 
       package = mkOption {
         default = pkgs.hound;
+        defaultText = "pkgs.hound";
+        type = types.package;
         description = ''
           Package for running hound.
         '';
diff --git a/nixos/modules/services/torrent/opentracker.nix b/nixos/modules/services/torrent/opentracker.nix
index d86b9fea2d79..74f443381d92 100644
--- a/nixos/modules/services/torrent/opentracker.nix
+++ b/nixos/modules/services/torrent/opentracker.nix
@@ -13,6 +13,7 @@ in {
         opentracker package to use
       '';
       default = pkgs.opentracker;
+      defaultText = "pkgs.opentracker";
     };
 
     extraOptions = mkOption {
diff --git a/nixos/modules/services/web-apps/quassel-webserver.nix b/nixos/modules/services/web-apps/quassel-webserver.nix
index 7de9480d4c46..d19e4bc58277 100644
--- a/nixos/modules/services/web-apps/quassel-webserver.nix
+++ b/nixos/modules/services/web-apps/quassel-webserver.nix
@@ -31,6 +31,8 @@ in {
       };
       pkg = mkOption {
         default = pkgs.quassel-webserver;
+        defaultText = "pkgs.quassel-webserver";
+        type = types.package;
         description = "The quassel-webserver package";
       };
       quasselCoreHost = mkOption {
diff --git a/nixos/modules/services/x11/compton.nix b/nixos/modules/services/x11/compton.nix
index bda4eec01026..7cbca1dcddfd 100644
--- a/nixos/modules/services/x11/compton.nix
+++ b/nixos/modules/services/x11/compton.nix
@@ -188,6 +188,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.compton;
+      defaultText = "pkgs.compton";
       example = literalExample "pkgs.compton";
       description = ''
         Compton derivation to use.
diff --git a/nixos/modules/system/boot/plymouth.nix b/nixos/modules/system/boot/plymouth.nix
index 60a587af8e9f..d45b1686c1ea 100644
--- a/nixos/modules/system/boot/plymouth.nix
+++ b/nixos/modules/system/boot/plymouth.nix
@@ -51,6 +51,10 @@ in
           url = "https://nixos.org/logo/nixos-hires.png";
           sha256 = "1ivzgd7iz0i06y36p8m5w48fd8pjqwxhdaavc0pxs7w1g7mcy5si";
         };
+        defaultText = ''pkgs.fetchurl {
+          url = "https://nixos.org/logo/nixos-hires.png";
+          sha256 = "1ivzgd7iz0i06y36p8m5w48fd8pjqwxhdaavc0pxs7w1g7mcy5si";
+        }'';
         description = ''
           Logo which is displayed on the splash screen.
         '';