summary refs log tree commit diff
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
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
-rw-r--r--nixos/doc/manual/development/option-declarations.section.md10
-rw-r--r--nixos/doc/manual/from_md/development/option-declarations.section.xml20
-rw-r--r--nixos/maintainers/scripts/ec2/amazon-image.nix2
-rw-r--r--nixos/modules/config/fonts/fonts.nix2
-rw-r--r--nixos/modules/config/i18n.nix2
-rw-r--r--nixos/modules/config/krb5/default.nix16
-rw-r--r--nixos/modules/config/networking.nix6
-rw-r--r--nixos/modules/config/power-management.nix4
-rw-r--r--nixos/modules/config/pulseaudio.nix10
-rw-r--r--nixos/modules/config/shells-environment.nix8
-rw-r--r--nixos/modules/config/sysctl.nix2
-rw-r--r--nixos/modules/config/system-path.nix6
-rw-r--r--nixos/modules/config/unix-odbc-drivers.nix2
-rw-r--r--nixos/modules/config/users-groups.nix6
-rw-r--r--nixos/modules/config/xdg/portals/wlr.nix2
-rw-r--r--nixos/modules/hardware/ckb-next.nix2
-rw-r--r--nixos/modules/hardware/device-tree.nix10
-rw-r--r--nixos/modules/hardware/digitalbitbox.nix2
-rw-r--r--nixos/modules/hardware/opengl.nix4
-rw-r--r--nixos/modules/hardware/opentabletdriver.nix2
-rw-r--r--nixos/modules/hardware/printers.nix8
-rw-r--r--nixos/modules/hardware/sata.nix2
-rw-r--r--nixos/modules/hardware/video/nvidia.nix4
-rw-r--r--nixos/modules/hardware/video/uvcvideo/default.nix2
-rw-r--r--nixos/modules/i18n/input-method/fcitx.nix2
-rw-r--r--nixos/modules/i18n/input-method/fcitx5.nix2
-rw-r--r--nixos/modules/i18n/input-method/ibus.nix4
-rw-r--r--nixos/modules/i18n/input-method/kime.nix2
-rw-r--r--nixos/modules/installer/cd-dvd/iso-image.nix4
-rw-r--r--nixos/modules/installer/cd-dvd/system-tarball.nix4
-rw-r--r--nixos/modules/installer/netboot/netboot.nix2
-rw-r--r--nixos/modules/installer/sd-card/sd-image.nix8
-rw-r--r--nixos/modules/misc/documentation.nix4
-rw-r--r--nixos/modules/misc/locate.nix4
-rw-r--r--nixos/modules/misc/nixpkgs.nix18
-rw-r--r--nixos/modules/programs/atop.nix4
-rw-r--r--nixos/modules/programs/captive-browser.nix2
-rw-r--r--nixos/modules/programs/chromium.nix4
-rw-r--r--nixos/modules/programs/digitalbitbox/default.nix2
-rw-r--r--nixos/modules/programs/dmrconfig.nix2
-rw-r--r--nixos/modules/programs/feedbackd.nix1
-rw-r--r--nixos/modules/programs/firejail.nix6
-rw-r--r--nixos/modules/programs/flexoptix-app.nix2
-rw-r--r--nixos/modules/programs/freetds.nix2
-rw-r--r--nixos/modules/programs/gamemode.nix2
-rw-r--r--nixos/modules/programs/git.nix4
-rw-r--r--nixos/modules/programs/gnupg.nix2
-rw-r--r--nixos/modules/programs/java.nix2
-rw-r--r--nixos/modules/programs/kdeconnect.nix4
-rw-r--r--nixos/modules/programs/less.nix3
-rw-r--r--nixos/modules/programs/mtr.nix1
-rw-r--r--nixos/modules/programs/neovim.nix26
-rw-r--r--nixos/modules/programs/noisetorch.nix1
-rw-r--r--nixos/modules/programs/npm.nix5
-rw-r--r--nixos/modules/programs/proxychains.nix2
-rw-r--r--nixos/modules/programs/shadow.nix2
-rw-r--r--nixos/modules/programs/spacefm.nix12
-rw-r--r--nixos/modules/programs/ssh.nix7
-rw-r--r--nixos/modules/programs/ssmtp.nix2
-rw-r--r--nixos/modules/programs/sway.nix4
-rw-r--r--nixos/modules/programs/tsm-client.nix8
-rw-r--r--nixos/modules/programs/vim.nix4
-rw-r--r--nixos/modules/programs/wireshark.nix2
-rw-r--r--nixos/modules/programs/xonsh.nix3
-rw-r--r--nixos/modules/programs/xss-lock.nix3
-rw-r--r--nixos/modules/programs/xwayland.nix9
-rw-r--r--nixos/modules/programs/yabar.nix3
-rw-r--r--nixos/modules/programs/zsh/oh-my-zsh.nix2
-rw-r--r--nixos/modules/programs/zsh/zsh-autoenv.nix2
-rw-r--r--nixos/modules/programs/zsh/zsh-autosuggestions.nix2
-rw-r--r--nixos/modules/programs/zsh/zsh-syntax-highlighting.nix4
-rw-r--r--nixos/modules/security/acme.nix4
-rw-r--r--nixos/modules/security/ca.nix4
-rw-r--r--nixos/modules/security/dhparams.nix2
-rw-r--r--nixos/modules/security/doas.nix2
-rw-r--r--nixos/modules/security/pam.nix2
-rw-r--r--nixos/modules/security/pam_mount.nix4
-rw-r--r--nixos/modules/security/sudo.nix4
-rw-r--r--nixos/modules/security/systemd-confinement.nix4
-rw-r--r--nixos/modules/security/tpm2.nix7
-rw-r--r--nixos/modules/security/wrappers/default.nix2
-rw-r--r--nixos/modules/services/admin/meshcentral.nix2
-rw-r--r--nixos/modules/services/admin/oxidized.nix4
-rw-r--r--nixos/modules/services/amqp/activemq/default.nix3
-rw-r--r--nixos/modules/services/amqp/rabbitmq.nix4
-rw-r--r--nixos/modules/services/audio/botamusique.nix1
-rw-r--r--nixos/modules/services/audio/jack.nix6
-rw-r--r--nixos/modules/services/audio/liquidsoap.nix6
-rw-r--r--nixos/modules/services/audio/mopidy.nix2
-rw-r--r--nixos/modules/services/audio/mpd.nix6
-rw-r--r--nixos/modules/services/audio/slimserver.nix2
-rw-r--r--nixos/modules/services/audio/snapserver.nix6
-rw-r--r--nixos/modules/services/audio/ympd.nix1
-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
-rw-r--r--nixos/modules/services/blockchain/ethereum/geth.nix1
-rw-r--r--nixos/modules/services/cluster/hadoop/default.nix11
-rw-r--r--nixos/modules/services/cluster/k3s/default.nix3
-rw-r--r--nixos/modules/services/cluster/kubernetes/addon-manager.nix4
-rw-r--r--nixos/modules/services/cluster/kubernetes/addons/dns.nix31
-rw-r--r--nixos/modules/services/cluster/kubernetes/default.nix2
-rw-r--r--nixos/modules/services/cluster/kubernetes/kubelet.nix2
-rw-r--r--nixos/modules/services/cluster/spark/default.nix6
-rw-r--r--nixos/modules/services/computing/boinc/client.nix4
-rw-r--r--nixos/modules/services/computing/foldingathome/client.nix2
-rw-r--r--nixos/modules/services/computing/slurm/slurm.nix8
-rw-r--r--nixos/modules/services/continuous-integration/buildbot/master.nix11
-rw-r--r--nixos/modules/services/continuous-integration/buildbot/worker.nix6
-rw-r--r--nixos/modules/services/continuous-integration/buildkite-agents.nix7
-rw-r--r--nixos/modules/services/continuous-integration/github-runner.nix3
-rw-r--r--nixos/modules/services/continuous-integration/gitlab-runner.nix12
-rw-r--r--nixos/modules/services/continuous-integration/gocd-agent/default.nix2
-rw-r--r--nixos/modules/services/continuous-integration/gocd-server/default.nix2
-rw-r--r--nixos/modules/services/continuous-integration/hail.nix2
-rw-r--r--nixos/modules/services/continuous-integration/hercules-ci-agent/common.nix15
-rw-r--r--nixos/modules/services/continuous-integration/hydra/default.nix4
-rw-r--r--nixos/modules/services/continuous-integration/jenkins/default.nix6
-rw-r--r--nixos/modules/services/continuous-integration/jenkins/job-builder.nix4
-rw-r--r--nixos/modules/services/databases/aerospike.nix2
-rw-r--r--nixos/modules/services/databases/cassandra.nix10
-rw-r--r--nixos/modules/services/databases/cockroachdb.nix2
-rw-r--r--nixos/modules/services/databases/couchdb.nix3
-rw-r--r--nixos/modules/services/databases/firebird.nix8
-rw-r--r--nixos/modules/services/databases/hbase.nix3
-rw-r--r--nixos/modules/services/databases/influxdb.nix2
-rw-r--r--nixos/modules/services/databases/influxdb2.nix2
-rw-r--r--nixos/modules/services/databases/monetdb.nix2
-rw-r--r--nixos/modules/services/databases/mongodb.nix2
-rw-r--r--nixos/modules/services/databases/mysql.nix16
-rw-r--r--nixos/modules/services/databases/neo4j.nix2
-rw-r--r--nixos/modules/services/databases/openldap.nix13
-rw-r--r--nixos/modules/services/databases/opentsdb.nix3
-rw-r--r--nixos/modules/services/databases/pgmanage.nix2
-rw-r--r--nixos/modules/services/databases/postgresql.nix12
-rw-r--r--nixos/modules/services/databases/redis.nix5
-rw-r--r--nixos/modules/services/databases/riak.nix3
-rw-r--r--nixos/modules/services/databases/victoriametrics.nix2
-rw-r--r--nixos/modules/services/desktops/geoclue2.nix4
-rw-r--r--nixos/modules/services/desktops/gnome/evolution-data-server.nix2
-rw-r--r--nixos/modules/services/desktops/gvfs.nix1
-rw-r--r--nixos/modules/services/desktops/pipewire/pipewire-media-session.nix4
-rw-r--r--nixos/modules/services/desktops/pipewire/pipewire.nix3
-rw-r--r--nixos/modules/services/development/distccd.nix2
-rw-r--r--nixos/modules/services/development/hoogle.nix6
-rw-r--r--nixos/modules/services/development/jupyter/default.nix8
-rw-r--r--nixos/modules/services/development/jupyter/kernel-options.nix8
-rw-r--r--nixos/modules/services/development/jupyterhub/default.nix28
-rw-r--r--nixos/modules/services/development/lorri.nix3
-rw-r--r--nixos/modules/services/display-managers/greetd.nix6
-rw-r--r--nixos/modules/services/editors/emacs.nix2
-rw-r--r--nixos/modules/services/editors/infinoted.nix2
-rw-r--r--nixos/modules/services/games/crossfire-server.nix54
-rw-r--r--nixos/modules/services/games/deliantra-server.nix38
-rw-r--r--nixos/modules/services/games/factorio.nix6
-rw-r--r--nixos/modules/services/games/minecraft-server.nix8
-rw-r--r--nixos/modules/services/hardware/acpid.nix2
-rw-r--r--nixos/modules/services/hardware/actkbd.nix2
-rw-r--r--nixos/modules/services/hardware/bluetooth.nix6
-rw-r--r--nixos/modules/services/hardware/freefall.nix2
-rw-r--r--nixos/modules/services/hardware/fwupd.nix3
-rw-r--r--nixos/modules/services/hardware/interception-tools.nix1
-rw-r--r--nixos/modules/services/hardware/pcscd.nix4
-rw-r--r--nixos/modules/services/hardware/sane.nix3
-rw-r--r--nixos/modules/services/hardware/sane_extra_backends/brscan4.nix8
-rw-r--r--nixos/modules/services/hardware/sane_extra_backends/brscan5.nix8
-rw-r--r--nixos/modules/services/hardware/thermald.nix2
-rw-r--r--nixos/modules/services/hardware/triggerhappy.nix2
-rw-r--r--nixos/modules/services/hardware/undervolt.nix2
-rw-r--r--nixos/modules/services/hardware/upower.nix3
-rw-r--r--nixos/modules/services/hardware/vdr.nix4
-rw-r--r--nixos/modules/services/logging/SystemdJournal2Gelf.nix1
-rw-r--r--nixos/modules/services/logging/awstats.nix8
-rw-r--r--nixos/modules/services/logging/fluentd.nix2
-rw-r--r--nixos/modules/services/logging/graylog.nix5
-rw-r--r--nixos/modules/services/logging/journalbeat.nix4
-rw-r--r--nixos/modules/services/logging/logcheck.nix2
-rw-r--r--nixos/modules/services/logging/logrotate.nix2
-rw-r--r--nixos/modules/services/logging/logstash.nix19
-rw-r--r--nixos/modules/services/logging/syslog-ng.nix4
-rw-r--r--nixos/modules/services/mail/davmail.nix2
-rw-r--r--nixos/modules/services/mail/dovecot.nix4
-rw-r--r--nixos/modules/services/mail/exim.nix4
-rw-r--r--nixos/modules/services/mail/mailman.nix4
-rw-r--r--nixos/modules/services/mail/offlineimap.nix4
-rw-r--r--nixos/modules/services/mail/opensmtpd.nix2
-rw-r--r--nixos/modules/services/mail/postfix.nix1
-rw-r--r--nixos/modules/services/mail/roundcube.nix5
-rw-r--r--nixos/modules/services/mail/rspamd.nix10
-rw-r--r--nixos/modules/services/mail/sympa.nix8
-rw-r--r--nixos/modules/services/misc/airsonic.nix6
-rw-r--r--nixos/modules/services/misc/ankisyncd.nix2
-rw-r--r--nixos/modules/services/misc/apache-kafka.nix4
-rw-r--r--nixos/modules/services/misc/autofs.nix2
-rw-r--r--nixos/modules/services/misc/bees.nix4
-rw-r--r--nixos/modules/services/misc/cgminer.nix2
-rw-r--r--nixos/modules/services/misc/clipcat.nix2
-rw-r--r--nixos/modules/services/misc/clipmenu.nix2
-rwxr-xr-xnixos/modules/services/misc/confd.nix2
-rw-r--r--nixos/modules/services/misc/dictd.nix4
-rw-r--r--nixos/modules/services/misc/disnix.nix3
-rw-r--r--nixos/modules/services/misc/dwm-status.nix4
-rw-r--r--nixos/modules/services/misc/etcd.nix2
-rw-r--r--nixos/modules/services/misc/etebase-server.nix6
-rw-r--r--nixos/modules/services/misc/felix.nix2
-rw-r--r--nixos/modules/services/misc/freeswitch.nix9
-rw-r--r--nixos/modules/services/misc/gitea.nix11
-rw-r--r--nixos/modules/services/misc/gitit.nix52
-rw-r--r--nixos/modules/services/misc/gitlab.nix18
-rw-r--r--nixos/modules/services/misc/gitolite.nix12
-rw-r--r--nixos/modules/services/misc/greenclip.nix2
-rw-r--r--nixos/modules/services/misc/home-assistant.nix8
-rw-r--r--nixos/modules/services/misc/ihaskell.nix7
-rw-r--r--nixos/modules/services/misc/jackett.nix2
-rw-r--r--nixos/modules/services/misc/jellyfin.nix2
-rw-r--r--nixos/modules/services/misc/klipper.nix1
-rw-r--r--nixos/modules/services/misc/lidarr.nix2
-rw-r--r--nixos/modules/services/misc/matrix-appservice-discord.nix2
-rw-r--r--nixos/modules/services/misc/matrix-synapse.nix4
-rw-r--r--nixos/modules/services/misc/mautrix-telegram.nix2
-rw-r--r--nixos/modules/services/misc/mbpfan.nix2
-rw-r--r--nixos/modules/services/misc/mediatomb.nix7
-rw-r--r--nixos/modules/services/misc/mx-puppet-discord.nix2
-rw-r--r--nixos/modules/services/misc/nitter.nix2
-rw-r--r--nixos/modules/services/misc/nix-daemon.nix4
-rw-r--r--nixos/modules/services/misc/nzbhydra2.nix2
-rw-r--r--nixos/modules/services/misc/octoprint.nix4
-rw-r--r--nixos/modules/services/misc/paperless-ng.nix8
-rw-r--r--nixos/modules/services/misc/plex.nix2
-rw-r--r--nixos/modules/services/misc/redmine.nix17
-rw-r--r--nixos/modules/services/misc/rippled.nix2
-rw-r--r--nixos/modules/services/misc/sickbeard.nix3
-rw-r--r--nixos/modules/services/misc/snapper.nix22
-rw-r--r--nixos/modules/services/misc/sourcehut/builds.nix2
-rw-r--r--nixos/modules/services/misc/sourcehut/git.nix3
-rw-r--r--nixos/modules/services/misc/ssm-agent.nix2
-rw-r--r--nixos/modules/services/misc/subsonic.nix1
-rw-r--r--nixos/modules/services/misc/tautulli.nix2
-rw-r--r--nixos/modules/services/misc/tp-auto-kbbl.nix2
-rw-r--r--nixos/modules/services/misc/uhub.nix2
-rw-r--r--nixos/modules/services/misc/weechat.nix7
-rw-r--r--nixos/modules/services/misc/xmr-stak.nix2
-rw-r--r--nixos/modules/services/misc/zigbee2mqtt.nix4
-rw-r--r--nixos/modules/services/misc/zookeeper.nix2
-rw-r--r--nixos/modules/services/monitoring/alerta.nix4
-rw-r--r--nixos/modules/services/monitoring/arbtt.nix3
-rw-r--r--nixos/modules/services/monitoring/bosun.nix3
-rw-r--r--nixos/modules/services/monitoring/collectd.nix2
-rw-r--r--nixos/modules/services/monitoring/datadog-agent.nix10
-rw-r--r--nixos/modules/services/monitoring/grafana-reporter.nix5
-rw-r--r--nixos/modules/services/monitoring/grafana.nix5
-rw-r--r--nixos/modules/services/monitoring/graphite.nix6
-rw-r--r--nixos/modules/services/monitoring/heapster.nix2
-rw-r--r--nixos/modules/services/monitoring/incron.nix2
-rw-r--r--nixos/modules/services/monitoring/kapacitor.nix5
-rw-r--r--nixos/modules/services/monitoring/loki.nix4
-rw-r--r--nixos/modules/services/monitoring/mackerel-agent.nix1
-rw-r--r--nixos/modules/services/monitoring/metricbeat.nix7
-rw-r--r--nixos/modules/services/monitoring/munin.nix12
-rw-r--r--nixos/modules/services/monitoring/nagios.nix8
-rw-r--r--nixos/modules/services/monitoring/netdata.nix10
-rw-r--r--nixos/modules/services/monitoring/parsedmarc.nix2
-rw-r--r--nixos/modules/services/monitoring/prometheus/alertmanager.nix2
-rw-r--r--nixos/modules/services/monitoring/prometheus/default.nix4
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters.nix6
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/buildkite-agent.nix2
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/flow.nix2
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/kea.nix2
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/knot.nix2
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/mail.nix2
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/mikrotik.nix4
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/node.nix4
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/pihole.nix4
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/process.nix14
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/rspamd.nix4
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/script.nix2
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/snmp.nix16
-rw-r--r--nixos/modules/services/monitoring/prometheus/pushgateway.nix2
-rw-r--r--nixos/modules/services/monitoring/scollector.nix5
-rw-r--r--nixos/modules/services/monitoring/telegraf.nix4
-rw-r--r--nixos/modules/services/monitoring/thanos.nix8
-rw-r--r--nixos/modules/services/monitoring/unifi-poller.nix4
-rw-r--r--nixos/modules/services/monitoring/zabbix-agent.nix10
-rw-r--r--nixos/modules/services/monitoring/zabbix-proxy.nix10
-rw-r--r--nixos/modules/services/monitoring/zabbix-server.nix8
-rw-r--r--nixos/modules/services/network-filesystems/ceph.nix32
-rw-r--r--nixos/modules/services/network-filesystems/glusterfs.nix3
-rw-r--r--nixos/modules/services/network-filesystems/ipfs.nix2
-rw-r--r--nixos/modules/services/network-filesystems/litestream/default.nix2
-rw-r--r--nixos/modules/services/network-filesystems/openafs/client.nix15
-rw-r--r--nixos/modules/services/network-filesystems/openafs/server.nix4
-rw-r--r--nixos/modules/services/network-filesystems/orangefs/client.nix1
-rw-r--r--nixos/modules/services/network-filesystems/orangefs/server.nix13
-rw-r--r--nixos/modules/services/network-filesystems/samba.nix6
-rw-r--r--nixos/modules/services/network-filesystems/tahoe.nix6
-rw-r--r--nixos/modules/services/network-filesystems/xtreemfs.nix4
-rw-r--r--nixos/modules/services/networking/3proxy.nix19
-rw-r--r--nixos/modules/services/networking/asterisk.nix4
-rw-r--r--nixos/modules/services/networking/atftpd.nix2
-rw-r--r--nixos/modules/services/networking/avahi-daemon.nix6
-rw-r--r--nixos/modules/services/networking/bee.nix4
-rw-r--r--nixos/modules/services/networking/biboumi.nix1
-rw-r--r--nixos/modules/services/networking/bind.nix4
-rw-r--r--nixos/modules/services/networking/bitcoind.nix4
-rw-r--r--nixos/modules/services/networking/bitlbee.nix4
-rw-r--r--nixos/modules/services/networking/blockbook-frontend.nix15
-rw-r--r--nixos/modules/services/networking/cjdns.nix4
-rw-r--r--nixos/modules/services/networking/connman.nix5
-rw-r--r--nixos/modules/services/networking/consul.nix4
-rw-r--r--nixos/modules/services/networking/coredns.nix2
-rw-r--r--nixos/modules/services/networking/corerad.nix6
-rw-r--r--nixos/modules/services/networking/coturn.nix4
-rw-r--r--nixos/modules/services/networking/dnscache.nix2
-rw-r--r--nixos/modules/services/networking/dnscrypt-proxy2.nix6
-rw-r--r--nixos/modules/services/networking/doh-proxy-rust.nix2
-rw-r--r--nixos/modules/services/networking/ejabberd.nix4
-rw-r--r--nixos/modules/services/networking/epmd.nix1
-rw-r--r--nixos/modules/services/networking/ferm.nix4
-rw-r--r--nixos/modules/services/networking/firewall.nix6
-rw-r--r--nixos/modules/services/networking/flannel.nix2
-rw-r--r--nixos/modules/services/networking/ghostunnel.nix4
-rw-r--r--nixos/modules/services/networking/globalprotect-vpn.nix2
-rw-r--r--nixos/modules/services/networking/gnunet.nix4
-rw-r--r--nixos/modules/services/networking/gobgpd.nix2
-rw-r--r--nixos/modules/services/networking/hans.nix2
-rw-r--r--nixos/modules/services/networking/hylafax/options.nix8
-rw-r--r--nixos/modules/services/networking/i2pd.nix2
-rw-r--r--nixos/modules/services/networking/icecream/daemon.nix2
-rw-r--r--nixos/modules/services/networking/icecream/scheduler.nix2
-rw-r--r--nixos/modules/services/networking/inspircd.nix4
-rw-r--r--nixos/modules/services/networking/iodine.nix2
-rw-r--r--nixos/modules/services/networking/ircd-hybrid/default.nix4
-rw-r--r--nixos/modules/services/networking/iscsi/initiator.nix2
-rw-r--r--nixos/modules/services/networking/jicofo.nix2
-rw-r--r--nixos/modules/services/networking/jitsi-videobridge.nix6
-rw-r--r--nixos/modules/services/networking/keepalived/vrrp-instance-options.nix4
-rw-r--r--nixos/modules/services/networking/keepalived/vrrp-script-options.nix2
-rw-r--r--nixos/modules/services/networking/knot.nix2
-rw-r--r--nixos/modules/services/networking/kresd.nix4
-rw-r--r--nixos/modules/services/networking/lambdabot.nix2
-rw-r--r--nixos/modules/services/networking/libreswan.nix4
-rw-r--r--nixos/modules/services/networking/minidlna.nix2
-rw-r--r--nixos/modules/services/networking/miredo.nix2
-rw-r--r--nixos/modules/services/networking/morty.nix7
-rw-r--r--nixos/modules/services/networking/mosquitto.nix2
-rw-r--r--nixos/modules/services/networking/murmur.nix2
-rw-r--r--nixos/modules/services/networking/mxisd.nix2
-rw-r--r--nixos/modules/services/networking/nat.nix2
-rw-r--r--nixos/modules/services/networking/nats.nix3
-rw-r--r--nixos/modules/services/networking/ncdns.nix2
-rw-r--r--nixos/modules/services/networking/ndppd.nix2
-rw-r--r--nixos/modules/services/networking/nebula.nix14
-rw-r--r--nixos/modules/services/networking/networkmanager.nix2
-rw-r--r--nixos/modules/services/networking/nftables.nix2
-rw-r--r--nixos/modules/services/networking/ngircd.nix2
-rw-r--r--nixos/modules/services/networking/nixops-dns.nix1
-rw-r--r--nixos/modules/services/networking/nntp-proxy.nix22
-rw-r--r--nixos/modules/services/networking/nomad.nix8
-rw-r--r--nixos/modules/services/networking/nsd.nix6
-rw-r--r--nixos/modules/services/networking/ntp/chrony.nix2
-rw-r--r--nixos/modules/services/networking/ntp/ntpd.nix2
-rw-r--r--nixos/modules/services/networking/ofono.nix2
-rw-r--r--nixos/modules/services/networking/onedrive.nix3
-rw-r--r--nixos/modules/services/networking/openvpn.nix2
-rw-r--r--nixos/modules/services/networking/ostinato.nix4
-rw-r--r--nixos/modules/services/networking/pdns-recursor.nix2
-rw-r--r--nixos/modules/services/networking/pleroma.nix1
-rw-r--r--nixos/modules/services/networking/pppd.nix2
-rw-r--r--nixos/modules/services/networking/privoxy.nix2
-rw-r--r--nixos/modules/services/networking/prosody.nix4
-rw-r--r--nixos/modules/services/networking/quassel.nix3
-rw-r--r--nixos/modules/services/networking/quorum.nix4
-rw-r--r--nixos/modules/services/networking/radicale.nix6
-rw-r--r--nixos/modules/services/networking/searx.nix6
-rw-r--r--nixos/modules/services/networking/shadowsocks.nix10
-rw-r--r--nixos/modules/services/networking/shellhub-agent.nix2
-rw-r--r--nixos/modules/services/networking/shorewall.nix2
-rw-r--r--nixos/modules/services/networking/shorewall6.nix2
-rw-r--r--nixos/modules/services/networking/skydns.nix2
-rw-r--r--nixos/modules/services/networking/smartdns.nix2
-rw-r--r--nixos/modules/services/networking/smokeping.nix17
-rw-r--r--nixos/modules/services/networking/sniproxy.nix4
-rw-r--r--nixos/modules/services/networking/softether.nix2
-rw-r--r--nixos/modules/services/networking/spacecookie.nix4
-rw-r--r--nixos/modules/services/networking/spiped.nix2
-rw-r--r--nixos/modules/services/networking/strongswan-swanctl/module.nix2
-rw-r--r--nixos/modules/services/networking/strongswan.nix4
-rw-r--r--nixos/modules/services/networking/stunnel.nix1
-rw-r--r--nixos/modules/services/networking/supplicant.nix4
-rw-r--r--nixos/modules/services/networking/supybot.nix7
-rw-r--r--nixos/modules/services/networking/syncthing.nix10
-rw-r--r--nixos/modules/services/networking/tailscale.nix2
-rw-r--r--nixos/modules/services/networking/tedicross.nix2
-rw-r--r--nixos/modules/services/networking/thelounge.nix2
-rw-r--r--nixos/modules/services/networking/tinc.nix6
-rw-r--r--nixos/modules/services/networking/toxvpn.nix2
-rw-r--r--nixos/modules/services/networking/trickster.nix2
-rw-r--r--nixos/modules/services/networking/ucarp.nix10
-rw-r--r--nixos/modules/services/networking/unbound.nix4
-rw-r--r--nixos/modules/services/networking/unifi.nix6
-rw-r--r--nixos/modules/services/networking/vsftpd.nix2
-rw-r--r--nixos/modules/services/networking/websockify.nix2
-rw-r--r--nixos/modules/services/networking/wg-quick.nix16
-rw-r--r--nixos/modules/services/networking/wireguard.nix10
-rw-r--r--nixos/modules/services/networking/wpa_supplicant.nix4
-rw-r--r--nixos/modules/services/networking/x2goserver.nix15
-rw-r--r--nixos/modules/services/networking/xandikos.nix4
-rw-r--r--nixos/modules/services/networking/xrdp.nix2
-rw-r--r--nixos/modules/services/networking/yggdrasil.nix2
-rw-r--r--nixos/modules/services/networking/zeronet.nix6
-rw-r--r--nixos/modules/services/networking/zerotierone.nix3
-rw-r--r--nixos/modules/services/networking/znc/default.nix6
-rw-r--r--nixos/modules/services/networking/znc/options.nix6
-rw-r--r--nixos/modules/services/printing/cupsd.nix2
-rw-r--r--nixos/modules/services/scheduling/cron.nix2
-rw-r--r--nixos/modules/services/search/elasticsearch.nix4
-rw-r--r--nixos/modules/services/search/hound.nix24
-rw-r--r--nixos/modules/services/search/kibana.nix3
-rw-r--r--nixos/modules/services/search/solr.nix2
-rw-r--r--nixos/modules/services/security/certmgr.nix4
-rw-r--r--nixos/modules/services/security/cfssl.nix4
-rw-r--r--nixos/modules/services/security/fail2ban.nix10
-rw-r--r--nixos/modules/services/security/fprintd.nix4
-rw-r--r--nixos/modules/services/security/haka.nix2
-rw-r--r--nixos/modules/services/security/hockeypuck.nix2
-rw-r--r--nixos/modules/services/security/nginx-sso.nix4
-rw-r--r--nixos/modules/services/security/oauth2_proxy.nix2
-rw-r--r--nixos/modules/services/security/privacyidea.nix1
-rw-r--r--nixos/modules/services/security/shibboleth-sp.nix2
-rw-r--r--nixos/modules/services/security/sks.nix4
-rw-r--r--nixos/modules/services/security/step-ca.nix1
-rw-r--r--nixos/modules/services/security/tor.nix3
-rw-r--r--nixos/modules/services/security/usbguard.nix2
-rw-r--r--nixos/modules/services/security/vault.nix2
-rw-r--r--nixos/modules/services/security/vaultwarden/default.nix6
-rw-r--r--nixos/modules/services/security/yubikey-agent.nix2
-rw-r--r--nixos/modules/services/system/saslauthd.nix2
-rw-r--r--nixos/modules/services/torrent/deluge.nix4
-rw-r--r--nixos/modules/services/torrent/flexget.nix2
-rw-r--r--nixos/modules/services/torrent/magnetico.nix2
-rw-r--r--nixos/modules/services/torrent/opentracker.nix2
-rw-r--r--nixos/modules/services/torrent/rtorrent.nix2
-rw-r--r--nixos/modules/services/ttys/getty.nix1
-rw-r--r--nixos/modules/services/video/epgstation/default.nix29
-rw-r--r--nixos/modules/services/video/mirakurun.nix6
-rw-r--r--nixos/modules/services/video/replay-sorcery.nix2
-rw-r--r--nixos/modules/services/video/unifi-video.nix6
-rw-r--r--nixos/modules/services/wayland/cage.nix3
-rw-r--r--nixos/modules/services/web-apps/atlassian/confluence.nix4
-rw-r--r--nixos/modules/services/web-apps/atlassian/crowd.nix4
-rw-r--r--nixos/modules/services/web-apps/atlassian/jira.nix4
-rw-r--r--nixos/modules/services/web-apps/bookstack.nix20
-rw-r--r--nixos/modules/services/web-apps/cryptpad.nix4
-rw-r--r--nixos/modules/services/web-apps/dex.nix2
-rw-r--r--nixos/modules/services/web-apps/discourse.nix25
-rw-r--r--nixos/modules/services/web-apps/documize.nix1
-rw-r--r--nixos/modules/services/web-apps/dokuwiki.nix65
-rw-r--r--nixos/modules/services/web-apps/engelsystem.nix4
-rw-r--r--nixos/modules/services/web-apps/fluidd.nix10
-rw-r--r--nixos/modules/services/web-apps/galene.nix3
-rw-r--r--nixos/modules/services/web-apps/gerrit.nix3
-rw-r--r--nixos/modules/services/web-apps/hedgedoc.nix15
-rw-r--r--nixos/modules/services/web-apps/hledger-web.nix2
-rw-r--r--nixos/modules/services/web-apps/icingaweb2/icingaweb2.nix2
-rw-r--r--nixos/modules/services/web-apps/isso.nix4
-rw-r--r--nixos/modules/services/web-apps/jirafeau.nix11
-rw-r--r--nixos/modules/services/web-apps/jitsi-meet.nix4
-rw-r--r--nixos/modules/services/web-apps/keycloak.nix3
-rw-r--r--nixos/modules/services/web-apps/limesurvey.nix10
-rw-r--r--nixos/modules/services/web-apps/mastodon.nix2
-rw-r--r--nixos/modules/services/web-apps/matomo.nix18
-rw-r--r--nixos/modules/services/web-apps/mediawiki.nix11
-rw-r--r--nixos/modules/services/web-apps/miniflux.nix2
-rw-r--r--nixos/modules/services/web-apps/moinmoin.nix2
-rw-r--r--nixos/modules/services/web-apps/moodle.nix10
-rw-r--r--nixos/modules/services/web-apps/nextcloud.nix4
-rw-r--r--nixos/modules/services/web-apps/nexus.nix22
-rw-r--r--nixos/modules/services/web-apps/node-red.nix6
-rw-r--r--nixos/modules/services/web-apps/pgpkeyserver-lite.nix2
-rw-r--r--nixos/modules/services/web-apps/plantuml-server.nix2
-rw-r--r--nixos/modules/services/web-apps/restya-board.nix3
-rw-r--r--nixos/modules/services/web-apps/rss-bridge.nix4
-rw-r--r--nixos/modules/services/web-apps/selfoss.nix1
-rw-r--r--nixos/modules/services/web-apps/shiori.nix2
-rw-r--r--nixos/modules/services/web-apps/tt-rss.nix2
-rw-r--r--nixos/modules/services/web-apps/vikunja.nix6
-rw-r--r--nixos/modules/services/web-apps/whitebophir.nix2
-rw-r--r--nixos/modules/services/web-apps/wordpress.nix71
-rw-r--r--nixos/modules/services/web-apps/youtrack.nix4
-rw-r--r--nixos/modules/services/web-apps/zabbix.nix6
-rw-r--r--nixos/modules/services/web-servers/apache-httpd/default.nix19
-rw-r--r--nixos/modules/services/web-servers/apache-httpd/vhost-options.nix4
-rw-r--r--nixos/modules/services/web-servers/caddy/default.nix5
-rw-r--r--nixos/modules/services/web-servers/lighttpd/cgit.nix12
-rw-r--r--nixos/modules/services/web-servers/minio.nix2
-rw-r--r--nixos/modules/services/web-servers/molly-brown.nix2
-rw-r--r--nixos/modules/services/web-servers/nginx/default.nix10
-rw-r--r--nixos/modules/services/web-servers/nginx/location-options.nix2
-rw-r--r--nixos/modules/services/web-servers/nginx/vhost-options.nix6
-rw-r--r--nixos/modules/services/web-servers/phpfpm/default.nix10
-rw-r--r--nixos/modules/services/web-servers/tomcat.nix8
-rw-r--r--nixos/modules/services/web-servers/traefik.nix6
-rw-r--r--nixos/modules/services/web-servers/trafficserver/default.nix40
-rw-r--r--nixos/modules/services/web-servers/ttyd.nix2
-rw-r--r--nixos/modules/services/web-servers/unit/default.nix4
-rw-r--r--nixos/modules/services/web-servers/uwsgi.nix4
-rw-r--r--nixos/modules/services/web-servers/varnish/default.nix4
-rw-r--r--nixos/modules/services/web-servers/zope2.nix2
-rw-r--r--nixos/modules/services/x11/desktop-managers/cde.nix2
-rw-r--r--nixos/modules/services/x11/desktop-managers/cinnamon.nix4
-rw-r--r--nixos/modules/services/x11/desktop-managers/gnome.nix18
-rw-r--r--nixos/modules/services/x11/desktop-managers/kodi.nix4
-rw-r--r--nixos/modules/services/x11/desktop-managers/lxqt.nix2
-rw-r--r--nixos/modules/services/x11/desktop-managers/mate.nix2
-rw-r--r--nixos/modules/services/x11/desktop-managers/pantheon.nix4
-rw-r--r--nixos/modules/services/x11/desktop-managers/surf-display.nix3
-rw-r--r--nixos/modules/services/x11/desktop-managers/xfce.nix2
-rw-r--r--nixos/modules/services/x11/desktop-managers/xterm.nix4
-rw-r--r--nixos/modules/services/x11/display-managers/default.nix6
-rw-r--r--nixos/modules/services/x11/display-managers/lightdm-greeters/enso-os.nix6
-rw-r--r--nixos/modules/services/x11/display-managers/lightdm-greeters/gtk.nix6
-rw-r--r--nixos/modules/services/x11/display-managers/lightdm.nix2
-rw-r--r--nixos/modules/services/x11/display-managers/sddm.nix14
-rw-r--r--nixos/modules/services/x11/extra-layouts.nix2
-rw-r--r--nixos/modules/services/x11/imwheel.nix20
-rw-r--r--nixos/modules/services/x11/picom.nix2
-rw-r--r--nixos/modules/services/x11/redshift.nix2
-rw-r--r--nixos/modules/services/x11/touchegg.nix2
-rw-r--r--nixos/modules/services/x11/unclutter-xfixes.nix2
-rw-r--r--nixos/modules/services/x11/unclutter.nix2
-rw-r--r--nixos/modules/services/x11/urxvtd.nix2
-rw-r--r--nixos/modules/services/x11/window-managers/awesome.nix2
-rw-r--r--nixos/modules/services/x11/window-managers/bspwm.nix12
-rw-r--r--nixos/modules/services/x11/window-managers/clfswm.nix2
-rw-r--r--nixos/modules/services/x11/window-managers/exwm.nix7
-rw-r--r--nixos/modules/services/x11/window-managers/herbstluftwm.nix2
-rw-r--r--nixos/modules/services/x11/window-managers/i3.nix6
-rw-r--r--nixos/modules/services/x11/window-managers/wmderland.nix2
-rw-r--r--nixos/modules/services/x11/window-managers/xmonad.nix10
-rw-r--r--nixos/modules/services/x11/xautolock.nix7
-rw-r--r--nixos/modules/services/x11/xserver.nix5
-rw-r--r--nixos/modules/system/activation/activation-script.nix9
-rw-r--r--nixos/modules/system/activation/top-level.nix10
-rw-r--r--nixos/modules/system/boot/initrd-openvpn.nix2
-rw-r--r--nixos/modules/system/boot/initrd-ssh.nix2
-rw-r--r--nixos/modules/system/boot/kernel.nix12
-rw-r--r--nixos/modules/system/boot/kernel_config.nix2
-rw-r--r--nixos/modules/system/boot/loader/grub/grub.nix12
-rw-r--r--nixos/modules/system/boot/loader/grub/ipxe.nix2
-rw-r--r--nixos/modules/system/boot/luksroot.nix2
-rw-r--r--nixos/modules/system/boot/networkd.nix12
-rw-r--r--nixos/modules/system/boot/plymouth.nix3
-rw-r--r--nixos/modules/system/boot/stage-1.nix6
-rw-r--r--nixos/modules/system/boot/systemd.nix10
-rw-r--r--nixos/modules/system/etc/etc.nix2
-rw-r--r--nixos/modules/tasks/filesystems.nix2
-rw-r--r--nixos/modules/tasks/filesystems/nfs.nix2
-rw-r--r--nixos/modules/tasks/filesystems/zfs.nix5
-rw-r--r--nixos/modules/tasks/lvm.nix2
-rw-r--r--nixos/modules/tasks/network-interfaces.nix19
-rw-r--r--nixos/modules/virtualisation/anbox.nix2
-rw-r--r--nixos/modules/virtualisation/containers.nix8
-rw-r--r--nixos/modules/virtualisation/cri-o.nix8
-rw-r--r--nixos/modules/virtualisation/digital-ocean-init.nix2
-rw-r--r--nixos/modules/virtualisation/docker.nix3
-rw-r--r--nixos/modules/virtualisation/ecs-agent.nix2
-rw-r--r--nixos/modules/virtualisation/libvirtd.nix3
-rw-r--r--nixos/modules/virtualisation/lxd.nix6
-rw-r--r--nixos/modules/virtualisation/nixos-containers.nix6
-rw-r--r--nixos/modules/virtualisation/oci-containers.nix16
-rw-r--r--nixos/modules/virtualisation/openvswitch.nix2
-rw-r--r--nixos/modules/virtualisation/parallels-guest.nix3
-rw-r--r--nixos/modules/virtualisation/podman.nix2
-rw-r--r--nixos/modules/virtualisation/qemu-guest-agent.nix1
-rw-r--r--nixos/modules/virtualisation/qemu-vm.nix2
-rw-r--r--nixos/modules/virtualisation/railcar.nix7
-rw-r--r--nixos/modules/virtualisation/virtualbox-host.nix2
-rw-r--r--nixos/modules/virtualisation/xen-dom0.nix8
584 files changed, 1612 insertions, 1554 deletions
diff --git a/nixos/doc/manual/development/option-declarations.section.md b/nixos/doc/manual/development/option-declarations.section.md
index 819c23684cd..be56529992a 100644
--- a/nixos/doc/manual/development/option-declarations.section.md
+++ b/nixos/doc/manual/development/option-declarations.section.md
@@ -38,9 +38,19 @@ The function `mkOption` accepts the following arguments.
     of the module will have to define the value of the option, otherwise
     an error will be thrown.
 
+`defaultText`
+
+:   A textual representation of the default value to be rendered verbatim in
+    the manual. Useful if the default value is a complex expression or depends
+    on other values or packages.
+    Use `lib.literalExpression` for a Nix expression, `lib.literalDocBook` for
+    a plain English description in DocBook format.
+
 `example`
 
 :   An example value that will be shown in the NixOS manual.
+    You can use `lib.literalExpression` and `lib.literalDocBook` in the same way
+    as in `defaultText`.
 
 `description`
 
diff --git a/nixos/doc/manual/from_md/development/option-declarations.section.xml b/nixos/doc/manual/from_md/development/option-declarations.section.xml
index 85a59a543d1..2845e37659b 100644
--- a/nixos/doc/manual/from_md/development/option-declarations.section.xml
+++ b/nixos/doc/manual/from_md/development/option-declarations.section.xml
@@ -59,11 +59,29 @@ options = {
     </varlistentry>
     <varlistentry>
       <term>
+        <literal>defaultText</literal>
+      </term>
+      <listitem>
+        <para>
+          A textual representation of the default value to be rendered
+          verbatim in the manual. Useful if the default value is a
+          complex expression or depends on other values or packages. Use
+          <literal>lib.literalExpression</literal> for a Nix expression,
+          <literal>lib.literalDocBook</literal> for a plain English
+          description in DocBook format.
+        </para>
+      </listitem>
+    </varlistentry>
+    <varlistentry>
+      <term>
         <literal>example</literal>
       </term>
       <listitem>
         <para>
-          An example value that will be shown in the NixOS manual.
+          An example value that will be shown in the NixOS manual. You
+          can use <literal>lib.literalExpression</literal> and
+          <literal>lib.literalDocBook</literal> in the same way as in
+          <literal>defaultText</literal>.
         </para>
       </listitem>
     </varlistentry>
diff --git a/nixos/maintainers/scripts/ec2/amazon-image.nix b/nixos/maintainers/scripts/ec2/amazon-image.nix
index 6942b58f236..72b7414ff80 100644
--- a/nixos/maintainers/scripts/ec2/amazon-image.nix
+++ b/nixos/maintainers/scripts/ec2/amazon-image.nix
@@ -27,7 +27,7 @@ in {
     };
 
     contents = mkOption {
-      example = literalExample ''
+      example = literalExpression ''
         [ { source = pkgs.memtest86 + "/memtest.bin";
             target = "boot/memtest.bin";
           }
diff --git a/nixos/modules/config/fonts/fonts.nix b/nixos/modules/config/fonts/fonts.nix
index f87e61e3ef9..04952898cb7 100644
--- a/nixos/modules/config/fonts/fonts.nix
+++ b/nixos/modules/config/fonts/fonts.nix
@@ -61,7 +61,7 @@ in
       fonts = mkOption {
         type = types.listOf types.path;
         default = [];
-        example = literalExample "[ pkgs.dejavu_fonts ]";
+        example = literalExpression "[ pkgs.dejavu_fonts ]";
         description = "List of primary font paths.";
       };
 
diff --git a/nixos/modules/config/i18n.nix b/nixos/modules/config/i18n.nix
index 991b449d80b..545d4a3dca6 100644
--- a/nixos/modules/config/i18n.nix
+++ b/nixos/modules/config/i18n.nix
@@ -14,7 +14,7 @@ with lib;
           allLocales = any (x: x == "all") config.i18n.supportedLocales;
           locales = config.i18n.supportedLocales;
         };
-        example = literalExample "pkgs.glibcLocales";
+        example = literalExpression "pkgs.glibcLocales";
         description = ''
           Customized pkg.glibcLocales package.
 
diff --git a/nixos/modules/config/krb5/default.nix b/nixos/modules/config/krb5/default.nix
index 6db2a7e4039..911c5b629a9 100644
--- a/nixos/modules/config/krb5/default.nix
+++ b/nixos/modules/config/krb5/default.nix
@@ -83,8 +83,8 @@ in {
       kerberos = mkOption {
         type = types.package;
         default = pkgs.krb5Full;
-        defaultText = "pkgs.krb5Full";
-        example = literalExample "pkgs.heimdal";
+        defaultText = literalExpression "pkgs.krb5Full";
+        example = literalExpression "pkgs.heimdal";
         description = ''
           The Kerberos implementation that will be present in
           <literal>environment.systemPackages</literal> after enabling this
@@ -96,7 +96,7 @@ in {
         type = with types; either attrs lines;
         default = {};
         apply = attrs: filterEmbeddedMetadata attrs;
-        example = literalExample ''
+        example = literalExpression ''
           {
             default_realm = "ATHENA.MIT.EDU";
           };
@@ -109,7 +109,7 @@ in {
       realms = mkOption {
         type = with types; either attrs lines;
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           {
             "ATHENA.MIT.EDU" = {
               admin_server = "athena.mit.edu";
@@ -127,7 +127,7 @@ in {
       domain_realm = mkOption {
         type = with types; either attrs lines;
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           {
             "example.com" = "EXAMPLE.COM";
             ".example.com" = "EXAMPLE.COM";
@@ -142,7 +142,7 @@ in {
       capaths = mkOption {
         type = with types; either attrs lines;
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           {
             "ATHENA.MIT.EDU" = {
               "EXAMPLE.COM" = ".";
@@ -161,7 +161,7 @@ in {
       appdefaults = mkOption {
         type = with types; either attrs lines;
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           {
             pam = {
               debug = false;
@@ -182,7 +182,7 @@ in {
       plugins = mkOption {
         type = with types; either attrs lines;
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           {
             ccselect = {
               disable = "k5identity";
diff --git a/nixos/modules/config/networking.nix b/nixos/modules/config/networking.nix
index 8c4eec510e5..11307e33120 100644
--- a/nixos/modules/config/networking.nix
+++ b/nixos/modules/config/networking.nix
@@ -21,7 +21,7 @@ in
 
     networking.hosts = lib.mkOption {
       type = types.attrsOf (types.listOf types.str);
-      example = literalExample ''
+      example = literalExpression ''
         {
           "127.0.0.1" = [ "foo.bar.baz" ];
           "192.168.0.2" = [ "fileserver.local" "nameserver.local" ];
@@ -34,8 +34,8 @@ in
 
     networking.hostFiles = lib.mkOption {
       type = types.listOf types.path;
-      defaultText = lib.literalExample "Hosts from `networking.hosts` and `networking.extraHosts`";
-      example = lib.literalExample ''[ "''${pkgs.my-blocklist-package}/share/my-blocklist/hosts" ]'';
+      defaultText = literalDocBook "Hosts from <option>networking.hosts</option> and <option>networking.extraHosts</option>";
+      example = literalExpression ''[ "''${pkgs.my-blocklist-package}/share/my-blocklist/hosts" ]'';
       description = ''
         Files that should be concatenated together to form <filename>/etc/hosts</filename>.
       '';
diff --git a/nixos/modules/config/power-management.nix b/nixos/modules/config/power-management.nix
index cc0ff732ffa..710842e1503 100644
--- a/nixos/modules/config/power-management.nix
+++ b/nixos/modules/config/power-management.nix
@@ -35,7 +35,7 @@ in
       powerUpCommands = mkOption {
         type = types.lines;
         default = "";
-        example = literalExample ''
+        example = literalExpression ''
           "''${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda"
         '';
         description =
@@ -49,7 +49,7 @@ in
       powerDownCommands = mkOption {
         type = types.lines;
         default = "";
-        example = literalExample ''
+        example = literalExpression ''
           "''${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda"
         '';
         description =
diff --git a/nixos/modules/config/pulseaudio.nix b/nixos/modules/config/pulseaudio.nix
index 3f7ae109e8c..01555d28b73 100644
--- a/nixos/modules/config/pulseaudio.nix
+++ b/nixos/modules/config/pulseaudio.nix
@@ -149,8 +149,8 @@ in {
         default = if config.services.jack.jackd.enable
                   then pkgs.pulseaudioFull
                   else pkgs.pulseaudio;
-        defaultText = "pkgs.pulseaudio";
-        example = literalExample "pkgs.pulseaudioFull";
+        defaultText = literalExpression "pkgs.pulseaudio";
+        example = literalExpression "pkgs.pulseaudioFull";
         description = ''
           The PulseAudio derivation to use.  This can be used to enable
           features (such as JACK support, Bluetooth) via the
@@ -161,7 +161,7 @@ in {
       extraModules = mkOption {
         type = types.listOf types.package;
         default = [];
-        example = literalExample "[ pkgs.pulseaudio-modules-bt ]";
+        example = literalExpression "[ pkgs.pulseaudio-modules-bt ]";
         description = ''
           Extra pulseaudio modules to use. This is intended for out-of-tree
           pulseaudio modules like extra bluetooth codecs.
@@ -184,7 +184,7 @@ in {
           type = types.attrsOf types.unspecified;
           default = {};
           description = "Config of the pulse daemon. See <literal>man pulse-daemon.conf</literal>.";
-          example = literalExample ''{ realtime-scheduling = "yes"; }'';
+          example = literalExpression ''{ realtime-scheduling = "yes"; }'';
         };
       };
 
@@ -204,7 +204,7 @@ in {
           allowedIpRanges = mkOption {
             type = types.listOf types.str;
             default = [];
-            example = literalExample ''[ "127.0.0.1" "192.168.1.0/24" ]'';
+            example = literalExpression ''[ "127.0.0.1" "192.168.1.0/24" ]'';
             description = ''
               A list of IP subnets that are allowed to stream to the server.
             '';
diff --git a/nixos/modules/config/shells-environment.nix b/nixos/modules/config/shells-environment.nix
index 34e558d8603..ae3f618e273 100644
--- a/nixos/modules/config/shells-environment.nix
+++ b/nixos/modules/config/shells-environment.nix
@@ -136,10 +136,8 @@ in
 
     environment.binsh = mkOption {
       default = "${config.system.build.binsh}/bin/sh";
-      defaultText = "\${config.system.build.binsh}/bin/sh";
-      example = literalExample ''
-        "''${pkgs.dash}/bin/dash"
-      '';
+      defaultText = literalExpression ''"''${config.system.build.binsh}/bin/sh"'';
+      example = literalExpression ''"''${pkgs.dash}/bin/dash"'';
       type = types.path;
       visible = false;
       description = ''
@@ -152,7 +150,7 @@ in
 
     environment.shells = mkOption {
       default = [];
-      example = literalExample "[ pkgs.bashInteractive pkgs.zsh ]";
+      example = literalExpression "[ pkgs.bashInteractive pkgs.zsh ]";
       description = ''
         A list of permissible login shells for user accounts.
         No need to mention <literal>/bin/sh</literal>
diff --git a/nixos/modules/config/sysctl.nix b/nixos/modules/config/sysctl.nix
index e59c7a32c28..db1f5284f50 100644
--- a/nixos/modules/config/sysctl.nix
+++ b/nixos/modules/config/sysctl.nix
@@ -22,7 +22,7 @@ in
 
     boot.kernel.sysctl = mkOption {
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         { "net.ipv4.tcp_syncookies" = false; "vm.swappiness" = 60; }
       '';
       type = types.attrsOf sysctlOption;
diff --git a/nixos/modules/config/system-path.nix b/nixos/modules/config/system-path.nix
index 1292c3008c6..6ff4ec2921c 100644
--- a/nixos/modules/config/system-path.nix
+++ b/nixos/modules/config/system-path.nix
@@ -58,7 +58,7 @@ in
       systemPackages = mkOption {
         type = types.listOf types.package;
         default = [];
-        example = literalExample "[ pkgs.firefox pkgs.thunderbird ]";
+        example = literalExpression "[ pkgs.firefox pkgs.thunderbird ]";
         description = ''
           The set of packages that appear in
           /run/current-system/sw.  These packages are
@@ -73,9 +73,9 @@ in
       defaultPackages = mkOption {
         type = types.listOf types.package;
         default = defaultPackages;
-        example = literalExample "[]";
+        example = [];
         description = ''
-          Set of default packages that aren't strictly neccessary
+          Set of default packages that aren't strictly necessary
           for a running system, entries can be removed for a more
           minimal NixOS installation.
 
diff --git a/nixos/modules/config/unix-odbc-drivers.nix b/nixos/modules/config/unix-odbc-drivers.nix
index abc12a627d6..055c3b2364e 100644
--- a/nixos/modules/config/unix-odbc-drivers.nix
+++ b/nixos/modules/config/unix-odbc-drivers.nix
@@ -19,7 +19,7 @@ in {
     environment.unixODBCDrivers = mkOption {
       type = types.listOf types.package;
       default = [];
-      example = literalExample "with pkgs.unixODBCDrivers; [ sqlite psql ]";
+      example = literalExpression "with pkgs.unixODBCDrivers; [ sqlite psql ]";
       description = ''
         Specifies Unix ODBC drivers to be registered in
         <filename>/etc/odbcinst.ini</filename>.  You may also want to
diff --git a/nixos/modules/config/users-groups.nix b/nixos/modules/config/users-groups.nix
index 8e2db9107a1..629905e6095 100644
--- a/nixos/modules/config/users-groups.nix
+++ b/nixos/modules/config/users-groups.nix
@@ -165,8 +165,8 @@ let
       shell = mkOption {
         type = types.nullOr (types.either types.shellPackage (passwdEntry types.path));
         default = pkgs.shadow;
-        defaultText = "pkgs.shadow";
-        example = literalExample "pkgs.bashInteractive";
+        defaultText = literalExpression "pkgs.shadow";
+        example = literalExpression "pkgs.bashInteractive";
         description = ''
           The path to the user's shell. Can use shell derivations,
           like <literal>pkgs.bashInteractive</literal>. Don’t
@@ -291,7 +291,7 @@ let
       packages = mkOption {
         type = types.listOf types.package;
         default = [];
-        example = literalExample "[ pkgs.firefox pkgs.thunderbird ]";
+        example = literalExpression "[ pkgs.firefox pkgs.thunderbird ]";
         description = ''
           The set of packages that should be made available to the user.
           This is in contrast to <option>environment.systemPackages</option>,
diff --git a/nixos/modules/config/xdg/portals/wlr.nix b/nixos/modules/config/xdg/portals/wlr.nix
index 55baab0026b..aba1d8dbc00 100644
--- a/nixos/modules/config/xdg/portals/wlr.nix
+++ b/nixos/modules/config/xdg/portals/wlr.nix
@@ -37,7 +37,7 @@ in
       default = { };
 
       # Example taken from the manpage
-      example = literalExample ''
+      example = literalExpression ''
         {
           screencast = {
             output_name = "HDMI-A-1";
diff --git a/nixos/modules/hardware/ckb-next.nix b/nixos/modules/hardware/ckb-next.nix
index 6932be1c54c..b2bbd77c9d7 100644
--- a/nixos/modules/hardware/ckb-next.nix
+++ b/nixos/modules/hardware/ckb-next.nix
@@ -27,7 +27,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.ckb-next;
-        defaultText = "pkgs.ckb-next";
+        defaultText = literalExpression "pkgs.ckb-next";
         description = ''
           The package implementing the Corsair keyboard/mouse driver.
         '';
diff --git a/nixos/modules/hardware/device-tree.nix b/nixos/modules/hardware/device-tree.nix
index 4aa1d6369d1..be67116ad50 100644
--- a/nixos/modules/hardware/device-tree.nix
+++ b/nixos/modules/hardware/device-tree.nix
@@ -21,7 +21,7 @@ let
           each .dtb file matching "compatible" of the overlay.
         '';
         default = null;
-        example = literalExample "./dts/overlays.dts";
+        example = literalExpression "./dts/overlays.dts";
       };
 
       dtsText = mkOption {
@@ -31,7 +31,7 @@ let
           Literal DTS contents, overlay is applied to
           each .dtb file matching "compatible" of the overlay.
         '';
-        example = literalExample ''
+        example = ''
           /dts-v1/;
           /plugin/;
           / {
@@ -125,8 +125,8 @@ in
 
         kernelPackage = mkOption {
           default = config.boot.kernelPackages.kernel;
-          defaultText = "config.boot.kernelPackages.kernel";
-          example = literalExample "pkgs.linux_latest";
+          defaultText = literalExpression "config.boot.kernelPackages.kernel";
+          example = literalExpression "pkgs.linux_latest";
           type = types.path;
           description = ''
             Kernel package containing the base device-tree (.dtb) to boot. Uses
@@ -156,7 +156,7 @@ in
 
         overlays = mkOption {
           default = [];
-          example = literalExample ''
+          example = literalExpression ''
             [
               { name = "pps"; dtsFile = ./dts/pps.dts; }
               { name = "spi";
diff --git a/nixos/modules/hardware/digitalbitbox.nix b/nixos/modules/hardware/digitalbitbox.nix
index 0888cfbef2a..097448a74f4 100644
--- a/nixos/modules/hardware/digitalbitbox.nix
+++ b/nixos/modules/hardware/digitalbitbox.nix
@@ -19,7 +19,7 @@ in
     package = mkOption {
       type = types.package;
       default = pkgs.digitalbitbox;
-      defaultText = "pkgs.digitalbitbox";
+      defaultText = literalExpression "pkgs.digitalbitbox";
       description = "The Digital Bitbox package to use. This can be used to install a package with udev rules that differ from the defaults.";
     };
   };
diff --git a/nixos/modules/hardware/opengl.nix b/nixos/modules/hardware/opengl.nix
index a50b5d32c35..0d8aaf73459 100644
--- a/nixos/modules/hardware/opengl.nix
+++ b/nixos/modules/hardware/opengl.nix
@@ -89,7 +89,7 @@ in
       extraPackages = mkOption {
         type = types.listOf types.package;
         default = [];
-        example = literalExample "with pkgs; [ vaapiIntel libvdpau-va-gl vaapiVdpau intel-ocl ]";
+        example = literalExpression "with pkgs; [ vaapiIntel libvdpau-va-gl vaapiVdpau intel-ocl ]";
         description = ''
           Additional packages to add to OpenGL drivers. This can be used
           to add OpenCL drivers, VA-API/VDPAU drivers etc.
@@ -99,7 +99,7 @@ in
       extraPackages32 = mkOption {
         type = types.listOf types.package;
         default = [];
-        example = literalExample "with pkgs.pkgsi686Linux; [ vaapiIntel libvdpau-va-gl vaapiVdpau ]";
+        example = literalExpression "with pkgs.pkgsi686Linux; [ vaapiIntel libvdpau-va-gl vaapiVdpau ]";
         description = ''
           Additional packages to add to 32-bit OpenGL drivers on
           64-bit systems. Used when <option>driSupport32Bit</option> is
diff --git a/nixos/modules/hardware/opentabletdriver.nix b/nixos/modules/hardware/opentabletdriver.nix
index 295e23e6164..caba934ebe7 100644
--- a/nixos/modules/hardware/opentabletdriver.nix
+++ b/nixos/modules/hardware/opentabletdriver.nix
@@ -29,7 +29,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.opentabletdriver;
-        defaultText = "pkgs.opentabletdriver";
+        defaultText = literalExpression "pkgs.opentabletdriver";
         description = ''
           OpenTabletDriver derivation to use.
         '';
diff --git a/nixos/modules/hardware/printers.nix b/nixos/modules/hardware/printers.nix
index c587076dcd1..7bab4f7038d 100644
--- a/nixos/modules/hardware/printers.nix
+++ b/nixos/modules/hardware/printers.nix
@@ -72,10 +72,10 @@ in {
             };
             deviceUri = mkOption {
               type = types.str;
-              example = [
+              example = literalExpression ''
                 "ipp://printserver.local/printers/BrotherHL_Workroom"
                 "usb://HP/DESKJET%20940C?serial=CN16E6C364BH"
-              ];
+              '';
               description = ''
                 How to reach the printer.
                 <command>lpinfo -v</command> shows a list of supported device URIs and schemes.
@@ -83,8 +83,8 @@ in {
             };
             model = mkOption {
               type = types.str;
-              example = literalExample ''
-                gutenprint.''${lib.versions.majorMinor (lib.getVersion pkgs.gutenprint)}://brother-hl-5140/expert
+              example = literalExpression ''
+                "gutenprint.''${lib.versions.majorMinor (lib.getVersion pkgs.gutenprint)}://brother-hl-5140/expert"
               '';
               description = ''
                 Location of the ppd driver file for the printer.
diff --git a/nixos/modules/hardware/sata.nix b/nixos/modules/hardware/sata.nix
index 541897527a8..81592997d6e 100644
--- a/nixos/modules/hardware/sata.nix
+++ b/nixos/modules/hardware/sata.nix
@@ -39,7 +39,7 @@ in
     enable = mkEnableOption "SATA drive timeouts";
 
     deciSeconds = mkOption {
-      example = "70";
+      example = 70;
       type = types.int;
       description = ''
         Set SCT Error Recovery Control timeout in deciseconds for use in RAID configurations.
diff --git a/nixos/modules/hardware/video/nvidia.nix b/nixos/modules/hardware/video/nvidia.nix
index cf87ca5377d..b9eb7f69ef4 100644
--- a/nixos/modules/hardware/video/nvidia.nix
+++ b/nixos/modules/hardware/video/nvidia.nix
@@ -165,11 +165,11 @@ in
     hardware.nvidia.package = lib.mkOption {
       type = lib.types.package;
       default = config.boot.kernelPackages.nvidiaPackages.stable;
-      defaultText = "config.boot.kernelPackages.nvidiaPackages.stable";
+      defaultText = literalExpression "config.boot.kernelPackages.nvidiaPackages.stable";
       description = ''
         The NVIDIA X11 derivation to use.
       '';
-      example = "config.boot.kernelPackages.nvidiaPackages.legacy_340";
+      example = literalExpression "config.boot.kernelPackages.nvidiaPackages.legacy_340";
     };
   };
 
diff --git a/nixos/modules/hardware/video/uvcvideo/default.nix b/nixos/modules/hardware/video/uvcvideo/default.nix
index cf6aa052abb..338062cf69b 100644
--- a/nixos/modules/hardware/video/uvcvideo/default.nix
+++ b/nixos/modules/hardware/video/uvcvideo/default.nix
@@ -33,7 +33,7 @@ in
 
       packages = mkOption {
         type = types.listOf types.path;
-        example = literalExample "[ pkgs.tiscamera ]";
+        example = literalExpression "[ pkgs.tiscamera ]";
         description = ''
           List of packages containing <command>uvcvideo</command> dynamic controls
           rules. All files found in
diff --git a/nixos/modules/i18n/input-method/fcitx.nix b/nixos/modules/i18n/input-method/fcitx.nix
index 440f13b4152..57960cc365b 100644
--- a/nixos/modules/i18n/input-method/fcitx.nix
+++ b/nixos/modules/i18n/input-method/fcitx.nix
@@ -17,7 +17,7 @@ in
       engines = mkOption {
         type    = with types; listOf fcitxEngine;
         default = [];
-        example = literalExample "with pkgs.fcitx-engines; [ mozc hangul ]";
+        example = literalExpression "with pkgs.fcitx-engines; [ mozc hangul ]";
         description =
           let
             enginesDrv = filterAttrs (const isDerivation) pkgs.fcitx-engines;
diff --git a/nixos/modules/i18n/input-method/fcitx5.nix b/nixos/modules/i18n/input-method/fcitx5.nix
index eecbe32fea4..414aabbbaa7 100644
--- a/nixos/modules/i18n/input-method/fcitx5.nix
+++ b/nixos/modules/i18n/input-method/fcitx5.nix
@@ -12,7 +12,7 @@ in {
       addons = mkOption {
         type = with types; listOf package;
         default = [];
-        example = with pkgs; [ fcitx5-rime ];
+        example = literalExpression "with pkgs; [ fcitx5-rime ]";
         description = ''
           Enabled Fcitx5 addons.
         '';
diff --git a/nixos/modules/i18n/input-method/ibus.nix b/nixos/modules/i18n/input-method/ibus.nix
index 1aaa5a952be..92f8c64338a 100644
--- a/nixos/modules/i18n/input-method/ibus.nix
+++ b/nixos/modules/i18n/input-method/ibus.nix
@@ -36,7 +36,7 @@ in
       engines = mkOption {
         type    = with types; listOf ibusEngine;
         default = [];
-        example = literalExample "with pkgs.ibus-engines; [ mozc hangul ]";
+        example = literalExpression "with pkgs.ibus-engines; [ mozc hangul ]";
         description =
           let
             enginesDrv = filterAttrs (const isDerivation) pkgs.ibus-engines;
@@ -48,7 +48,7 @@ in
       panel = mkOption {
         type = with types; nullOr path;
         default = null;
-        example = literalExample "''${pkgs.plasma5Packages.plasma-desktop}/lib/libexec/kimpanel-ibus-panel";
+        example = literalExpression ''"''${pkgs.plasma5Packages.plasma-desktop}/lib/libexec/kimpanel-ibus-panel"'';
         description = "Replace the IBus panel with another panel.";
       };
     };
diff --git a/nixos/modules/i18n/input-method/kime.nix b/nixos/modules/i18n/input-method/kime.nix
index 2a73cb3f460..e462cae2437 100644
--- a/nixos/modules/i18n/input-method/kime.nix
+++ b/nixos/modules/i18n/input-method/kime.nix
@@ -10,7 +10,7 @@ in
       config = mkOption {
         type = yamlFormat.type;
         default = { };
-        example = literalExample ''
+        example = literalExpression ''
           {
             daemon = {
               modules = ["Xim" "Indicator"];
diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix
index 78cbf14bbaf..4812cacabaf 100644
--- a/nixos/modules/installer/cd-dvd/iso-image.nix
+++ b/nixos/modules/installer/cd-dvd/iso-image.nix
@@ -528,7 +528,7 @@ in
     };
 
     isoImage.contents = mkOption {
-      example = literalExample ''
+      example = literalExpression ''
         [ { source = pkgs.memtest86 + "/memtest.bin";
             target = "boot/memtest.bin";
           }
@@ -541,7 +541,7 @@ in
     };
 
     isoImage.storeContents = mkOption {
-      example = literalExample "[ pkgs.stdenv ]";
+      example = literalExpression "[ pkgs.stdenv ]";
       description = ''
         This option lists additional derivations to be included in the
         Nix store in the generated ISO image.
diff --git a/nixos/modules/installer/cd-dvd/system-tarball.nix b/nixos/modules/installer/cd-dvd/system-tarball.nix
index 58098c45535..362c555cc53 100644
--- a/nixos/modules/installer/cd-dvd/system-tarball.nix
+++ b/nixos/modules/installer/cd-dvd/system-tarball.nix
@@ -15,7 +15,7 @@ in
 {
   options = {
     tarball.contents = mkOption {
-      example = literalExample ''
+      example = literalExpression ''
         [ { source = pkgs.memtest86 + "/memtest.bin";
             target = "boot/memtest.bin";
           }
@@ -28,7 +28,7 @@ in
     };
 
     tarball.storeContents = mkOption {
-      example = literalExample "[ pkgs.stdenv ]";
+      example = literalExpression "[ pkgs.stdenv ]";
       description = ''
         This option lists additional derivations to be included in the
         Nix store in the generated ISO image.
diff --git a/nixos/modules/installer/netboot/netboot.nix b/nixos/modules/installer/netboot/netboot.nix
index 28b6c39b29d..145f71b5d0c 100644
--- a/nixos/modules/installer/netboot/netboot.nix
+++ b/nixos/modules/installer/netboot/netboot.nix
@@ -9,7 +9,7 @@ with lib;
   options = {
 
     netboot.storeContents = mkOption {
-      example = literalExample "[ pkgs.stdenv ]";
+      example = literalExpression "[ pkgs.stdenv ]";
       description = ''
         This option lists additional derivations to be included in the
         Nix store in the generated netboot image.
diff --git a/nixos/modules/installer/sd-card/sd-image.nix b/nixos/modules/installer/sd-card/sd-image.nix
index 2a10a77300e..a964cf2d6f8 100644
--- a/nixos/modules/installer/sd-card/sd-image.nix
+++ b/nixos/modules/installer/sd-card/sd-image.nix
@@ -49,7 +49,7 @@ in
 
     storePaths = mkOption {
       type = with types; listOf package;
-      example = literalExample "[ pkgs.stdenv ]";
+      example = literalExpression "[ pkgs.stdenv ]";
       description = ''
         Derivations to be included in the Nix store in the generated SD image.
       '';
@@ -107,7 +107,7 @@ in
     };
 
     populateFirmwareCommands = mkOption {
-      example = literalExample "'' cp \${pkgs.myBootLoader}/u-boot.bin firmware/ ''";
+      example = literalExpression "'' cp \${pkgs.myBootLoader}/u-boot.bin firmware/ ''";
       description = ''
         Shell commands to populate the ./firmware directory.
         All files in that directory are copied to the
@@ -116,7 +116,7 @@ in
     };
 
     populateRootCommands = mkOption {
-      example = literalExample "''\${config.boot.loader.generic-extlinux-compatible.populateCmd} -c \${config.system.build.toplevel} -d ./files/boot''";
+      example = literalExpression "''\${config.boot.loader.generic-extlinux-compatible.populateCmd} -c \${config.system.build.toplevel} -d ./files/boot''";
       description = ''
         Shell commands to populate the ./files directory.
         All files in that directory are copied to the
@@ -126,7 +126,7 @@ in
     };
 
     postBuildCommands = mkOption {
-      example = literalExample "'' dd if=\${pkgs.myBootLoader}/SPL of=$img bs=1024 seek=1 conv=notrunc ''";
+      example = literalExpression "'' dd if=\${pkgs.myBootLoader}/SPL of=$img bs=1024 seek=1 conv=notrunc ''";
       default = "";
       description = ''
         Shell commands to run after the image is built.
diff --git a/nixos/modules/misc/documentation.nix b/nixos/modules/misc/documentation.nix
index ec6b2ad3b88..c3ded4f1ea3 100644
--- a/nixos/modules/misc/documentation.nix
+++ b/nixos/modules/misc/documentation.nix
@@ -133,7 +133,7 @@ in
           extraOutputsToInstall = ["man"];
           ignoreCollisions = true;
         };
-        defaultText = "all man pages in config.environment.systemPackages";
+        defaultText = literalDocBook "all man pages in <option>config.environment.systemPackages</option>";
         description = ''
           The manual pages to generate caches for if <option>generateCaches</option>
           is enabled. Must be a path to a directory with man pages under
@@ -211,7 +211,7 @@ in
           Which extra NixOS module paths the generated NixOS's documentation should strip
           from options.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           # e.g. with options from modules in ''${pkgs.customModules}/nix:
           [ pkgs.customModules ]
         '';
diff --git a/nixos/modules/misc/locate.nix b/nixos/modules/misc/locate.nix
index 5d2f9a21bc5..2f2986c2fec 100644
--- a/nixos/modules/misc/locate.nix
+++ b/nixos/modules/misc/locate.nix
@@ -25,8 +25,8 @@ in {
     locate = mkOption {
       type = package;
       default = pkgs.findutils;
-      defaultText = "pkgs.findutils";
-      example = "pkgs.mlocate";
+      defaultText = literalExpression "pkgs.findutils";
+      example = literalExpression "pkgs.mlocate";
       description = ''
         The locate implementation to use
       '';
diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix
index a2ac5c58528..08bc4398555 100644
--- a/nixos/modules/misc/nixpkgs.nix
+++ b/nixos/modules/misc/nixpkgs.nix
@@ -67,13 +67,13 @@ in
   options.nixpkgs = {
 
     pkgs = mkOption {
-      defaultText = literalExample
-        ''import "''${nixos}/.." {
-            inherit (cfg) config overlays localSystem crossSystem;
-          }
-        '';
+      defaultText = literalExpression ''
+        import "''${nixos}/.." {
+          inherit (cfg) config overlays localSystem crossSystem;
+        }
+      '';
       type = pkgsType;
-      example = literalExample "import <nixpkgs> {}";
+      example = literalExpression "import <nixpkgs> {}";
       description = ''
         If set, the pkgs argument to all NixOS modules is the value of
         this option, extended with <code>nixpkgs.overlays</code>, if
@@ -109,7 +109,7 @@ in
 
     config = mkOption {
       default = {};
-      example = literalExample
+      example = literalExpression
         ''
           { allowBroken = true; allowUnfree = true; }
         '';
@@ -125,7 +125,7 @@ in
 
     overlays = mkOption {
       default = [];
-      example = literalExample
+      example = literalExpression
         ''
           [
             (self: super: {
@@ -158,7 +158,7 @@ in
       # Make sure that the final value has all fields for sake of other modules
       # referring to this. TODO make `lib.systems` itself use the module system.
       apply = lib.systems.elaborate;
-      defaultText = literalExample
+      defaultText = literalExpression
         ''(import "''${nixos}/../lib").lib.systems.examples.aarch64-multiplatform'';
       description = ''
         Specifies the platform on which NixOS should be built. When
diff --git a/nixos/modules/programs/atop.nix b/nixos/modules/programs/atop.nix
index 918c228b3f5..ad75ab27666 100644
--- a/nixos/modules/programs/atop.nix
+++ b/nixos/modules/programs/atop.nix
@@ -19,7 +19,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.atop;
-        defaultText = "pkgs.atop";
+        defaultText = literalExpression "pkgs.atop";
         description = ''
           Which package to use for Atop.
         '';
@@ -37,7 +37,7 @@ in
         package = mkOption {
           type = types.package;
           default = config.boot.kernelPackages.netatop;
-          defaultText = "config.boot.kernelPackages.netatop";
+          defaultText = literalExpression "config.boot.kernelPackages.netatop";
           description = ''
             Which package to use for netatop.
           '';
diff --git a/nixos/modules/programs/captive-browser.nix b/nixos/modules/programs/captive-browser.nix
index 4e8abdeecf0..0f5d087e8d8 100644
--- a/nixos/modules/programs/captive-browser.nix
+++ b/nixos/modules/programs/captive-browser.nix
@@ -14,7 +14,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.captive-browser;
-        defaultText = "pkgs.captive-browser";
+        defaultText = literalExpression "pkgs.captive-browser";
         description = "Which package to use for captive-browser";
       };
 
diff --git a/nixos/modules/programs/chromium.nix b/nixos/modules/programs/chromium.nix
index b727f850a94..602253a321d 100644
--- a/nixos/modules/programs/chromium.nix
+++ b/nixos/modules/programs/chromium.nix
@@ -33,7 +33,7 @@ in
           for additional details.
         '';
         default = [];
-        example = literalExample ''
+        example = literalExpression ''
           [
             "chlffgpmiacpedhhbkiomidkjlcfhogd" # pushbullet
             "mbniclmhobmnbdlbpiphghaielnnpgdp" # lightshot
@@ -75,7 +75,7 @@ in
           Make sure the selected policy is supported on Linux and your browser version.
         '';
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           {
             "BrowserSignin" = 0;
             "SyncDisabled" = true;
diff --git a/nixos/modules/programs/digitalbitbox/default.nix b/nixos/modules/programs/digitalbitbox/default.nix
index 2fe0a14412c..cabdf260cda 100644
--- a/nixos/modules/programs/digitalbitbox/default.nix
+++ b/nixos/modules/programs/digitalbitbox/default.nix
@@ -19,7 +19,7 @@ in
     package = mkOption {
       type = types.package;
       default = pkgs.digitalbitbox;
-      defaultText = "pkgs.digitalbitbox";
+      defaultText = literalExpression "pkgs.digitalbitbox";
       description = "The Digital Bitbox package to use. This can be used to install a package with udev rules that differ from the defaults.";
     };
   };
diff --git a/nixos/modules/programs/dmrconfig.nix b/nixos/modules/programs/dmrconfig.nix
index e48a4f31837..d2a5117c48e 100644
--- a/nixos/modules/programs/dmrconfig.nix
+++ b/nixos/modules/programs/dmrconfig.nix
@@ -24,7 +24,7 @@ in {
       package = mkOption {
         default = pkgs.dmrconfig;
         type = types.package;
-        defaultText = "pkgs.dmrconfig";
+        defaultText = literalExpression "pkgs.dmrconfig";
         description = "dmrconfig derivation to use";
       };
     };
diff --git a/nixos/modules/programs/feedbackd.nix b/nixos/modules/programs/feedbackd.nix
index bb14489a6f4..4194080c8a7 100644
--- a/nixos/modules/programs/feedbackd.nix
+++ b/nixos/modules/programs/feedbackd.nix
@@ -18,6 +18,7 @@ in {
         '';
         type = types.package;
         default = pkgs.feedbackd;
+        defaultText = literalExpression "pkgs.feedbackd";
       };
     };
   };
diff --git a/nixos/modules/programs/firejail.nix b/nixos/modules/programs/firejail.nix
index 9384b01b367..41db4f0136e 100644
--- a/nixos/modules/programs/firejail.nix
+++ b/nixos/modules/programs/firejail.nix
@@ -40,13 +40,13 @@ in {
           executable = mkOption {
             type = types.path;
             description = "Executable to run sandboxed";
-            example = literalExample "''${lib.getBin pkgs.firefox}/bin/firefox";
+            example = literalExpression ''"''${lib.getBin pkgs.firefox}/bin/firefox"'';
           };
           profile = mkOption {
             type = types.nullOr types.path;
             default = null;
             description = "Profile to use";
-            example = literalExample "''${pkgs.firejail}/etc/firejail/firefox.profile";
+            example = literalExpression ''"''${pkgs.firejail}/etc/firejail/firefox.profile"'';
           };
           extraArgs = mkOption {
             type = types.listOf types.str;
@@ -57,7 +57,7 @@ in {
         };
       }));
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         {
           firefox = {
             executable = "''${lib.getBin pkgs.firefox}/bin/firefox";
diff --git a/nixos/modules/programs/flexoptix-app.nix b/nixos/modules/programs/flexoptix-app.nix
index 93dcdfeb514..5e169be2d89 100644
--- a/nixos/modules/programs/flexoptix-app.nix
+++ b/nixos/modules/programs/flexoptix-app.nix
@@ -13,7 +13,7 @@ in {
         description = "FLEXOPTIX app package to use";
         type = types.package;
         default = pkgs.flexoptix-app;
-        defaultText = "\${pkgs.flexoptix-app}";
+        defaultText = literalExpression "pkgs.flexoptix-app";
       };
     };
   };
diff --git a/nixos/modules/programs/freetds.nix b/nixos/modules/programs/freetds.nix
index b4b657e391b..d95c44d756a 100644
--- a/nixos/modules/programs/freetds.nix
+++ b/nixos/modules/programs/freetds.nix
@@ -17,7 +17,7 @@ in
     environment.freetds = mkOption {
       type = types.attrsOf types.str;
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         { MYDATABASE = '''
             host = 10.0.2.100
             port = 1433
diff --git a/nixos/modules/programs/gamemode.nix b/nixos/modules/programs/gamemode.nix
index 102788f5b01..a377a1619aa 100644
--- a/nixos/modules/programs/gamemode.nix
+++ b/nixos/modules/programs/gamemode.nix
@@ -23,7 +23,7 @@ in
           System-wide configuration for GameMode (/etc/gamemode.ini).
           See gamemoded(8) man page for available settings.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           {
             general = {
               renice = 10;
diff --git a/nixos/modules/programs/git.nix b/nixos/modules/programs/git.nix
index 4e06b576f89..461207a6cd3 100644
--- a/nixos/modules/programs/git.nix
+++ b/nixos/modules/programs/git.nix
@@ -14,8 +14,8 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.git;
-        defaultText = "pkgs.git";
-        example = literalExample "pkgs.gitFull";
+        defaultText = literalExpression "pkgs.git";
+        example = literalExpression "pkgs.gitFull";
         description = "The git package to use";
       };
 
diff --git a/nixos/modules/programs/gnupg.nix b/nixos/modules/programs/gnupg.nix
index ce8799b21d6..06f49182e4d 100644
--- a/nixos/modules/programs/gnupg.nix
+++ b/nixos/modules/programs/gnupg.nix
@@ -27,7 +27,7 @@ in
     package = mkOption {
       type = types.package;
       default = pkgs.gnupg;
-      defaultText = "pkgs.gnupg";
+      defaultText = literalExpression "pkgs.gnupg";
       description = ''
         The gpg package that should be used.
       '';
diff --git a/nixos/modules/programs/java.nix b/nixos/modules/programs/java.nix
index d31698c3b39..4e4e0629e5d 100644
--- a/nixos/modules/programs/java.nix
+++ b/nixos/modules/programs/java.nix
@@ -34,7 +34,7 @@ in
 
       package = mkOption {
         default = pkgs.jdk;
-        defaultText = "pkgs.jdk";
+        defaultText = literalExpression "pkgs.jdk";
         description = ''
           Java package to install. Typical values are pkgs.jdk or pkgs.jre.
         '';
diff --git a/nixos/modules/programs/kdeconnect.nix b/nixos/modules/programs/kdeconnect.nix
index 673449b9f63..df698e84dd7 100644
--- a/nixos/modules/programs/kdeconnect.nix
+++ b/nixos/modules/programs/kdeconnect.nix
@@ -13,9 +13,9 @@ with lib;
     '';
     package = mkOption {
       default = pkgs.kdeconnect;
-      defaultText = "pkgs.kdeconnect";
+      defaultText = literalExpression "pkgs.kdeconnect";
       type = types.package;
-      example = literalExample "pkgs.gnomeExtensions.gsconnect";
+      example = literalExpression "pkgs.gnomeExtensions.gsconnect";
       description = ''
         The package providing the implementation for kdeconnect.
       '';
diff --git a/nixos/modules/programs/less.nix b/nixos/modules/programs/less.nix
index 09cb6030e66..c0188788ec7 100644
--- a/nixos/modules/programs/less.nix
+++ b/nixos/modules/programs/less.nix
@@ -40,7 +40,7 @@ in
       configFile = mkOption {
         type = types.nullOr types.path;
         default = null;
-        example = literalExample "\${pkgs.my-configs}/lesskey";
+        example = literalExpression ''"''${pkgs.my-configs}/lesskey"'';
         description = ''
           Path to lesskey configuration file.
 
@@ -91,6 +91,7 @@ in
       lessopen = mkOption {
         type = types.nullOr types.str;
         default = "|${pkgs.lesspipe}/bin/lesspipe.sh %s";
+        defaultText = literalExpression ''"|''${pkgs.lesspipe}/bin/lesspipe.sh %s"'';
         description = ''
           Before less opens a file, it first gives your input preprocessor a chance to modify the way the contents of the file are displayed.
         '';
diff --git a/nixos/modules/programs/mtr.nix b/nixos/modules/programs/mtr.nix
index 63516c58440..3cffe0fd8b2 100644
--- a/nixos/modules/programs/mtr.nix
+++ b/nixos/modules/programs/mtr.nix
@@ -20,6 +20,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.mtr;
+        defaultText = literalExpression "pkgs.mtr";
         description = ''
           The package to use.
         '';
diff --git a/nixos/modules/programs/neovim.nix b/nixos/modules/programs/neovim.nix
index 781c31d2b0c..97b77ae98fe 100644
--- a/nixos/modules/programs/neovim.nix
+++ b/nixos/modules/programs/neovim.nix
@@ -47,18 +47,18 @@ in {
     configure = mkOption {
       type = types.attrs;
       default = {};
-      example = literalExample ''
-        configure = {
-            customRC = $''''
+      example = literalExpression ''
+        {
+          customRC = '''
             " here your custom configuration goes!
-            $'''';
-            packages.myVimPackage = with pkgs.vimPlugins; {
-              # loaded on launch
-              start = [ fugitive ];
-              # manually loadable by calling `:packadd $plugin-name`
-              opt = [ ];
-            };
+          ''';
+          packages.myVimPackage = with pkgs.vimPlugins; {
+            # loaded on launch
+            start = [ fugitive ];
+            # manually loadable by calling `:packadd $plugin-name`
+            opt = [ ];
           };
+        }
       '';
       description = ''
         Generate your init file from your list of plugins and custom commands.
@@ -69,7 +69,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.neovim-unwrapped;
-      defaultText = literalExample "pkgs.neovim-unwrapped";
+      defaultText = literalExpression "pkgs.neovim-unwrapped";
       description = "The package to use for the neovim binary.";
     };
 
@@ -82,8 +82,8 @@ in {
 
     runtime = mkOption {
       default = {};
-      example = literalExample ''
-        runtime."ftplugin/c.vim".text = "setlocal omnifunc=v:lua.vim.lsp.omnifunc";
+      example = literalExpression ''
+        { "ftplugin/c.vim".text = "setlocal omnifunc=v:lua.vim.lsp.omnifunc"; }
       '';
       description = ''
         Set of files that have to be linked in <filename>runtime</filename>.
diff --git a/nixos/modules/programs/noisetorch.nix b/nixos/modules/programs/noisetorch.nix
index bca68b0064c..f76555289f1 100644
--- a/nixos/modules/programs/noisetorch.nix
+++ b/nixos/modules/programs/noisetorch.nix
@@ -10,6 +10,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.noisetorch;
+      defaultText = literalExpression "pkgs.noisetorch";
       description = ''
         The noisetorch package to use.
       '';
diff --git a/nixos/modules/programs/npm.nix b/nixos/modules/programs/npm.nix
index f101a44587a..d79c6c73400 100644
--- a/nixos/modules/programs/npm.nix
+++ b/nixos/modules/programs/npm.nix
@@ -14,10 +14,11 @@ in
       enable = mkEnableOption "<command>npm</command> global config";
 
       package = mkOption {
-        type = types.path;
+        type = types.package;
         description = "The npm package version / flavor to use";
         default = pkgs.nodePackages.npm;
-        example = literalExample "pkgs.nodePackages_13_x.npm";
+        defaultText = literalExpression "pkgs.nodePackages.npm";
+        example = literalExpression "pkgs.nodePackages_13_x.npm";
       };
 
       npmrc = mkOption {
diff --git a/nixos/modules/programs/proxychains.nix b/nixos/modules/programs/proxychains.nix
index 7743f79c1c0..3f44e23a93e 100644
--- a/nixos/modules/programs/proxychains.nix
+++ b/nixos/modules/programs/proxychains.nix
@@ -120,7 +120,7 @@ in {
           Proxies to be used by proxychains.
         '';
 
-        example = literalExample ''
+        example = literalExpression ''
           { myproxy =
             { type = "socks4";
               host = "127.0.0.1";
diff --git a/nixos/modules/programs/shadow.nix b/nixos/modules/programs/shadow.nix
index e021f184179..963cd8853db 100644
--- a/nixos/modules/programs/shadow.nix
+++ b/nixos/modules/programs/shadow.nix
@@ -66,7 +66,7 @@ in
         This must not be a store path, since the path is
         used outside the store (in particular in /etc/passwd).
       '';
-      example = literalExample "pkgs.zsh";
+      example = literalExpression "pkgs.zsh";
       type = types.either types.path types.shellPackage;
     };
 
diff --git a/nixos/modules/programs/spacefm.nix b/nixos/modules/programs/spacefm.nix
index 6d03608402f..822fca3ecec 100644
--- a/nixos/modules/programs/spacefm.nix
+++ b/nixos/modules/programs/spacefm.nix
@@ -29,11 +29,13 @@ in
           terminal_su = "${pkgs.sudo}/bin/sudo";
           graphical_su = "${pkgs.gksu}/bin/gksu";
         };
-        example = literalExample ''{
-          tmp_dir = "/tmp";
-          terminal_su = "''${pkgs.sudo}/bin/sudo";
-          graphical_su = "''${pkgs.gksu}/bin/gksu";
-        }'';
+        defaultText = literalExpression ''
+          {
+            tmp_dir = "/tmp";
+            terminal_su = "''${pkgs.sudo}/bin/sudo";
+            graphical_su = "''${pkgs.gksu}/bin/gksu";
+          }
+        '';
         description = ''
           The system-wide spacefm configuration.
           Parameters to be written to <filename>/etc/spacefm/spacefm.conf</filename>.
diff --git a/nixos/modules/programs/ssh.nix b/nixos/modules/programs/ssh.nix
index 795f1a9f7b4..5da15b68cf7 100644
--- a/nixos/modules/programs/ssh.nix
+++ b/nixos/modules/programs/ssh.nix
@@ -36,6 +36,7 @@ in
       askPassword = mkOption {
         type = types.str;
         default = "${pkgs.x11_ssh_askpass}/libexec/x11-ssh-askpass";
+        defaultText = literalExpression ''"''${pkgs.x11_ssh_askpass}/libexec/x11-ssh-askpass"'';
         description = "Program used by SSH to ask for passwords.";
       };
 
@@ -113,7 +114,7 @@ in
       agentPKCS11Whitelist = mkOption {
         type = types.nullOr types.str;
         default = null;
-        example = "\${pkgs.opensc}/lib/opensc-pkcs11.so";
+        example = literalExpression ''"''${pkgs.opensc}/lib/opensc-pkcs11.so"'';
         description = ''
           A pattern-list of acceptable paths for PKCS#11 shared libraries
           that may be used with the -s option to ssh-add.
@@ -123,7 +124,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.openssh;
-        defaultText = "pkgs.openssh";
+        defaultText = literalExpression "pkgs.openssh";
         description = ''
           The package used for the openssh client and daemon.
         '';
@@ -180,7 +181,7 @@ in
         description = ''
           The set of system-wide known SSH hosts.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           {
             myhost = {
               hostNames = [ "myhost" "myhost.mydomain.com" "10.10.1.4" ];
diff --git a/nixos/modules/programs/ssmtp.nix b/nixos/modules/programs/ssmtp.nix
index e28a14538ec..b454bf35229 100644
--- a/nixos/modules/programs/ssmtp.nix
+++ b/nixos/modules/programs/ssmtp.nix
@@ -54,7 +54,7 @@ in
           <citerefentry><refentrytitle>ssmtp</refentrytitle><manvolnum>5</manvolnum></citerefentry> configuration. Refer
           to <link xlink:href="https://linux.die.net/man/5/ssmtp.conf"/> for details on supported values.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           {
             Debug = true;
             FromLineOverride = false;
diff --git a/nixos/modules/programs/sway.nix b/nixos/modules/programs/sway.nix
index d5819a08e8f..caf329c2536 100644
--- a/nixos/modules/programs/sway.nix
+++ b/nixos/modules/programs/sway.nix
@@ -92,10 +92,10 @@ in {
       default = with pkgs; [
         swaylock swayidle alacritty dmenu
       ];
-      defaultText = literalExample ''
+      defaultText = literalExpression ''
         with pkgs; [ swaylock swayidle alacritty dmenu ];
       '';
-      example = literalExample ''
+      example = literalExpression ''
         with pkgs; [
           i3status i3status-rust
           termite rofi light
diff --git a/nixos/modules/programs/tsm-client.nix b/nixos/modules/programs/tsm-client.nix
index 7ac4086d5f0..65d4db7834f 100644
--- a/nixos/modules/programs/tsm-client.nix
+++ b/nixos/modules/programs/tsm-client.nix
@@ -5,7 +5,7 @@ let
   inherit (builtins) length map;
   inherit (lib.attrsets) attrNames filterAttrs hasAttr mapAttrs mapAttrsToList optionalAttrs;
   inherit (lib.modules) mkDefault mkIf;
-  inherit (lib.options) literalExample mkEnableOption mkOption;
+  inherit (lib.options) literalExpression mkEnableOption mkOption;
   inherit (lib.strings) concatStringsSep optionalString toLower;
   inherit (lib.types) addCheck attrsOf lines nullOr package path port str strMatching submodule;
 
@@ -123,7 +123,7 @@ let
     };
     options.text = mkOption {
       type = lines;
-      example = literalExample
+      example = literalExpression
         ''lib.modules.mkAfter "compression no"'';
       description = ''
         Additional text lines for the server stanza.
@@ -218,8 +218,8 @@ let
     package = mkOption {
       type = package;
       default = pkgs.tsm-client;
-      defaultText = "pkgs.tsm-client";
-      example = literalExample "pkgs.tsm-client-withGui";
+      defaultText = literalExpression "pkgs.tsm-client";
+      example = literalExpression "pkgs.tsm-client-withGui";
       description = ''
         The TSM client derivation to be
         added to the system environment.
diff --git a/nixos/modules/programs/vim.nix b/nixos/modules/programs/vim.nix
index 9f46dff2a29..1695bc99473 100644
--- a/nixos/modules/programs/vim.nix
+++ b/nixos/modules/programs/vim.nix
@@ -18,8 +18,8 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.vim;
-      defaultText = "pkgs.vim";
-      example = "pkgs.vimHugeX";
+      defaultText = literalExpression "pkgs.vim";
+      example = literalExpression "pkgs.vimHugeX";
       description = ''
         vim package to use.
       '';
diff --git a/nixos/modules/programs/wireshark.nix b/nixos/modules/programs/wireshark.nix
index 819f15b98a0..f7b0727cb2b 100644
--- a/nixos/modules/programs/wireshark.nix
+++ b/nixos/modules/programs/wireshark.nix
@@ -19,7 +19,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.wireshark-cli;
-        defaultText = "pkgs.wireshark-cli";
+        defaultText = literalExpression "pkgs.wireshark-cli";
         description = ''
           Which Wireshark package to install in the global environment.
         '';
diff --git a/nixos/modules/programs/xonsh.nix b/nixos/modules/programs/xonsh.nix
index c06fd1655c2..6e40db51cdb 100644
--- a/nixos/modules/programs/xonsh.nix
+++ b/nixos/modules/programs/xonsh.nix
@@ -27,7 +27,8 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.xonsh;
-        example = literalExample "pkgs.xonsh.override { configFile = \"/path/to/xonshrc\"; }";
+        defaultText = literalExpression "pkgs.xonsh";
+        example = literalExpression "pkgs.xonsh.override { configFile = \"/path/to/xonshrc\"; }";
         description = ''
           xonsh package to use.
         '';
diff --git a/nixos/modules/programs/xss-lock.nix b/nixos/modules/programs/xss-lock.nix
index ceb7259b3d7..aba76133e5e 100644
--- a/nixos/modules/programs/xss-lock.nix
+++ b/nixos/modules/programs/xss-lock.nix
@@ -11,7 +11,8 @@ in
 
     lockerCommand = mkOption {
       default = "${pkgs.i3lock}/bin/i3lock";
-      example = literalExample "\${pkgs.i3lock-fancy}/bin/i3lock-fancy";
+      defaultText = literalExpression ''"''${pkgs.i3lock}/bin/i3lock"'';
+      example = literalExpression ''"''${pkgs.i3lock-fancy}/bin/i3lock-fancy"'';
       type = types.separatedString " ";
       description = "Locker to be used with xsslock";
     };
diff --git a/nixos/modules/programs/xwayland.nix b/nixos/modules/programs/xwayland.nix
index cb3c9c5b156..3a8080fa4c4 100644
--- a/nixos/modules/programs/xwayland.nix
+++ b/nixos/modules/programs/xwayland.nix
@@ -16,9 +16,8 @@ in
       type = types.str;
       default = optionalString config.fonts.fontDir.enable
         "/run/current-system/sw/share/X11/fonts";
-      defaultText = literalExample ''
-        optionalString config.fonts.fontDir.enable
-          "/run/current-system/sw/share/X11/fonts";
+      defaultText = literalExpression ''
+        optionalString config.fonts.fontDir.enable "/run/current-system/sw/share/X11/fonts"
       '';
       description = ''
         Default font path. Setting this option causes Xwayland to be rebuilt.
@@ -30,10 +29,10 @@ in
       default = pkgs.xwayland.override (oldArgs: {
         inherit (cfg) defaultFontPath;
       });
-      defaultText = literalExample ''
+      defaultText = literalExpression ''
         pkgs.xwayland.override (oldArgs: {
           inherit (config.programs.xwayland) defaultFontPath;
-        });
+        })
       '';
       description = "The Xwayland package to use.";
     };
diff --git a/nixos/modules/programs/yabar.nix b/nixos/modules/programs/yabar.nix
index 5de9331ac52..a8fac41e899 100644
--- a/nixos/modules/programs/yabar.nix
+++ b/nixos/modules/programs/yabar.nix
@@ -45,7 +45,8 @@ in
 
       package = mkOption {
         default = pkgs.yabar-unstable;
-        example = literalExample "pkgs.yabar";
+        defaultText = literalExpression "pkgs.yabar-unstable";
+        example = literalExpression "pkgs.yabar";
         type = types.package;
 
         # `yabar-stable` segfaults under certain conditions.
diff --git a/nixos/modules/programs/zsh/oh-my-zsh.nix b/nixos/modules/programs/zsh/oh-my-zsh.nix
index f24842a4791..9d7622bd328 100644
--- a/nixos/modules/programs/zsh/oh-my-zsh.nix
+++ b/nixos/modules/programs/zsh/oh-my-zsh.nix
@@ -48,7 +48,7 @@ in
 
         package = mkOption {
           default = pkgs.oh-my-zsh;
-          defaultText = "pkgs.oh-my-zsh";
+          defaultText = literalExpression "pkgs.oh-my-zsh";
           description = ''
             Package to install for `oh-my-zsh` usage.
           '';
diff --git a/nixos/modules/programs/zsh/zsh-autoenv.nix b/nixos/modules/programs/zsh/zsh-autoenv.nix
index 630114bcda9..62f497a45dd 100644
--- a/nixos/modules/programs/zsh/zsh-autoenv.nix
+++ b/nixos/modules/programs/zsh/zsh-autoenv.nix
@@ -10,7 +10,7 @@ in {
       enable = mkEnableOption "zsh-autoenv";
       package = mkOption {
         default = pkgs.zsh-autoenv;
-        defaultText = "pkgs.zsh-autoenv";
+        defaultText = literalExpression "pkgs.zsh-autoenv";
         description = ''
           Package to install for `zsh-autoenv` usage.
         '';
diff --git a/nixos/modules/programs/zsh/zsh-autosuggestions.nix b/nixos/modules/programs/zsh/zsh-autosuggestions.nix
index 037888fdc5a..a8fcfff95e5 100644
--- a/nixos/modules/programs/zsh/zsh-autosuggestions.nix
+++ b/nixos/modules/programs/zsh/zsh-autosuggestions.nix
@@ -40,7 +40,7 @@ in
       type = with types; attrsOf str;
       default = {};
       description = "Attribute set with additional configuration values";
-      example = literalExample ''
+      example = literalExpression ''
         {
           "ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" = "20";
         }
diff --git a/nixos/modules/programs/zsh/zsh-syntax-highlighting.nix b/nixos/modules/programs/zsh/zsh-syntax-highlighting.nix
index 927a904369d..1eb53ccae52 100644
--- a/nixos/modules/programs/zsh/zsh-syntax-highlighting.nix
+++ b/nixos/modules/programs/zsh/zsh-syntax-highlighting.nix
@@ -42,7 +42,7 @@ in
         default = {};
         type = types.attrsOf types.str;
 
-        example = literalExample ''
+        example = literalExpression ''
           {
             "rm -rf *" = "fg=white,bold,bg=red";
           }
@@ -59,7 +59,7 @@ in
         default = {};
         type = types.attrsOf types.str;
 
-        example = literalExample ''
+        example = literalExpression ''
           {
             "alias" = "fg=magenta,bold";
           }
diff --git a/nixos/modules/security/acme.nix b/nixos/modules/security/acme.nix
index bcbd17d8e10..f522b7c4128 100644
--- a/nixos/modules/security/acme.nix
+++ b/nixos/modules/security/acme.nix
@@ -486,7 +486,7 @@ let
       extraDomainNames = mkOption {
         type = types.listOf types.str;
         default = [];
-        example = literalExample ''
+        example = literalExpression ''
           [
             "example.org"
             "mydomain.org"
@@ -656,7 +656,7 @@ in {
           to those units if they rely on the certificates being present,
           or trigger restarts of the service if certificates get renewed.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           {
             "example.com" = {
               webroot = "/var/lib/acme/acme-challenge/";
diff --git a/nixos/modules/security/ca.nix b/nixos/modules/security/ca.nix
index 7df86e71423..83c15f90f92 100644
--- a/nixos/modules/security/ca.nix
+++ b/nixos/modules/security/ca.nix
@@ -24,7 +24,7 @@ in
     security.pki.certificateFiles = mkOption {
       type = types.listOf types.path;
       default = [];
-      example = literalExample "[ \"\${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt\" ]";
+      example = literalExpression ''[ "''${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" ]'';
       description = ''
         A list of files containing trusted root certificates in PEM
         format. These are concatenated to form
@@ -37,7 +37,7 @@ in
     security.pki.certificates = mkOption {
       type = types.listOf types.str;
       default = [];
-      example = literalExample ''
+      example = literalExpression ''
         [ '''
             NixOS.org
             =========
diff --git a/nixos/modules/security/dhparams.nix b/nixos/modules/security/dhparams.nix
index 62a499ea624..012be2887d8 100644
--- a/nixos/modules/security/dhparams.nix
+++ b/nixos/modules/security/dhparams.nix
@@ -53,7 +53,7 @@ in {
           coerce = bits: { inherit bits; };
         in attrsOf (coercedTo int coerce (submodule paramsSubmodule));
         default = {};
-        example = lib.literalExample "{ nginx.bits = 3072; }";
+        example = lib.literalExpression "{ nginx.bits = 3072; }";
         description = ''
           Diffie-Hellman parameters to generate.
 
diff --git a/nixos/modules/security/doas.nix b/nixos/modules/security/doas.nix
index 35f618b03e8..9a3daf4f504 100644
--- a/nixos/modules/security/doas.nix
+++ b/nixos/modules/security/doas.nix
@@ -77,7 +77,7 @@ in
         You can use <code>mkBefore</code> and/or <code>mkAfter</code> to ensure
         this is the case when configuration options are merged.
       '';
-      example = literalExample ''
+      example = literalExpression ''
         [
           # Allow execution of any command by any user in group doas, requiring
           # a password and keeping any previously-defined environment variables.
diff --git a/nixos/modules/security/pam.nix b/nixos/modules/security/pam.nix
index 8b1f653d4e2..4c18fa8cc67 100644
--- a/nixos/modules/security/pam.nix
+++ b/nixos/modules/security/pam.nix
@@ -586,7 +586,7 @@ in
     };
 
     security.pam.services = mkOption {
-      default = [];
+      default = {};
       type = with types; attrsOf (submodule pamOpts);
       description =
         ''
diff --git a/nixos/modules/security/pam_mount.nix b/nixos/modules/security/pam_mount.nix
index e25ace38f57..462b7f89e2f 100644
--- a/nixos/modules/security/pam_mount.nix
+++ b/nixos/modules/security/pam_mount.nix
@@ -33,7 +33,7 @@ in
       additionalSearchPaths = mkOption {
         type = types.listOf types.package;
         default = [];
-        example = literalExample "[ pkgs.bindfs ]";
+        example = literalExpression "[ pkgs.bindfs ]";
         description = ''
           Additional programs to include in the search path of pam_mount.
           Useful for example if you want to use some FUSE filesystems like bindfs.
@@ -43,7 +43,7 @@ in
       fuseMountOptions = mkOption {
         type = types.listOf types.str;
         default = [];
-        example = literalExample ''
+        example = literalExpression ''
           [ "nodev" "nosuid" "force-user=%(USER)" "gid=%(USERGID)" "perms=0700" "chmod-deny" "chown-deny" "chgrp-deny" ]
         '';
         description = ''
diff --git a/nixos/modules/security/sudo.nix b/nixos/modules/security/sudo.nix
index 2e73f8f4f31..99e578f8ada 100644
--- a/nixos/modules/security/sudo.nix
+++ b/nixos/modules/security/sudo.nix
@@ -45,7 +45,7 @@ in
     security.sudo.package = mkOption {
       type = types.package;
       default = pkgs.sudo;
-      defaultText = "pkgs.sudo";
+      defaultText = literalExpression "pkgs.sudo";
       description = ''
         Which package to use for `sudo`.
       '';
@@ -91,7 +91,7 @@ in
         this is the case when configuration options are merged.
       '';
       default = [];
-      example = literalExample ''
+      example = literalExpression ''
         [
           # Allow execution of any command by all users in group sudo,
           # requiring a password.
diff --git a/nixos/modules/security/systemd-confinement.nix b/nixos/modules/security/systemd-confinement.nix
index 0a09a755e93..d859c45c74f 100644
--- a/nixos/modules/security/systemd-confinement.nix
+++ b/nixos/modules/security/systemd-confinement.nix
@@ -62,8 +62,8 @@ in {
       options.confinement.binSh = lib.mkOption {
         type = types.nullOr types.path;
         default = toplevelConfig.environment.binsh;
-        defaultText = "config.environment.binsh";
-        example = lib.literalExample "\${pkgs.dash}/bin/dash";
+        defaultText = lib.literalExpression "config.environment.binsh";
+        example = lib.literalExpression ''"''${pkgs.dash}/bin/dash"'';
         description = ''
           The program to make available as <filename>/bin/sh</filename> inside
           the chroot. If this is set to <literal>null</literal>, no
diff --git a/nixos/modules/security/tpm2.nix b/nixos/modules/security/tpm2.nix
index d37425166f8..be85fd246e3 100644
--- a/nixos/modules/security/tpm2.nix
+++ b/nixos/modules/security/tpm2.nix
@@ -26,8 +26,7 @@ in {
       '';
       type = lib.types.nullOr lib.types.str;
       default = if cfg.abrmd.enable then "tss" else "root";
-      defaultText = ''"tss" when using the userspace resource manager,'' +
-                    ''"root" otherwise'';
+      defaultText = lib.literalExpression ''if config.security.tpm2.abrmd.enable then "tss" else "root"'';
     };
 
     tssGroup = lib.mkOption {
@@ -57,7 +56,7 @@ in {
         description = "tpm2-abrmd package to use";
         type = lib.types.package;
         default = pkgs.tpm2-abrmd;
-        defaultText = "pkgs.tpm2-abrmd";
+        defaultText = lib.literalExpression "pkgs.tpm2-abrmd";
       };
     };
 
@@ -71,7 +70,7 @@ in {
         description = "tpm2-pkcs11 package to use";
         type = lib.types.package;
         default = pkgs.tpm2-pkcs11;
-        defaultText = "pkgs.tpm2-pkcs11";
+        defaultText = lib.literalExpression "pkgs.tpm2-pkcs11";
       };
     };
 
diff --git a/nixos/modules/security/wrappers/default.nix b/nixos/modules/security/wrappers/default.nix
index 2697ab0bde8..a47de7e04f7 100644
--- a/nixos/modules/security/wrappers/default.nix
+++ b/nixos/modules/security/wrappers/default.nix
@@ -152,7 +152,7 @@ in
     security.wrappers = lib.mkOption {
       type = lib.types.attrsOf wrapperType;
       default = {};
-      example = lib.literalExample
+      example = lib.literalExpression
         ''
           {
             # a setuid root program
diff --git a/nixos/modules/services/admin/meshcentral.nix b/nixos/modules/services/admin/meshcentral.nix
index ae7b6edda7d..92762d2037c 100644
--- a/nixos/modules/services/admin/meshcentral.nix
+++ b/nixos/modules/services/admin/meshcentral.nix
@@ -10,7 +10,7 @@ in with lib; {
       description = "MeshCentral package to use. Replacing this may be necessary to add dependencies for extra functionality.";
       type = types.package;
       default = pkgs.meshcentral;
-      defaultText = "pkgs.meshcentral";
+      defaultText = literalExpression "pkgs.meshcentral";
     };
     settings = mkOption {
       description = ''
diff --git a/nixos/modules/services/admin/oxidized.nix b/nixos/modules/services/admin/oxidized.nix
index 94b44630ba6..49ea3ced76a 100644
--- a/nixos/modules/services/admin/oxidized.nix
+++ b/nixos/modules/services/admin/oxidized.nix
@@ -33,7 +33,7 @@ in
 
     configFile = mkOption {
       type = types.path;
-      example = literalExample ''
+      example = literalExpression ''
         pkgs.writeText "oxidized-config.yml" '''
           ---
           debug: true
@@ -69,7 +69,7 @@ in
 
     routerDB = mkOption {
       type = types.path;
-      example = literalExample ''
+      example = literalExpression ''
         pkgs.writeText "oxidized-router.db" '''
           hostname-sw1:powerconnect:username1:password2
           hostname-sw2:procurve:username2:password2
diff --git a/nixos/modules/services/amqp/activemq/default.nix b/nixos/modules/services/amqp/activemq/default.nix
index 178b2f6e144..47669b05aa9 100644
--- a/nixos/modules/services/amqp/activemq/default.nix
+++ b/nixos/modules/services/amqp/activemq/default.nix
@@ -33,6 +33,7 @@ in {
       };
       configurationDir = mkOption {
         default = "${activemq}/conf";
+        defaultText = literalExpression ''"''${pkgs.activemq}/conf"'';
         type = types.str;
         description = ''
           The base directory for ActiveMQ's configuration.
@@ -64,7 +65,7 @@ in {
       javaProperties = mkOption {
         type = types.attrs;
         default = { };
-        example = literalExample ''
+        example = literalExpression ''
           {
             "java.net.preferIPv4Stack" = "true";
           }
diff --git a/nixos/modules/services/amqp/rabbitmq.nix b/nixos/modules/services/amqp/rabbitmq.nix
index dabd80312d9..3255942fe43 100644
--- a/nixos/modules/services/amqp/rabbitmq.nix
+++ b/nixos/modules/services/amqp/rabbitmq.nix
@@ -29,7 +29,7 @@ in
       package = mkOption {
         default = pkgs.rabbitmq-server;
         type = types.package;
-        defaultText = "pkgs.rabbitmq-server";
+        defaultText = literalExpression "pkgs.rabbitmq-server";
         description = ''
           Which rabbitmq package to use.
         '';
@@ -82,7 +82,7 @@ in
       configItems = mkOption {
         default = { };
         type = types.attrsOf types.str;
-        example = literalExample ''
+        example = literalExpression ''
           {
             "auth_backends.1.authn" = "rabbit_auth_backend_ldap";
             "auth_backends.1.authz" = "rabbit_auth_backend_internal";
diff --git a/nixos/modules/services/audio/botamusique.nix b/nixos/modules/services/audio/botamusique.nix
index 14614d2dd16..f4fa0ead4f0 100644
--- a/nixos/modules/services/audio/botamusique.nix
+++ b/nixos/modules/services/audio/botamusique.nix
@@ -17,6 +17,7 @@ in
     package = mkOption {
       type = types.package;
       default = pkgs.botamusique;
+      defaultText = literalExpression "pkgs.botamusique";
       description = "The botamusique package to use.";
     };
 
diff --git a/nixos/modules/services/audio/jack.nix b/nixos/modules/services/audio/jack.nix
index d0a95b87ee1..84fc9957b87 100644
--- a/nixos/modules/services/audio/jack.nix
+++ b/nixos/modules/services/audio/jack.nix
@@ -25,8 +25,8 @@ in {
           internal = true;
           type = types.package;
           default = pkgs.jack2;
-          defaultText = "pkgs.jack2";
-          example = literalExample "pkgs.jack1";
+          defaultText = literalExpression "pkgs.jack2";
+          example = literalExpression "pkgs.jack1";
           description = ''
             The JACK package to use.
           '';
@@ -37,7 +37,7 @@ in {
           default = [
             "-dalsa"
           ];
-          example = literalExample ''
+          example = literalExpression ''
             [ "-dalsa" "--device" "hw:1" ];
           '';
           description = ''
diff --git a/nixos/modules/services/audio/liquidsoap.nix b/nixos/modules/services/audio/liquidsoap.nix
index 3a047d10a63..ffeefc0f988 100644
--- a/nixos/modules/services/audio/liquidsoap.nix
+++ b/nixos/modules/services/audio/liquidsoap.nix
@@ -39,9 +39,9 @@ in
       default = {};
 
       example = {
-        myStream1 = literalExample "\"/etc/liquidsoap/myStream1.liq\"";
-        myStream2 = literalExample "./myStream2.liq";
-        myStream3 = literalExample "\"out(playlist(\\\"/srv/music/\\\"))\"";
+        myStream1 = "/etc/liquidsoap/myStream1.liq";
+        myStream2 = literalExpression "./myStream2.liq";
+        myStream3 = "out(playlist(\"/srv/music/\"))";
       };
 
       type = types.attrsOf (types.either types.path types.str);
diff --git a/nixos/modules/services/audio/mopidy.nix b/nixos/modules/services/audio/mopidy.nix
index 6fd7eae5b89..9937feadaeb 100644
--- a/nixos/modules/services/audio/mopidy.nix
+++ b/nixos/modules/services/audio/mopidy.nix
@@ -39,7 +39,7 @@ in {
       extensionPackages = mkOption {
         default = [];
         type = types.listOf types.package;
-        example = literalExample "[ pkgs.mopidy-spotify ]";
+        example = literalExpression "[ pkgs.mopidy-spotify ]";
         description = ''
           Mopidy extensions that should be loaded by the service.
         '';
diff --git a/nixos/modules/services/audio/mpd.nix b/nixos/modules/services/audio/mpd.nix
index e33e860d883..560264e249d 100644
--- a/nixos/modules/services/audio/mpd.nix
+++ b/nixos/modules/services/audio/mpd.nix
@@ -74,7 +74,7 @@ in {
       musicDirectory = mkOption {
         type = with types; either path (strMatching "(http|https|nfs|smb)://.+");
         default = "${cfg.dataDir}/music";
-        defaultText = "\${dataDir}/music";
+        defaultText = literalExpression ''"''${dataDir}/music"'';
         description = ''
           The directory or NFS/SMB network share where MPD reads music from. If left
           as the default value this directory will automatically be created before
@@ -86,7 +86,7 @@ in {
       playlistDirectory = mkOption {
         type = types.path;
         default = "${cfg.dataDir}/playlists";
-        defaultText = "\${dataDir}/playlists";
+        defaultText = literalExpression ''"''${dataDir}/playlists"'';
         description = ''
           The directory where MPD stores playlists. If left as the default value
           this directory will automatically be created before the MPD server starts,
@@ -155,7 +155,7 @@ in {
       dbFile = mkOption {
         type = types.nullOr types.str;
         default = "${cfg.dataDir}/tag_cache";
-        defaultText = "\${dataDir}/tag_cache";
+        defaultText = literalExpression ''"''${dataDir}/tag_cache"'';
         description = ''
           The path to MPD's database. If set to <literal>null</literal> the
           parameter is omitted from the configuration.
diff --git a/nixos/modules/services/audio/slimserver.nix b/nixos/modules/services/audio/slimserver.nix
index 21632919699..ecd26528499 100644
--- a/nixos/modules/services/audio/slimserver.nix
+++ b/nixos/modules/services/audio/slimserver.nix
@@ -22,7 +22,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.slimserver;
-        defaultText = "pkgs.slimserver";
+        defaultText = literalExpression "pkgs.slimserver";
         description = "Slimserver package to use.";
       };
 
diff --git a/nixos/modules/services/audio/snapserver.nix b/nixos/modules/services/audio/snapserver.nix
index f96b5f3e194..d3e97719f35 100644
--- a/nixos/modules/services/audio/snapserver.nix
+++ b/nixos/modules/services/audio/snapserver.nix
@@ -206,7 +206,7 @@ in {
                 For type <literal>meta</literal>, a list of stream names in the form <literal>/one/two/...</literal>. Don't forget the leading slash.
                 For type <literal>alsa</literal>, use an empty string.
               '';
-              example = literalExample ''
+              example = literalExpression ''
                 "/path/to/pipe"
                 "/path/to/librespot"
                 "192.168.1.2:4444"
@@ -226,7 +226,7 @@ in {
               description = ''
                 Key-value pairs that convey additional parameters about a stream.
               '';
-              example = literalExample ''
+              example = literalExpression ''
                 # for type == "pipe":
                 {
                   mode = "create";
@@ -254,7 +254,7 @@ in {
         description = ''
           The definition for an input source.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           {
             mpd = {
               type = "pipe";
diff --git a/nixos/modules/services/audio/ympd.nix b/nixos/modules/services/audio/ympd.nix
index 551bd941fe6..36c5527027f 100644
--- a/nixos/modules/services/audio/ympd.nix
+++ b/nixos/modules/services/audio/ympd.nix
@@ -26,7 +26,6 @@ in {
           type = types.str;
           default = "localhost";
           description = "The host where MPD is listening.";
-          example = "localhost";
         };
 
         port = mkOption {
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,
diff --git a/nixos/modules/services/blockchain/ethereum/geth.nix b/nixos/modules/services/blockchain/ethereum/geth.nix
index 6c2df95886e..bf2cf1edd4d 100644
--- a/nixos/modules/services/blockchain/ethereum/geth.nix
+++ b/nixos/modules/services/blockchain/ethereum/geth.nix
@@ -108,6 +108,7 @@ let
 
       package = mkOption {
         default = pkgs.go-ethereum.geth;
+        defaultText = literalExpression "pkgs.go-ethereum.geth";
         type = types.package;
         description = "Package to use as Go Ethereum node.";
       };
diff --git a/nixos/modules/services/cluster/hadoop/default.nix b/nixos/modules/services/cluster/hadoop/default.nix
index 41ac46e538e..a165f619dc0 100644
--- a/nixos/modules/services/cluster/hadoop/default.nix
+++ b/nixos/modules/services/cluster/hadoop/default.nix
@@ -8,7 +8,7 @@ with lib;
     coreSite = mkOption {
       default = {};
       type = types.attrsOf types.anything;
-      example = literalExample ''
+      example = literalExpression ''
         {
           "fs.defaultFS" = "hdfs://localhost";
         }
@@ -19,7 +19,7 @@ with lib;
     hdfsSite = mkOption {
       default = {};
       type = types.attrsOf types.anything;
-      example = literalExample ''
+      example = literalExpression ''
         {
           "dfs.nameservices" = "namenode1";
         }
@@ -30,7 +30,7 @@ with lib;
     mapredSite = mkOption {
       default = {};
       type = types.attrsOf types.anything;
-      example = literalExample ''
+      example = literalExpression ''
         {
           "mapreduce.map.cpu.vcores" = "1";
         }
@@ -41,7 +41,7 @@ with lib;
     yarnSite = mkOption {
       default = {};
       type = types.attrsOf types.anything;
-      example = literalExample ''
+      example = literalExpression ''
         {
           "yarn.resourcemanager.ha.id" = "resourcemanager1";
         }
@@ -52,8 +52,7 @@ with lib;
     package = mkOption {
       type = types.package;
       default = pkgs.hadoop;
-      defaultText = "pkgs.hadoop";
-      example = literalExample "pkgs.hadoop";
+      defaultText = literalExpression "pkgs.hadoop";
       description = "";
     };
   };
diff --git a/nixos/modules/services/cluster/k3s/default.nix b/nixos/modules/services/cluster/k3s/default.nix
index e5c51441690..50b6780bbe6 100644
--- a/nixos/modules/services/cluster/k3s/default.nix
+++ b/nixos/modules/services/cluster/k3s/default.nix
@@ -12,8 +12,7 @@ in
     package = mkOption {
       type = types.package;
       default = pkgs.k3s;
-      defaultText = "pkgs.k3s";
-      example = literalExample "pkgs.k3s";
+      defaultText = literalExpression "pkgs.k3s";
       description = "Package that should be used for k3s";
     };
 
diff --git a/nixos/modules/services/cluster/kubernetes/addon-manager.nix b/nixos/modules/services/cluster/kubernetes/addon-manager.nix
index 821f1aa5460..3d988dc2479 100644
--- a/nixos/modules/services/cluster/kubernetes/addon-manager.nix
+++ b/nixos/modules/services/cluster/kubernetes/addon-manager.nix
@@ -27,7 +27,7 @@ in
       '';
       default = { };
       type = attrsOf attrs;
-      example = literalExample ''
+      example = literalExpression ''
         {
           "my-service" = {
             "apiVersion" = "v1";
@@ -46,7 +46,7 @@ in
       description = "Kubernetes addons (any kind of Kubernetes resource can be an addon).";
       default = { };
       type = attrsOf (either attrs (listOf attrs));
-      example = literalExample ''
+      example = literalExpression ''
         {
           "my-service" = {
             "apiVersion" = "v1";
diff --git a/nixos/modules/services/cluster/kubernetes/addons/dns.nix b/nixos/modules/services/cluster/kubernetes/addons/dns.nix
index 8f937a13231..34943fddd3d 100644
--- a/nixos/modules/services/cluster/kubernetes/addons/dns.nix
+++ b/nixos/modules/services/cluster/kubernetes/addons/dns.nix
@@ -83,21 +83,24 @@ in {
           reload
           loadbalance
         }'';
-      defaultText = ''
-        .:${toString ports.dns} {
-          errors
-          health :${toString ports.health}
-          kubernetes ''${config.services.kubernetes.addons.dns.clusterDomain} in-addr.arpa ip6.arpa {
-            pods insecure
-            fallthrough in-addr.arpa ip6.arpa
+      defaultText = literalExpression ''
+        '''
+          .:${toString ports.dns} {
+            errors
+            health :${toString ports.health}
+            kubernetes ''${config.services.kubernetes.addons.dns.clusterDomain} in-addr.arpa ip6.arpa {
+              pods insecure
+              fallthrough in-addr.arpa ip6.arpa
+            }
+            prometheus :${toString ports.metrics}
+            forward . /etc/resolv.conf
+            cache 30
+            loop
+            reload
+            loadbalance
           }
-          prometheus :${toString ports.metrics}
-          forward . /etc/resolv.conf
-          cache 30
-          loop
-          reload
-          loadbalance
-        }'';
+        '''
+      '';
     };
   };
 
diff --git a/nixos/modules/services/cluster/kubernetes/default.nix b/nixos/modules/services/cluster/kubernetes/default.nix
index 08b21418180..433adf4d488 100644
--- a/nixos/modules/services/cluster/kubernetes/default.nix
+++ b/nixos/modules/services/cluster/kubernetes/default.nix
@@ -126,7 +126,7 @@ in {
       description = "Kubernetes package to use.";
       type = types.package;
       default = pkgs.kubernetes;
-      defaultText = "pkgs.kubernetes";
+      defaultText = literalExpression "pkgs.kubernetes";
     };
 
     kubeconfig = mkKubeConfigOptions "Default kubeconfig";
diff --git a/nixos/modules/services/cluster/kubernetes/kubelet.nix b/nixos/modules/services/cluster/kubernetes/kubelet.nix
index 51b2b5f6eb0..3a2a0ed363d 100644
--- a/nixos/modules/services/cluster/kubernetes/kubelet.nix
+++ b/nixos/modules/services/cluster/kubernetes/kubelet.nix
@@ -96,7 +96,7 @@ in
         description = "Kubernetes CNI configuration.";
         type = listOf attrs;
         default = [];
-        example = literalExample ''
+        example = literalExpression ''
           [{
             "cniVersion": "0.3.1",
             "name": "mynet",
diff --git a/nixos/modules/services/cluster/spark/default.nix b/nixos/modules/services/cluster/spark/default.nix
index bbfe0489f11..e6b44e130a3 100644
--- a/nixos/modules/services/cluster/spark/default.nix
+++ b/nixos/modules/services/cluster/spark/default.nix
@@ -70,7 +70,7 @@ with lib;
         type = types.path;
         description = "Spark configuration directory. Spark will use the configuration files (spark-defaults.conf, spark-env.sh, log4j.properties, etc) from this directory.";
         default = "${cfg.package}/lib/${cfg.package.untarDir}/conf";
-        defaultText = literalExample "\${cfg.package}/lib/\${cfg.package.untarDir}/conf";
+        defaultText = literalExpression ''"''${package}/lib/''${package.untarDir}/conf"'';
       };
       logDir = mkOption {
         type = types.path;
@@ -81,8 +81,8 @@ with lib;
         type = types.package;
         description = "Spark package.";
         default = pkgs.spark;
-        defaultText = "pkgs.spark";
-        example = literalExample ''pkgs.spark.overrideAttrs (super: rec {
+        defaultText = literalExpression "pkgs.spark";
+        example = literalExpression ''pkgs.spark.overrideAttrs (super: rec {
           pname = "spark";
           version = "2.4.4";
 
diff --git a/nixos/modules/services/computing/boinc/client.nix b/nixos/modules/services/computing/boinc/client.nix
index 7becf624071..52249455fd4 100644
--- a/nixos/modules/services/computing/boinc/client.nix
+++ b/nixos/modules/services/computing/boinc/client.nix
@@ -30,7 +30,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.boinc;
-        defaultText = "pkgs.boinc";
+        defaultText = literalExpression "pkgs.boinc";
         description = ''
           Which BOINC package to use.
         '';
@@ -60,7 +60,7 @@ in
       extraEnvPackages = mkOption {
         type = types.listOf types.package;
         default = [];
-        example = "[ pkgs.virtualbox ]";
+        example = literalExpression "[ pkgs.virtualbox ]";
         description = ''
           Additional packages to make available in the environment in which
           BOINC will run. Common choices are:
diff --git a/nixos/modules/services/computing/foldingathome/client.nix b/nixos/modules/services/computing/foldingathome/client.nix
index fbef6a04b16..aa9d0a5218f 100644
--- a/nixos/modules/services/computing/foldingathome/client.nix
+++ b/nixos/modules/services/computing/foldingathome/client.nix
@@ -23,7 +23,7 @@ in
     package = mkOption {
       type = types.package;
       default = pkgs.fahclient;
-      defaultText = "pkgs.fahclient";
+      defaultText = literalExpression "pkgs.fahclient";
       description = ''
         Which Folding@home client to use.
       '';
diff --git a/nixos/modules/services/computing/slurm/slurm.nix b/nixos/modules/services/computing/slurm/slurm.nix
index a3dee94e2dc..0c96f323132 100644
--- a/nixos/modules/services/computing/slurm/slurm.nix
+++ b/nixos/modules/services/computing/slurm/slurm.nix
@@ -132,8 +132,8 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.slurm.override { enableX11 = ! cfg.enableSrunX11; };
-        defaultText = "pkgs.slurm";
-        example = literalExample "pkgs.slurm-full";
+        defaultText = literalExpression "pkgs.slurm";
+        example = literalExpression "pkgs.slurm-full";
         description = ''
           The package to use for slurm binaries.
         '';
@@ -172,7 +172,7 @@ in
       nodeName = mkOption {
         type = types.listOf types.str;
         default = [];
-        example = literalExample ''[ "linux[1-32] CPUs=1 State=UNKNOWN" ];'';
+        example = literalExpression ''[ "linux[1-32] CPUs=1 State=UNKNOWN" ];'';
         description = ''
           Name that SLURM uses to refer to a node (or base partition for BlueGene
           systems). Typically this would be the string that "/bin/hostname -s"
@@ -183,7 +183,7 @@ in
       partitionName = mkOption {
         type = types.listOf types.str;
         default = [];
-        example = literalExample ''[ "debug Nodes=linux[1-32] Default=YES MaxTime=INFINITE State=UP" ];'';
+        example = literalExpression ''[ "debug Nodes=linux[1-32] Default=YES MaxTime=INFINITE State=UP" ];'';
         description = ''
           Name by which the partition may be referenced. Note that now you have
           to write the partition's parameters after the name.
diff --git a/nixos/modules/services/continuous-integration/buildbot/master.nix b/nixos/modules/services/continuous-integration/buildbot/master.nix
index f668e69e5df..2dc61c21ac7 100644
--- a/nixos/modules/services/continuous-integration/buildbot/master.nix
+++ b/nixos/modules/services/continuous-integration/buildbot/master.nix
@@ -93,6 +93,7 @@ in {
         type = types.path;
         description = "Optionally pass master.cfg path. Other options in this configuration will be ignored.";
         default = defaultMasterCfg;
+        defaultText = literalDocBook ''generated configuration file'';
         example = "/etc/nixos/buildbot/master.cfg";
       };
 
@@ -210,14 +211,14 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.python3Packages.buildbot-full;
-        defaultText = "pkgs.python3Packages.buildbot-full";
+        defaultText = literalExpression "pkgs.python3Packages.buildbot-full";
         description = "Package to use for buildbot.";
-        example = literalExample "pkgs.python3Packages.buildbot";
+        example = literalExpression "pkgs.python3Packages.buildbot";
       };
 
       packages = mkOption {
         default = [ pkgs.git ];
-        example = literalExample "[ pkgs.git ]";
+        defaultText = literalExpression "[ pkgs.git ]";
         type = types.listOf types.package;
         description = "Packages to add to PATH for the buildbot process.";
       };
@@ -225,9 +226,9 @@ in {
       pythonPackages = mkOption {
         type = types.functionTo (types.listOf types.package);
         default = pythonPackages: with pythonPackages; [ ];
-        defaultText = "pythonPackages: with pythonPackages; [ ]";
+        defaultText = literalExpression "pythonPackages: with pythonPackages; [ ]";
         description = "Packages to add the to the PYTHONPATH of the buildbot process.";
-        example = literalExample "pythonPackages: with pythonPackages; [ requests ]";
+        example = literalExpression "pythonPackages: with pythonPackages; [ requests ]";
       };
     };
   };
diff --git a/nixos/modules/services/continuous-integration/buildbot/worker.nix b/nixos/modules/services/continuous-integration/buildbot/worker.nix
index 708b3e1cc18..dd4f4a4a74a 100644
--- a/nixos/modules/services/continuous-integration/buildbot/worker.nix
+++ b/nixos/modules/services/continuous-integration/buildbot/worker.nix
@@ -128,14 +128,14 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.python3Packages.buildbot-worker;
-        defaultText = "pkgs.python3Packages.buildbot-worker";
+        defaultText = literalExpression "pkgs.python3Packages.buildbot-worker";
         description = "Package to use for buildbot worker.";
-        example = literalExample "pkgs.python2Packages.buildbot-worker";
+        example = literalExpression "pkgs.python2Packages.buildbot-worker";
       };
 
       packages = mkOption {
         default = with pkgs; [ git ];
-        example = literalExample "[ pkgs.git ]";
+        defaultText = literalExpression "[ pkgs.git ]";
         type = types.listOf types.package;
         description = "Packages to add to PATH for the buildbot process.";
       };
diff --git a/nixos/modules/services/continuous-integration/buildkite-agents.nix b/nixos/modules/services/continuous-integration/buildkite-agents.nix
index b8982d757db..1872567c9f1 100644
--- a/nixos/modules/services/continuous-integration/buildkite-agents.nix
+++ b/nixos/modules/services/continuous-integration/buildkite-agents.nix
@@ -39,7 +39,7 @@ let
 
       package = mkOption {
         default = pkgs.buildkite-agent;
-        defaultText = "pkgs.buildkite-agent";
+        defaultText = literalExpression "pkgs.buildkite-agent";
         description = "Which buildkite-agent derivation to use";
         type = types.package;
       };
@@ -52,7 +52,7 @@ let
 
       runtimePackages = mkOption {
         default = [ pkgs.bash pkgs.gnutar pkgs.gzip pkgs.git pkgs.nix ];
-        defaultText = "[ pkgs.bash pkgs.gnutar pkgs.gzip pkgs.git pkgs.nix ]";
+        defaultText = literalExpression "[ pkgs.bash pkgs.gnutar pkgs.gzip pkgs.git pkgs.nix ]";
         description = "Add programs to the buildkite-agent environment";
         type = types.listOf types.package;
       };
@@ -168,7 +168,7 @@ let
       hooksPath = mkOption {
         type = types.path;
         default = hooksDir config;
-        defaultText = "generated from services.buildkite-agents.<name>.hooks";
+        defaultText = literalDocBook "generated from <option>services.buildkite-agents.&lt;name&gt;.hooks</option>";
         description = ''
           Path to the directory storing the hooks.
           Consider using <option>services.buildkite-agents.&lt;name&gt;.hooks.&lt;name&gt;</option>
@@ -179,6 +179,7 @@ let
       shell = mkOption {
         type = types.str;
         default = "${pkgs.bash}/bin/bash -e -c";
+        defaultText = literalExpression ''"''${pkgs.bash}/bin/bash -e -c"'';
         description = ''
           Command that buildkite-agent 3 will execute when it spawns a shell.
         '';
diff --git a/nixos/modules/services/continuous-integration/github-runner.nix b/nixos/modules/services/continuous-integration/github-runner.nix
index f951c155323..943c1e4598d 100644
--- a/nixos/modules/services/continuous-integration/github-runner.nix
+++ b/nixos/modules/services/continuous-integration/github-runner.nix
@@ -77,7 +77,7 @@ in
 
         Changing this option triggers a new runner registration.
       '';
-      example = literalExample ''[ "nixos" ]'';
+      example = literalExpression ''[ "nixos" ]'';
       default = [ ];
     };
 
@@ -105,6 +105,7 @@ in
         Which github-runner derivation to use.
       '';
       default = pkgs.github-runner;
+      defaultText = literalExpression "pkgs.github-runner";
     };
   };
 
diff --git a/nixos/modules/services/continuous-integration/gitlab-runner.nix b/nixos/modules/services/continuous-integration/gitlab-runner.nix
index 15c37c2bc76..d4b8541c6a1 100644
--- a/nixos/modules/services/continuous-integration/gitlab-runner.nix
+++ b/nixos/modules/services/continuous-integration/gitlab-runner.nix
@@ -136,7 +136,7 @@ in
     checkInterval = mkOption {
       type = types.int;
       default = 0;
-      example = literalExample "with lib; (length (attrNames config.services.gitlab-runner.services)) * 3";
+      example = literalExpression "with lib; (length (attrNames config.services.gitlab-runner.services)) * 3";
       description = ''
         Defines the interval length, in seconds, between new jobs check.
         The default value is 3;
@@ -147,7 +147,7 @@ in
     concurrent = mkOption {
       type = types.int;
       default = 1;
-      example = literalExample "config.nix.maxJobs";
+      example = literalExpression "config.nix.maxJobs";
       description = ''
         Limits how many jobs globally can be run concurrently.
         The most upper limit of jobs using all defined runners.
@@ -203,7 +203,7 @@ in
         };
       };
       default = { };
-      example = literalExample ''
+      example = literalExpression ''
         {
           listenAddress = "0.0.0.0:8093";
         }
@@ -234,8 +234,8 @@ in
     package = mkOption {
       type = types.package;
       default = pkgs.gitlab-runner;
-      defaultText = "pkgs.gitlab-runner";
-      example = literalExample "pkgs.gitlab-runner_1_11";
+      defaultText = literalExpression "pkgs.gitlab-runner";
+      example = literalExpression "pkgs.gitlab-runner_1_11";
       description = "Gitlab Runner package to use.";
     };
     extraPackages = mkOption {
@@ -248,7 +248,7 @@ in
     services = mkOption {
       description = "GitLab Runner services.";
       default = { };
-      example = literalExample ''
+      example = literalExpression ''
         {
           # runner for building in docker via host's nix-daemon
           # nix store will be readable in runner, might be insecure
diff --git a/nixos/modules/services/continuous-integration/gocd-agent/default.nix b/nixos/modules/services/continuous-integration/gocd-agent/default.nix
index 8cae08bf1fa..acc3fb12484 100644
--- a/nixos/modules/services/continuous-integration/gocd-agent/default.nix
+++ b/nixos/modules/services/continuous-integration/gocd-agent/default.nix
@@ -37,7 +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 ]";
+        defaultText = literalExpression "[ 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 4c829664a0a..646bf13ac67 100644
--- a/nixos/modules/services/continuous-integration/gocd-server/default.nix
+++ b/nixos/modules/services/continuous-integration/gocd-server/default.nix
@@ -69,7 +69,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 ]";
+        defaultText = literalExpression "[ 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/continuous-integration/hail.nix b/nixos/modules/services/continuous-integration/hail.nix
index 5d0c3f7b4ab..4070a3425c4 100644
--- a/nixos/modules/services/continuous-integration/hail.nix
+++ b/nixos/modules/services/continuous-integration/hail.nix
@@ -35,7 +35,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.haskellPackages.hail;
-      defaultText = "pkgs.haskellPackages.hail";
+      defaultText = literalExpression "pkgs.haskellPackages.hail";
       description = "Hail package to use.";
     };
   };
diff --git a/nixos/modules/services/continuous-integration/hercules-ci-agent/common.nix b/nixos/modules/services/continuous-integration/hercules-ci-agent/common.nix
index 70d85a97f3b..d53d68bdcf9 100644
--- a/nixos/modules/services/continuous-integration/hercules-ci-agent/common.nix
+++ b/nixos/modules/services/continuous-integration/hercules-ci-agent/common.nix
@@ -10,7 +10,8 @@ Platform-specific code is in the respective default.nix files.
 let
   inherit (lib)
     filterAttrs
-    literalExample
+    literalDocBook
+    literalExpression
     mkIf
     mkOption
     mkRemovedOptionModule
@@ -60,7 +61,7 @@ let
         '';
         type = types.path;
         default = config.baseDirectory + "/work";
-        defaultText = literalExample ''baseDirectory + "/work"'';
+        defaultText = literalExpression ''baseDirectory + "/work"'';
       };
       staticSecretsDirectory = mkOption {
         description = ''
@@ -68,7 +69,7 @@ let
         '';
         type = types.path;
         default = config.baseDirectory + "/secrets";
-        defaultText = literalExample ''baseDirectory + "/secrets"'';
+        defaultText = literalExpression ''baseDirectory + "/secrets"'';
       };
       clusterJoinTokenPath = mkOption {
         description = ''
@@ -76,7 +77,7 @@ let
         '';
         type = types.path;
         default = config.staticSecretsDirectory + "/cluster-join-token.key";
-        defaultText = literalExample ''staticSecretsDirectory + "/cluster-join-token.key"'';
+        defaultText = literalExpression ''staticSecretsDirectory + "/cluster-join-token.key"'';
         # internal: It's a bit too detailed to show by default in the docs,
         # but useful to define explicitly to allow reuse by other modules.
         internal = true;
@@ -87,7 +88,7 @@ let
         '';
         type = types.path;
         default = config.staticSecretsDirectory + "/binary-caches.json";
-        defaultText = literalExample ''staticSecretsDirectory + "/binary-caches.json"'';
+        defaultText = literalExpression ''staticSecretsDirectory + "/binary-caches.json"'';
         # internal: It's a bit too detailed to show by default in the docs,
         # but useful to define explicitly to allow reuse by other modules.
         internal = true;
@@ -158,7 +159,7 @@ in
       '';
       type = types.package;
       default = pkgs.hercules-ci-agent;
-      defaultText = literalExample "pkgs.hercules-ci-agent";
+      defaultText = literalExpression "pkgs.hercules-ci-agent";
     };
     settings = mkOption {
       description = ''
@@ -180,7 +181,7 @@ in
     tomlFile = mkOption {
       type = types.path;
       internal = true;
-      defaultText = "generated hercules-ci-agent.toml";
+      defaultText = literalDocBook "generated <literal>hercules-ci-agent.toml</literal>";
       description = ''
         The fully assembled config file.
       '';
diff --git a/nixos/modules/services/continuous-integration/hydra/default.nix b/nixos/modules/services/continuous-integration/hydra/default.nix
index 0103cd723d2..d6cde77c0a3 100644
--- a/nixos/modules/services/continuous-integration/hydra/default.nix
+++ b/nixos/modules/services/continuous-integration/hydra/default.nix
@@ -100,7 +100,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.hydra-unstable;
-        defaultText = "pkgs.hydra-unstable";
+        defaultText = literalExpression "pkgs.hydra-unstable";
         description = "The Hydra package.";
       };
 
@@ -155,7 +155,7 @@ in
       smtpHost = mkOption {
         type = types.nullOr types.str;
         default = null;
-        example = ["localhost"];
+        example = "localhost";
         description = ''
           Hostname of the SMTP server to use to send email.
         '';
diff --git a/nixos/modules/services/continuous-integration/jenkins/default.nix b/nixos/modules/services/continuous-integration/jenkins/default.nix
index 98ef1e2c691..d37dcb5519d 100644
--- a/nixos/modules/services/continuous-integration/jenkins/default.nix
+++ b/nixos/modules/services/continuous-integration/jenkins/default.nix
@@ -81,14 +81,14 @@ in {
 
       package = mkOption {
         default = pkgs.jenkins;
-        defaultText = "pkgs.jenkins";
+        defaultText = literalExpression "pkgs.jenkins";
         type = types.package;
         description = "Jenkins package to use.";
       };
 
       packages = mkOption {
         default = [ pkgs.stdenv pkgs.git pkgs.jdk11 config.programs.ssh.package pkgs.nix ];
-        defaultText = "[ pkgs.stdenv pkgs.git pkgs.jdk11 config.programs.ssh.package pkgs.nix ]";
+        defaultText = literalExpression "[ pkgs.stdenv pkgs.git pkgs.jdk11 config.programs.ssh.package pkgs.nix ]";
         type = types.listOf types.package;
         description = ''
           Packages to add to PATH for the jenkins process.
@@ -120,7 +120,7 @@ in {
           <literal>null</literal>. You can generate this set with a
           tool such as <literal>jenkinsPlugins2nix</literal>.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           import path/to/jenkinsPlugins2nix-generated-plugins.nix { inherit (pkgs) fetchurl stdenv; }
         '';
       };
diff --git a/nixos/modules/services/continuous-integration/jenkins/job-builder.nix b/nixos/modules/services/continuous-integration/jenkins/job-builder.nix
index 536d394b3fd..3ca1542c18f 100644
--- a/nixos/modules/services/continuous-integration/jenkins/job-builder.nix
+++ b/nixos/modules/services/continuous-integration/jenkins/job-builder.nix
@@ -74,7 +74,7 @@ in {
       jsonJobs = mkOption {
         default = [ ];
         type = types.listOf types.str;
-        example = literalExample ''
+        example = literalExpression ''
           [
             '''
               [ { "job":
@@ -94,7 +94,7 @@ in {
       nixJobs = mkOption {
         default = [ ];
         type = types.listOf types.attrs;
-        example = literalExample ''
+        example = literalExpression ''
           [ { job =
               { name = "jenkins-job-test-3";
                 builders = [
diff --git a/nixos/modules/services/databases/aerospike.nix b/nixos/modules/services/databases/aerospike.nix
index 4b905f90529..8109762aea7 100644
--- a/nixos/modules/services/databases/aerospike.nix
+++ b/nixos/modules/services/databases/aerospike.nix
@@ -43,7 +43,7 @@ in
 
       package = mkOption {
         default = pkgs.aerospike;
-        defaultText = "pkgs.aerospike";
+        defaultText = literalExpression "pkgs.aerospike";
         type = types.package;
         description = "Which Aerospike derivation to use";
       };
diff --git a/nixos/modules/services/databases/cassandra.nix b/nixos/modules/services/databases/cassandra.nix
index 820be5085de..b36cac35e7c 100644
--- a/nixos/modules/services/databases/cassandra.nix
+++ b/nixos/modules/services/databases/cassandra.nix
@@ -4,7 +4,8 @@ let
   inherit (lib)
     concatStringsSep
     flip
-    literalExample
+    literalDocBook
+    literalExpression
     optionalAttrs
     optionals
     recursiveUpdate
@@ -136,8 +137,8 @@ in
     package = mkOption {
       type = types.package;
       default = pkgs.cassandra;
-      defaultText = "pkgs.cassandra";
-      example = literalExample "pkgs.cassandra_3_11";
+      defaultText = literalExpression "pkgs.cassandra";
+      example = literalExpression "pkgs.cassandra_3_11";
       description = ''
         The Apache Cassandra package to use.
       '';
@@ -276,7 +277,7 @@ in
     extraEnvSh = mkOption {
       type = types.lines;
       default = "";
-      example = "CLASSPATH=$CLASSPATH:\${extraJar}";
+      example = literalExpression ''"CLASSPATH=$CLASSPATH:''${extraJar}"'';
       description = ''
         Extra shell lines to be appended onto cassandra-env.sh.
       '';
@@ -436,6 +437,7 @@ in
         if versionAtLeast cfg.package.version "3.11"
         then pkgs.writeText "jmx-roles-file" defaultJmxRolesFile
         else null;
+      defaultText = literalDocBook ''generated configuration file if version is at least 3.11, otherwise <literal>null</literal>'';
       example = "/var/lib/cassandra/jmx.password";
       description = ''
         Specify your own jmx roles file.
diff --git a/nixos/modules/services/databases/cockroachdb.nix b/nixos/modules/services/databases/cockroachdb.nix
index 35fb46d69d8..eb061af9262 100644
--- a/nixos/modules/services/databases/cockroachdb.nix
+++ b/nixos/modules/services/databases/cockroachdb.nix
@@ -150,7 +150,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.cockroachdb;
-        defaultText = "pkgs.cockroachdb";
+        defaultText = literalExpression "pkgs.cockroachdb";
         description = ''
           The CockroachDB derivation to use for running the service.
 
diff --git a/nixos/modules/services/databases/couchdb.nix b/nixos/modules/services/databases/couchdb.nix
index 6cc29cd717e..16dd64f2373 100644
--- a/nixos/modules/services/databases/couchdb.nix
+++ b/nixos/modules/services/databases/couchdb.nix
@@ -44,8 +44,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.couchdb;
-        defaultText = "pkgs.couchdb";
-        example = literalExample "pkgs.couchdb";
+        defaultText = literalExpression "pkgs.couchdb";
         description = ''
           CouchDB package to use.
         '';
diff --git a/nixos/modules/services/databases/firebird.nix b/nixos/modules/services/databases/firebird.nix
index 0815487d4a1..4e3130bea22 100644
--- a/nixos/modules/services/databases/firebird.nix
+++ b/nixos/modules/services/databases/firebird.nix
@@ -44,11 +44,9 @@ in
 
       package = mkOption {
         default = pkgs.firebird;
-        defaultText = "pkgs.firebird";
+        defaultText = literalExpression "pkgs.firebird";
         type = types.package;
-        example = ''
-          <code>package = pkgs.firebird_3;</code>
-        '';
+        example = literalExpression "pkgs.firebird_3";
         description = ''
           Which Firebird package to be installed: <code>pkgs.firebird_3</code>
           For SuperServer use override: <code>pkgs.firebird_3.override { superServer = true; };</code>
@@ -56,7 +54,7 @@ in
       };
 
       port = mkOption {
-        default = "3050";
+        default = 3050;
         type = types.port;
         description = ''
           Port Firebird uses.
diff --git a/nixos/modules/services/databases/hbase.nix b/nixos/modules/services/databases/hbase.nix
index 2d1a47bbaa3..9132b7ed356 100644
--- a/nixos/modules/services/databases/hbase.nix
+++ b/nixos/modules/services/databases/hbase.nix
@@ -44,8 +44,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.hbase;
-        defaultText = "pkgs.hbase";
-        example = literalExample "pkgs.hbase";
+        defaultText = literalExpression "pkgs.hbase";
         description = ''
           HBase package to use.
         '';
diff --git a/nixos/modules/services/databases/influxdb.nix b/nixos/modules/services/databases/influxdb.nix
index 3b8c00929ba..c7c9871cfec 100644
--- a/nixos/modules/services/databases/influxdb.nix
+++ b/nixos/modules/services/databases/influxdb.nix
@@ -121,7 +121,7 @@ in
 
       package = mkOption {
         default = pkgs.influxdb;
-        defaultText = "pkgs.influxdb";
+        defaultText = literalExpression "pkgs.influxdb";
         description = "Which influxdb derivation to use";
         type = types.package;
       };
diff --git a/nixos/modules/services/databases/influxdb2.nix b/nixos/modules/services/databases/influxdb2.nix
index df7bac4261b..01b9c493484 100644
--- a/nixos/modules/services/databases/influxdb2.nix
+++ b/nixos/modules/services/databases/influxdb2.nix
@@ -11,7 +11,7 @@ in
       enable = mkEnableOption "the influxdb2 server";
       package = mkOption {
         default = pkgs.influxdb2;
-        defaultText = "pkgs.influxdb2";
+        defaultText = literalExpression "pkgs.influxdb2";
         description = "influxdb2 derivation to use.";
         type = types.package;
       };
diff --git a/nixos/modules/services/databases/monetdb.nix b/nixos/modules/services/databases/monetdb.nix
index 5c66fc7b2e3..52a2ef041f8 100644
--- a/nixos/modules/services/databases/monetdb.nix
+++ b/nixos/modules/services/databases/monetdb.nix
@@ -17,7 +17,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.monetdb;
-        defaultText = "pkgs.monetdb";
+        defaultText = literalExpression "pkgs.monetdb";
         description = "MonetDB package to use.";
       };
 
diff --git a/nixos/modules/services/databases/mongodb.nix b/nixos/modules/services/databases/mongodb.nix
index 5121e0415db..fccf85d482e 100644
--- a/nixos/modules/services/databases/mongodb.nix
+++ b/nixos/modules/services/databases/mongodb.nix
@@ -33,7 +33,7 @@ in
 
       package = mkOption {
         default = pkgs.mongodb;
-        defaultText = "pkgs.mongodb";
+        defaultText = literalExpression "pkgs.mongodb";
         type = types.package;
         description = "
           Which MongoDB derivation to use.
diff --git a/nixos/modules/services/databases/mysql.nix b/nixos/modules/services/databases/mysql.nix
index b801b5cce63..a9d9a6d8058 100644
--- a/nixos/modules/services/databases/mysql.nix
+++ b/nixos/modules/services/databases/mysql.nix
@@ -34,7 +34,7 @@ in
 
       package = mkOption {
         type = types.package;
-        example = literalExample "pkgs.mariadb";
+        example = literalExpression "pkgs.mariadb";
         description = "
           Which MySQL derivation to use. MariaDB packages are supported too.
         ";
@@ -43,7 +43,7 @@ in
       bind = mkOption {
         type = types.nullOr types.str;
         default = null;
-        example = literalExample "0.0.0.0";
+        example = "0.0.0.0";
         description = "Address to bind to. The default is to bind to all addresses.";
       };
 
@@ -74,12 +74,12 @@ in
       configFile = mkOption {
         type = types.path;
         default = settingsFile;
-        defaultText = "settingsFile";
+        defaultText = literalExpression "settingsFile";
         description = ''
           Override the configuration file used by MySQL. By default,
           NixOS generates one automatically from <option>services.mysql.settings</option>.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           pkgs.writeText "my.cnf" '''
             [mysqld]
             datadir = /var/lib/mysql
@@ -109,7 +109,7 @@ in
             </para>
           </note>
         '';
-        example = literalExample ''
+        example = literalExpression ''
           {
             mysqld = {
               key_buffer_size = "6G";
@@ -167,7 +167,7 @@ in
           of MySQL. The schema attribute is optional: If not specified, an empty database is created.
         '';
         example = [
-          { name = "foodatabase"; schema = literalExample "./foodatabase.sql"; }
+          { name = "foodatabase"; schema = literalExpression "./foodatabase.sql"; }
           { name = "bardatabase"; }
         ];
       };
@@ -217,7 +217,7 @@ in
                 <link xlink:href="https://mariadb.com/kb/en/library/grant/">GRANT syntax</link>.
                 The attributes are used as <code>GRANT ''${attrName} ON ''${attrValue}</code>.
               '';
-              example = literalExample ''
+              example = literalExpression ''
                 {
                   "database.*" = "ALL PRIVILEGES";
                   "*.*" = "SELECT, LOCK TABLES";
@@ -235,7 +235,7 @@ in
           option is changed. This means that users created and permissions assigned once through this option or
           otherwise have to be removed manually.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           [
             {
               name = "nextcloud";
diff --git a/nixos/modules/services/databases/neo4j.nix b/nixos/modules/services/databases/neo4j.nix
index 2a30923538d..f37e5ad1693 100644
--- a/nixos/modules/services/databases/neo4j.nix
+++ b/nixos/modules/services/databases/neo4j.nix
@@ -179,7 +179,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.neo4j;
-      defaultText = "pkgs.neo4j";
+      defaultText = literalExpression "pkgs.neo4j";
       description = ''
         Neo4j package to use.
       '';
diff --git a/nixos/modules/services/databases/openldap.nix b/nixos/modules/services/databases/openldap.nix
index f0efc659cff..2c1e25d4308 100644
--- a/nixos/modules/services/databases/openldap.nix
+++ b/nixos/modules/services/databases/openldap.nix
@@ -34,7 +34,7 @@ let
           in types.attrsOf (types.submodule { options = hiddenOptions; });
           default = {};
           description = "Child entries of the current entry, with recursively the same structure.";
-          example = lib.literalExample ''
+          example = lib.literalExpression ''
             {
                 "cn=schema" = {
                 # The attribute used in the DN must be defined
@@ -127,6 +127,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.openldap;
+        defaultText = literalExpression "pkgs.openldap";
         description = ''
           OpenLDAP package to use.
 
@@ -158,14 +159,14 @@ in {
       settings = mkOption {
         type = ldapAttrsType;
         description = "Configuration for OpenLDAP, in OLC format";
-        example = lib.literalExample ''
+        example = lib.literalExpression ''
           {
             attrs.olcLogLevel = [ "stats" ];
             children = {
               "cn=schema".includes = [
-                 "\${pkgs.openldap}/etc/schema/core.ldif"
-                 "\${pkgs.openldap}/etc/schema/cosine.ldif"
-                 "\${pkgs.openldap}/etc/schema/inetorgperson.ldif"
+                 "''${pkgs.openldap}/etc/schema/core.ldif"
+                 "''${pkgs.openldap}/etc/schema/cosine.ldif"
+                 "''${pkgs.openldap}/etc/schema/inetorgperson.ldif"
               ];
               "olcDatabase={-1}frontend" = {
                 attrs = {
@@ -225,7 +226,7 @@ in {
           rebuilt on each server startup, so this will slow down server startup,
           especially with large databases.
         '';
-        example = lib.literalExample ''
+        example = lib.literalExpression ''
           {
             "dc=example,dc=org" = '''
               dn= dn: dc=example,dc=org
diff --git a/nixos/modules/services/databases/opentsdb.nix b/nixos/modules/services/databases/opentsdb.nix
index c4bd71f3d60..e873b2f7011 100644
--- a/nixos/modules/services/databases/opentsdb.nix
+++ b/nixos/modules/services/databases/opentsdb.nix
@@ -26,8 +26,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.opentsdb;
-        defaultText = "pkgs.opentsdb";
-        example = literalExample "pkgs.opentsdb";
+        defaultText = literalExpression "pkgs.opentsdb";
         description = ''
           OpenTSDB package to use.
         '';
diff --git a/nixos/modules/services/databases/pgmanage.nix b/nixos/modules/services/databases/pgmanage.nix
index 8508e76b5cd..f30f71866af 100644
--- a/nixos/modules/services/databases/pgmanage.nix
+++ b/nixos/modules/services/databases/pgmanage.nix
@@ -49,7 +49,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.pgmanage;
-      defaultText = "pkgs.pgmanage";
+      defaultText = literalExpression "pkgs.pgmanage";
       description = ''
         The pgmanage package to use.
       '';
diff --git a/nixos/modules/services/databases/postgresql.nix b/nixos/modules/services/databases/postgresql.nix
index fd4a195787f..d49cb4c51a7 100644
--- a/nixos/modules/services/databases/postgresql.nix
+++ b/nixos/modules/services/databases/postgresql.nix
@@ -44,7 +44,7 @@ in
 
       package = mkOption {
         type = types.package;
-        example = literalExample "pkgs.postgresql_11";
+        example = literalExpression "pkgs.postgresql_11";
         description = ''
           PostgreSQL package to use.
         '';
@@ -66,7 +66,7 @@ in
 
       dataDir = mkOption {
         type = types.path;
-        defaultText = "/var/lib/postgresql/\${config.services.postgresql.package.psqlSchema}";
+        defaultText = literalExpression ''"/var/lib/postgresql/''${config.services.postgresql.package.psqlSchema}"'';
         example = "/var/lib/postgresql/11";
         description = ''
           The data directory for PostgreSQL. If left as the default value
@@ -161,7 +161,7 @@ in
                 <link xlink:href="https://www.postgresql.org/docs/current/sql-grant.html">GRANT syntax</link>.
                 The attributes are used as <code>GRANT ''${attrValue} ON ''${attrName}</code>.
               '';
-              example = literalExample ''
+              example = literalExpression ''
                 {
                   "DATABASE \"nextcloud\"" = "ALL PRIVILEGES";
                   "ALL TABLES IN SCHEMA public" = "ALL PRIVILEGES";
@@ -179,7 +179,7 @@ in
           option is changed. This means that users created and permissions assigned once through this option or
           otherwise have to be removed manually.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           [
             {
               name = "nextcloud";
@@ -221,7 +221,7 @@ in
       extraPlugins = mkOption {
         type = types.listOf types.path;
         default = [];
-        example = literalExample "with pkgs.postgresql_11.pkgs; [ postgis pg_repack ]";
+        example = literalExpression "with pkgs.postgresql_11.pkgs; [ postgis pg_repack ]";
         description = ''
           List of PostgreSQL plugins. PostgreSQL version for each plugin should
           match version for <literal>services.postgresql.package</literal> value.
@@ -241,7 +241,7 @@ in
             escaped with two single quotes as described by the upstream documentation linked above.
           </para></note>
         '';
-        example = literalExample ''
+        example = literalExpression ''
           {
             log_connections = true;
             log_statement = "all";
diff --git a/nixos/modules/services/databases/redis.nix b/nixos/modules/services/databases/redis.nix
index 1b9358c81a1..578d9d9ec8d 100644
--- a/nixos/modules/services/databases/redis.nix
+++ b/nixos/modules/services/databases/redis.nix
@@ -47,7 +47,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.redis;
-        defaultText = "pkgs.redis";
+        defaultText = literalExpression "pkgs.redis";
         description = "Which Redis derivation to use.";
       };
 
@@ -133,7 +133,6 @@ in {
         type = with types; listOf (listOf int);
         default = [ [900 1] [300 10] [60 10000] ];
         description = "The schedule in which data is persisted to disk, represented as a list of lists where the first element represent the amount of seconds and the second the number of changes.";
-        example = [ [900 1] [300 10] [60 10000] ];
       };
 
       slaveOf = mkOption {
@@ -217,7 +216,7 @@ in {
           <link xlink:href="https://redis.io/topics/config"/>
           for details on supported values.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           {
             loadmodule = [ "/path/to/my_module.so" "/path/to/other_module.so" ];
           }
diff --git a/nixos/modules/services/databases/riak.nix b/nixos/modules/services/databases/riak.nix
index 657eeea87bf..cc4237d038c 100644
--- a/nixos/modules/services/databases/riak.nix
+++ b/nixos/modules/services/databases/riak.nix
@@ -21,8 +21,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.riak;
-        defaultText = "pkgs.riak";
-        example = literalExample "pkgs.riak";
+        defaultText = literalExpression "pkgs.riak";
         description = ''
           Riak package to use.
         '';
diff --git a/nixos/modules/services/databases/victoriametrics.nix b/nixos/modules/services/databases/victoriametrics.nix
index 9e2c79e61a3..0513dcff172 100644
--- a/nixos/modules/services/databases/victoriametrics.nix
+++ b/nixos/modules/services/databases/victoriametrics.nix
@@ -6,7 +6,7 @@ let cfg = config.services.victoriametrics; in
     package = mkOption {
       type = types.package;
       default = pkgs.victoriametrics;
-      defaultText = "pkgs.victoriametrics";
+      defaultText = literalExpression "pkgs.victoriametrics";
       description = ''
         The VictoriaMetrics distribution to use.
       '';
diff --git a/nixos/modules/services/desktops/geoclue2.nix b/nixos/modules/services/desktops/geoclue2.nix
index cb5c948ecf7..60a34dd6563 100644
--- a/nixos/modules/services/desktops/geoclue2.nix
+++ b/nixos/modules/services/desktops/geoclue2.nix
@@ -21,7 +21,6 @@ let
 
       isAllowed = mkOption {
         type = types.bool;
-        default = null;
         description = ''
           Whether the application will be allowed access to location information.
         '';
@@ -29,7 +28,6 @@ let
 
       isSystem = mkOption {
         type = types.bool;
-        default = null;
         description = ''
           Whether the application is a system component or not.
         '';
@@ -162,7 +160,7 @@ in
       appConfig = mkOption {
         type = types.attrsOf appConfigModule;
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           "com.github.app" = {
             isAllowed = true;
             isSystem = true;
diff --git a/nixos/modules/services/desktops/gnome/evolution-data-server.nix b/nixos/modules/services/desktops/gnome/evolution-data-server.nix
index ef5ad797c27..bd2242d9818 100644
--- a/nixos/modules/services/desktops/gnome/evolution-data-server.nix
+++ b/nixos/modules/services/desktops/gnome/evolution-data-server.nix
@@ -39,7 +39,7 @@ with lib;
       plugins = mkOption {
         type = types.listOf types.package;
         default = [ ];
-        example = literalExample "[ pkgs.evolution-ews ]";
+        example = literalExpression "[ pkgs.evolution-ews ]";
         description = "Plugins for Evolution.";
       };
 
diff --git a/nixos/modules/services/desktops/gvfs.nix b/nixos/modules/services/desktops/gvfs.nix
index 966a4d38662..b6a27279bdf 100644
--- a/nixos/modules/services/desktops/gvfs.nix
+++ b/nixos/modules/services/desktops/gvfs.nix
@@ -35,6 +35,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.gnome.gvfs;
+        defaultText = literalExpression "pkgs.gnome.gvfs";
         description = "Which GVfs package to use.";
       };
 
diff --git a/nixos/modules/services/desktops/pipewire/pipewire-media-session.nix b/nixos/modules/services/desktops/pipewire/pipewire-media-session.nix
index 41ab995e329..0dd3882cc67 100644
--- a/nixos/modules/services/desktops/pipewire/pipewire-media-session.nix
+++ b/nixos/modules/services/desktops/pipewire/pipewire-media-session.nix
@@ -39,14 +39,14 @@ in {
       enable = mkOption {
         type = types.bool;
         default = config.services.pipewire.enable;
-        defaultText = "config.services.pipewire.enable";
+        defaultText = literalExpression "config.services.pipewire.enable";
         description = "Example pipewire session manager";
       };
 
       package = mkOption {
         type = types.package;
         default = pkgs.pipewire.mediaSession;
-        example = literalExample "pkgs.pipewire.mediaSession";
+        defaultText = literalExpression "pkgs.pipewire.mediaSession";
         description = ''
           The pipewire-media-session derivation to use.
         '';
diff --git a/nixos/modules/services/desktops/pipewire/pipewire.nix b/nixos/modules/services/desktops/pipewire/pipewire.nix
index bc75aa2717a..604645b2b18 100644
--- a/nixos/modules/services/desktops/pipewire/pipewire.nix
+++ b/nixos/modules/services/desktops/pipewire/pipewire.nix
@@ -51,8 +51,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.pipewire;
-        defaultText = "pkgs.pipewire";
-        example = literalExample "pkgs.pipewire";
+        defaultText = literalExpression "pkgs.pipewire";
         description = ''
           The pipewire derivation to use.
         '';
diff --git a/nixos/modules/services/development/distccd.nix b/nixos/modules/services/development/distccd.nix
index 8790ea08d0c..9f6d5c813c4 100644
--- a/nixos/modules/services/development/distccd.nix
+++ b/nixos/modules/services/development/distccd.nix
@@ -69,7 +69,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.distcc;
-        example = "pkgs.distcc";
+        defaultText = literalExpression "pkgs.distcc";
         description = ''
           The distcc package to use.
         '';
diff --git a/nixos/modules/services/development/hoogle.nix b/nixos/modules/services/development/hoogle.nix
index a6693013b73..7c635f7a5b8 100644
--- a/nixos/modules/services/development/hoogle.nix
+++ b/nixos/modules/services/development/hoogle.nix
@@ -27,8 +27,8 @@ in {
     packages = mkOption {
       type = types.functionTo (types.listOf types.package);
       default = hp: [];
-      defaultText = "hp: []";
-      example = "hp: with hp; [ text lens ]";
+      defaultText = literalExpression "hp: []";
+      example = literalExpression "hp: with hp; [ text lens ]";
       description = ''
         The Haskell packages to generate documentation for.
 
@@ -41,7 +41,7 @@ in {
     haskellPackages = mkOption {
       description = "Which haskell package set to use.";
       default = pkgs.haskellPackages;
-      defaultText = "pkgs.haskellPackages";
+      defaultText = literalExpression "pkgs.haskellPackages";
     };
 
     home = mkOption {
diff --git a/nixos/modules/services/development/jupyter/default.nix b/nixos/modules/services/development/jupyter/default.nix
index 21b84b3bcda..bebb3c3f13f 100644
--- a/nixos/modules/services/development/jupyter/default.nix
+++ b/nixos/modules/services/development/jupyter/default.nix
@@ -40,6 +40,7 @@ in {
       # want to pass in JUPYTER_PATH but use .environment instead,
       # saving a rebuild.
       default = pkgs.python3.pkgs.notebook;
+      defaultText = literalExpression "pkgs.python3.pkgs.notebook";
       description = ''
         Jupyter package to use.
       '';
@@ -105,10 +106,7 @@ in {
           "open('/path/secret_file', 'r', encoding='utf8').read().strip()"
         It will be interpreted at the end of the notebookConfig.
       '';
-      example = [
-        "'sha1:1b961dc713fb:88483270a63e57d18d43cf337e629539de1436ba'"
-        "open('/path/secret_file', 'r', encoding='utf8').read().strip()"
-      ];
+      example = "'sha1:1b961dc713fb:88483270a63e57d18d43cf337e629539de1436ba'";
     };
 
     notebookConfig = mkOption {
@@ -125,7 +123,7 @@ in {
       })));
 
       default = null;
-      example = literalExample ''
+      example = literalExpression ''
         {
           python3 = let
             env = (pkgs.python3.withPackages (pythonPackages: with pythonPackages; [
diff --git a/nixos/modules/services/development/jupyter/kernel-options.nix b/nixos/modules/services/development/jupyter/kernel-options.nix
index 03547637449..348a8b44b38 100644
--- a/nixos/modules/services/development/jupyter/kernel-options.nix
+++ b/nixos/modules/services/development/jupyter/kernel-options.nix
@@ -9,10 +9,10 @@ with lib;
     displayName = mkOption {
       type = types.str;
       default = "";
-      example = [
+      example = literalExpression ''
         "Python 3"
         "Python 3 for Data Science"
-      ];
+      '';
       description = ''
         Name that will be shown to the user.
       '';
@@ -43,7 +43,7 @@ with lib;
     logo32 = mkOption {
       type = types.nullOr types.path;
       default = null;
-      example = "{env.sitePackages}/ipykernel/resources/logo-32x32.png";
+      example = literalExpression ''"''${env.sitePackages}/ipykernel/resources/logo-32x32.png"'';
       description = ''
         Path to 32x32 logo png.
       '';
@@ -51,7 +51,7 @@ with lib;
     logo64 = mkOption {
       type = types.nullOr types.path;
       default = null;
-      example = "{env.sitePackages}/ipykernel/resources/logo-64x64.png";
+      example = literalExpression ''"''${env.sitePackages}/ipykernel/resources/logo-64x64.png"'';
       description = ''
         Path to 64x64 logo png.
       '';
diff --git a/nixos/modules/services/development/jupyterhub/default.nix b/nixos/modules/services/development/jupyterhub/default.nix
index a1df4468cff..fa6b3be960a 100644
--- a/nixos/modules/services/development/jupyterhub/default.nix
+++ b/nixos/modules/services/development/jupyterhub/default.nix
@@ -66,18 +66,24 @@ in {
         defaults for configuration but you can override anything since
         this is a python file.
       '';
-      example = literalExample ''
-         c.SystemdSpawner.mem_limit = '8G'
-         c.SystemdSpawner.cpu_limit = 2.0
+      example = ''
+        c.SystemdSpawner.mem_limit = '8G'
+        c.SystemdSpawner.cpu_limit = 2.0
       '';
     };
 
     jupyterhubEnv = mkOption {
       type = types.package;
-      default = (pkgs.python3.withPackages (p: with p; [
+      default = pkgs.python3.withPackages (p: with p; [
         jupyterhub
         jupyterhub-systemdspawner
-      ]));
+      ]);
+      defaultText = literalExpression ''
+        pkgs.python3.withPackages (p: with p; [
+          jupyterhub
+          jupyterhub-systemdspawner
+        ])
+      '';
       description = ''
         Python environment to run jupyterhub
 
@@ -90,10 +96,16 @@ in {
 
     jupyterlabEnv = mkOption {
       type = types.package;
-      default = (pkgs.python3.withPackages (p: with p; [
+      default = pkgs.python3.withPackages (p: with p; [
         jupyterhub
         jupyterlab
-      ]));
+      ]);
+      defaultText = literalExpression ''
+        pkgs.python3.withPackages (p: with p; [
+          jupyterhub
+          jupyterlab
+        ])
+      '';
       description = ''
         Python environment to run jupyterlab
 
@@ -111,7 +123,7 @@ in {
       })));
 
       default = null;
-      example = literalExample ''
+      example = literalExpression ''
         {
           python3 = let
             env = (pkgs.python3.withPackages (pythonPackages: with pythonPackages; [
diff --git a/nixos/modules/services/development/lorri.nix b/nixos/modules/services/development/lorri.nix
index fc576e4c18b..bda63518bfd 100644
--- a/nixos/modules/services/development/lorri.nix
+++ b/nixos/modules/services/development/lorri.nix
@@ -21,8 +21,7 @@ in {
         description = ''
           The lorri package to use.
         '';
-        defaultText = lib.literalExample "pkgs.lorri";
-        example = lib.literalExample "pkgs.lorri";
+        defaultText = lib.literalExpression "pkgs.lorri";
       };
     };
   };
diff --git a/nixos/modules/services/display-managers/greetd.nix b/nixos/modules/services/display-managers/greetd.nix
index d4f5dc267d0..895961707d3 100644
--- a/nixos/modules/services/display-managers/greetd.nix
+++ b/nixos/modules/services/display-managers/greetd.nix
@@ -13,13 +13,13 @@ in
     package = mkOption {
       type = types.package;
       default = pkgs.greetd.greetd;
-      defaultText = "pkgs.greetd.greetd";
+      defaultText = literalExpression "pkgs.greetd.greetd";
       description = "The greetd package that should be used.";
     };
 
     settings = mkOption {
       type = settingsFormat.type;
-      example = literalExample ''
+      example = literalExpression ''
         {
           default_session = {
             command = "''${pkgs.greetd.greetd}/bin/agreety --cmd sway";
@@ -43,7 +43,7 @@ in
     restart = mkOption {
       type = types.bool;
       default = !(cfg.settings ? initial_session);
-      defaultText = "!(config.services.greetd.settings ? initial_session)";
+      defaultText = literalExpression "!(config.services.greetd.settings ? initial_session)";
       description = ''
         Wether to restart greetd when it terminates (e.g. on failure).
         This is usually desirable so a user can always log in, but should be disabled when using 'settings.initial_session' (autologin),
diff --git a/nixos/modules/services/editors/emacs.nix b/nixos/modules/services/editors/emacs.nix
index 00d9eaad9eb..e2bbd27f6e5 100644
--- a/nixos/modules/services/editors/emacs.nix
+++ b/nixos/modules/services/editors/emacs.nix
@@ -66,7 +66,7 @@ in
     package = mkOption {
       type = types.package;
       default = pkgs.emacs;
-      defaultText = "pkgs.emacs";
+      defaultText = literalExpression "pkgs.emacs";
       description = ''
         emacs derivation to use.
       '';
diff --git a/nixos/modules/services/editors/infinoted.nix b/nixos/modules/services/editors/infinoted.nix
index 3eb0753194d..16fe52a232b 100644
--- a/nixos/modules/services/editors/infinoted.nix
+++ b/nixos/modules/services/editors/infinoted.nix
@@ -11,7 +11,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.libinfinity;
-      defaultText = "pkgs.libinfinity";
+      defaultText = literalExpression "pkgs.libinfinity";
       description = ''
         Package providing infinoted
       '';
diff --git a/nixos/modules/services/games/crossfire-server.nix b/nixos/modules/services/games/crossfire-server.nix
index 974aea0cd67..a33025e0c3e 100644
--- a/nixos/modules/services/games/crossfire-server.nix
+++ b/nixos/modules/services/games/crossfire-server.nix
@@ -18,7 +18,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.crossfire-server;
-      defaultText = "pkgs.crossfire-server";
+      defaultText = literalExpression "pkgs.crossfire-server";
       description = ''
         The package to use for the Crossfire server (and map/arch data, if you
         don't change dataDir).
@@ -28,7 +28,7 @@ in {
     dataDir = mkOption {
       type = types.str;
       default = "${cfg.package}/share/crossfire";
-      defaultText = "\${config.services.crossfire.package}/share/crossfire";
+      defaultText = literalExpression ''"''${config.services.crossfire.package}/share/crossfire"'';
       description = ''
         Where to load readonly data from -- maps, archetypes, treasure tables,
         and the like. If you plan to edit the data on the live server (rather
@@ -72,30 +72,32 @@ in {
         overwrite the example files that come with the server, rather than being
         appended to them as the other configuration files are.
       '';
-      example = literalExample ''
-        dm_file = '''
-          admin:secret_password:localhost
-          jane:xyzzy:*
-        ''';
-        ban_file = '''
-          # Bob is a jerk
-          bob@*
-          # So is everyone on 192.168.86.255/24
-          *@192.168.86.
-        ''';
-        metaserver2 = '''
-          metaserver2_notification on
-          localhostname crossfire.example.net
-        ''';
-        motd = "Welcome to CrossFire!";
-        news = "No news yet.";
-        rules = "Don't be a jerk.";
-        settings = '''
-          # be nicer to newbies and harsher to experienced players
-          balanced_stat_loss true
-          # don't let players pick up and use admin-created items
-          real_wiz false
-        ''';
+      example = literalExpression ''
+        {
+          dm_file = '''
+            admin:secret_password:localhost
+            jane:xyzzy:*
+          ''';
+          ban_file = '''
+            # Bob is a jerk
+            bob@*
+            # So is everyone on 192.168.86.255/24
+            *@192.168.86.
+          ''';
+          metaserver2 = '''
+            metaserver2_notification on
+            localhostname crossfire.example.net
+          ''';
+          motd = "Welcome to CrossFire!";
+          news = "No news yet.";
+          rules = "Don't be a jerk.";
+          settings = '''
+            # be nicer to newbies and harsher to experienced players
+            balanced_stat_loss true
+            # don't let players pick up and use admin-created items
+            real_wiz false
+          ''';
+        }
       '';
       default = {};
     };
diff --git a/nixos/modules/services/games/deliantra-server.nix b/nixos/modules/services/games/deliantra-server.nix
index 36bf6041762..b7011f4c354 100644
--- a/nixos/modules/services/games/deliantra-server.nix
+++ b/nixos/modules/services/games/deliantra-server.nix
@@ -18,7 +18,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.deliantra-server;
-      defaultText = "pkgs.deliantra-server";
+      defaultText = literalExpression "pkgs.deliantra-server";
       description = ''
         The package to use for the Deliantra server (and map/arch data, if you
         don't change dataDir).
@@ -28,7 +28,7 @@ in {
     dataDir = mkOption {
       type = types.str;
       default = "${pkgs.deliantra-data}";
-      defaultText = "\${pkgs.deliantra-data}";
+      defaultText = literalExpression ''"''${pkgs.deliantra-data}"'';
       description = ''
         Where to store readonly data (maps, archetypes, sprites, etc).
         Note that if you plan to use the live map editor (rather than editing
@@ -69,22 +69,24 @@ in {
         The example here is not comprehensive. See the files in
         /etc/deliantra-server after enabling this module for full documentation.
       '';
-      example = literalExample ''
-        dm_file = '''
-          admin:secret_password:localhost
-          jane:xyzzy:*
-        ''';
-        motd = "Welcome to Deliantra!";
-        settings = '''
-          # Settings for game mechanics.
-          stat_loss_on_death true
-          armor_max_enchant 7
-        ''';
-        config = '''
-          # Settings for the server daemon.
-          hiscore_url https://deliantra.example.net/scores/
-          max_map_reset 86400
-        ''';
+      example = literalExpression ''
+        {
+          dm_file = '''
+            admin:secret_password:localhost
+            jane:xyzzy:*
+          ''';
+          motd = "Welcome to Deliantra!";
+          settings = '''
+            # Settings for game mechanics.
+            stat_loss_on_death true
+            armor_max_enchant 7
+          ''';
+          config = '''
+            # Settings for the server daemon.
+            hiscore_url https://deliantra.example.net/scores/
+            max_map_reset 86400
+          ''';
+        }
       '';
       default = {
         motd = "";
diff --git a/nixos/modules/services/games/factorio.nix b/nixos/modules/services/games/factorio.nix
index 3cb14275792..0e8860a0281 100644
--- a/nixos/modules/services/games/factorio.nix
+++ b/nixos/modules/services/games/factorio.nix
@@ -86,7 +86,7 @@ in
       configFile = mkOption {
         type = types.path;
         default = configFile;
-        defaultText = "configFile";
+        defaultText = literalExpression "configFile";
         description = ''
           The server's configuration file.
 
@@ -162,8 +162,8 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.factorio-headless;
-        defaultText = "pkgs.factorio-headless";
-        example = "pkgs.factorio-headless-experimental";
+        defaultText = literalExpression "pkgs.factorio-headless";
+        example = literalExpression "pkgs.factorio-headless-experimental";
         description = ''
           Factorio version to use. This defaults to the stable channel.
         '';
diff --git a/nixos/modules/services/games/minecraft-server.nix b/nixos/modules/services/games/minecraft-server.nix
index 458e57fef84..ddbe9508a4d 100644
--- a/nixos/modules/services/games/minecraft-server.nix
+++ b/nixos/modules/services/games/minecraft-server.nix
@@ -109,7 +109,7 @@ in {
           You can use <link xlink:href="https://mcuuid.net/"/> to get a
           Minecraft UUID for a username.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           {
             username1 = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
             username2 = "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy";
@@ -120,7 +120,7 @@ in {
       serverProperties = mkOption {
         type = with types; attrsOf (oneOf [ bool int str ]);
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           {
             server-port = 43000;
             difficulty = 3;
@@ -144,8 +144,8 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.minecraft-server;
-        defaultText = "pkgs.minecraft-server";
-        example = literalExample "pkgs.minecraft-server_1_12_2";
+        defaultText = literalExpression "pkgs.minecraft-server";
+        example = literalExpression "pkgs.minecraft-server_1_12_2";
         description = "Version of minecraft-server to run.";
       };
 
diff --git a/nixos/modules/services/hardware/acpid.nix b/nixos/modules/services/hardware/acpid.nix
index 3e619fe32ef..883ef083003 100644
--- a/nixos/modules/services/hardware/acpid.nix
+++ b/nixos/modules/services/hardware/acpid.nix
@@ -61,7 +61,7 @@ in
           options = {
             event = mkOption {
               type = types.str;
-              example = [ "button/power.*" "button/lid.*" "ac_adapter.*" "button/mute.*" "button/volumedown.*" "cd/play.*" "cd/next.*" ];
+              example = literalExpression ''"button/power.*" "button/lid.*" "ac_adapter.*" "button/mute.*" "button/volumedown.*" "cd/play.*" "cd/next.*"'';
               description = "Event type.";
             };
 
diff --git a/nixos/modules/services/hardware/actkbd.nix b/nixos/modules/services/hardware/actkbd.nix
index f7770f85da3..b499de97b2c 100644
--- a/nixos/modules/services/hardware/actkbd.nix
+++ b/nixos/modules/services/hardware/actkbd.nix
@@ -74,7 +74,7 @@ in
       bindings = mkOption {
         type = types.listOf (types.submodule bindingCfg);
         default = [];
-        example = lib.literalExample ''
+        example = lib.literalExpression ''
           [ { keys = [ 113 ]; events = [ "key" ]; command = "''${pkgs.alsa-utils}/bin/amixer -q set Master toggle"; }
           ]
         '';
diff --git a/nixos/modules/services/hardware/bluetooth.nix b/nixos/modules/services/hardware/bluetooth.nix
index 08ad90126b1..7f75ac272d4 100644
--- a/nixos/modules/services/hardware/bluetooth.nix
+++ b/nixos/modules/services/hardware/bluetooth.nix
@@ -6,7 +6,7 @@ let
   inherit (lib)
     mkDefault mkEnableOption mkIf mkOption
     mkRenamedOptionModule mkRemovedOptionModule
-    concatStringsSep escapeShellArgs
+    concatStringsSep escapeShellArgs literalExpression
     optional optionals optionalAttrs recursiveUpdate types;
 
   cfgFmt = pkgs.formats.ini { };
@@ -53,8 +53,8 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.bluez;
-        defaultText = "pkgs.bluez";
-        example = "pkgs.bluezFull";
+        defaultText = literalExpression "pkgs.bluez";
+        example = literalExpression "pkgs.bluezFull";
         description = ''
           Which BlueZ package to use.
 
diff --git a/nixos/modules/services/hardware/freefall.nix b/nixos/modules/services/hardware/freefall.nix
index 83f1e8c84f2..3f7b1592449 100644
--- a/nixos/modules/services/hardware/freefall.nix
+++ b/nixos/modules/services/hardware/freefall.nix
@@ -21,7 +21,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.freefall;
-      defaultText = "pkgs.freefall";
+      defaultText = literalExpression "pkgs.freefall";
       description = ''
         freefall derivation to use.
       '';
diff --git a/nixos/modules/services/hardware/fwupd.nix b/nixos/modules/services/hardware/fwupd.nix
index 51eca19dca3..e0506416ffa 100644
--- a/nixos/modules/services/hardware/fwupd.nix
+++ b/nixos/modules/services/hardware/fwupd.nix
@@ -80,7 +80,7 @@ in {
       extraTrustedKeys = mkOption {
         type = types.listOf types.path;
         default = [];
-        example = literalExample "[ /etc/nixos/fwupd/myfirmware.pem ]";
+        example = literalExpression "[ /etc/nixos/fwupd/myfirmware.pem ]";
         description = ''
           Installing a public key allows firmware signed with a matching private key to be recognized as trusted, which may require less authentication to install than for untrusted files. By default trusted firmware can be upgraded (but not downgraded) without the user or administrator password. Only very few keys are installed by default.
         '';
@@ -98,6 +98,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.fwupd;
+        defaultText = literalExpression "pkgs.fwupd";
         description = ''
           Which fwupd package to use.
         '';
diff --git a/nixos/modules/services/hardware/interception-tools.nix b/nixos/modules/services/hardware/interception-tools.nix
index fadcb19a016..e69c05841ee 100644
--- a/nixos/modules/services/hardware/interception-tools.nix
+++ b/nixos/modules/services/hardware/interception-tools.nix
@@ -15,6 +15,7 @@ in {
     plugins = mkOption {
       type = types.listOf types.package;
       default = [ pkgs.interception-tools-plugins.caps2esc ];
+      defaultText = literalExpression "[ pkgs.interception-tools-plugins.caps2esc ]";
       description = ''
         A list of interception tools plugins that will be made available to use
         inside the udevmon configuration.
diff --git a/nixos/modules/services/hardware/pcscd.nix b/nixos/modules/services/hardware/pcscd.nix
index 4fc1e351f50..b1a5c680a02 100644
--- a/nixos/modules/services/hardware/pcscd.nix
+++ b/nixos/modules/services/hardware/pcscd.nix
@@ -21,8 +21,8 @@ in
     plugins = mkOption {
       type = types.listOf types.package;
       default = [ pkgs.ccid ];
-      defaultText = "[ pkgs.ccid ]";
-      example = literalExample "[ pkgs.pcsc-cyberjack ]";
+      defaultText = literalExpression "[ pkgs.ccid ]";
+      example = literalExpression "[ pkgs.pcsc-cyberjack ]";
       description = "Plugin packages to be used for PCSC-Lite.";
     };
 
diff --git a/nixos/modules/services/hardware/sane.nix b/nixos/modules/services/hardware/sane.nix
index ccf726bd182..caf232e234e 100644
--- a/nixos/modules/services/hardware/sane.nix
+++ b/nixos/modules/services/hardware/sane.nix
@@ -73,7 +73,7 @@ in
           The example contains the package for HP scanners.
         </para></note>
       '';
-      example = literalExample "[ pkgs.hplipWithPlugin ]";
+      example = literalExpression "[ pkgs.hplipWithPlugin ]";
     };
 
     hardware.sane.disabledDefaultBackends = mkOption {
@@ -115,6 +115,7 @@ in
     hardware.sane.drivers.scanSnap.package = mkOption {
       type = types.package;
       default = pkgs.sane-drivers.epjitsu;
+      defaultText = literalExpression "pkgs.sane-drivers.epjitsu";
       description = ''
         Epjitsu driver package to use. Useful if you want to extract the driver files yourself.
 
diff --git a/nixos/modules/services/hardware/sane_extra_backends/brscan4.nix b/nixos/modules/services/hardware/sane_extra_backends/brscan4.nix
index a6afa01dd81..8f999810840 100644
--- a/nixos/modules/services/hardware/sane_extra_backends/brscan4.nix
+++ b/nixos/modules/services/hardware/sane_extra_backends/brscan4.nix
@@ -20,7 +20,7 @@ let
           the name of attribute will be used.
         '';
 
-        example = literalExample "office1";
+        example = "office1";
       };
 
       model = mkOption {
@@ -29,7 +29,7 @@ let
           The model of the network device.
         '';
 
-        example = literalExample "MFC-7860DW";
+        example = "MFC-7860DW";
       };
 
       ip = mkOption {
@@ -40,7 +40,7 @@ let
           provide a nodename.
         '';
 
-        example = literalExample "192.168.1.2";
+        example = "192.168.1.2";
       };
 
       nodename = mkOption {
@@ -51,7 +51,7 @@ let
           provide an ip.
         '';
 
-        example = literalExample "BRW0080927AFBCE";
+        example = "BRW0080927AFBCE";
       };
 
     };
diff --git a/nixos/modules/services/hardware/sane_extra_backends/brscan5.nix b/nixos/modules/services/hardware/sane_extra_backends/brscan5.nix
index 89b5ff0e028..2e4ad8cc3ba 100644
--- a/nixos/modules/services/hardware/sane_extra_backends/brscan5.nix
+++ b/nixos/modules/services/hardware/sane_extra_backends/brscan5.nix
@@ -20,7 +20,7 @@ let
           the name of attribute will be used.
         '';
 
-        example = literalExample "office1";
+        example = "office1";
       };
 
       model = mkOption {
@@ -29,7 +29,7 @@ let
           The model of the network device.
         '';
 
-        example = literalExample "ADS-1200";
+        example = "ADS-1200";
       };
 
       ip = mkOption {
@@ -40,7 +40,7 @@ let
           provide a nodename.
         '';
 
-        example = literalExample "192.168.1.2";
+        example = "192.168.1.2";
       };
 
       nodename = mkOption {
@@ -51,7 +51,7 @@ let
           provide an ip.
         '';
 
-        example = literalExample "BRW0080927AFBCE";
+        example = "BRW0080927AFBCE";
       };
 
     };
diff --git a/nixos/modules/services/hardware/thermald.nix b/nixos/modules/services/hardware/thermald.nix
index aa936ac09d1..3b495d00df0 100644
--- a/nixos/modules/services/hardware/thermald.nix
+++ b/nixos/modules/services/hardware/thermald.nix
@@ -27,7 +27,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.thermald;
-        defaultText = "pkgs.thermald";
+        defaultText = literalExpression "pkgs.thermald";
         description = "Which thermald package to use.";
       };
     };
diff --git a/nixos/modules/services/hardware/triggerhappy.nix b/nixos/modules/services/hardware/triggerhappy.nix
index f9f5234bdc3..4e979c4d8fa 100644
--- a/nixos/modules/services/hardware/triggerhappy.nix
+++ b/nixos/modules/services/hardware/triggerhappy.nix
@@ -69,7 +69,7 @@ in
       bindings = mkOption {
         type = types.listOf (types.submodule bindingCfg);
         default = [];
-        example = lib.literalExample ''
+        example = lib.literalExpression ''
           [ { keys = ["PLAYPAUSE"];  cmd = "''${pkgs.mpc_cli}/bin/mpc -q toggle"; } ]
         '';
         description = ''
diff --git a/nixos/modules/services/hardware/undervolt.nix b/nixos/modules/services/hardware/undervolt.nix
index 9c2f78a755d..212c0227c0d 100644
--- a/nixos/modules/services/hardware/undervolt.nix
+++ b/nixos/modules/services/hardware/undervolt.nix
@@ -50,7 +50,7 @@ in
     package = mkOption {
       type = types.package;
       default = pkgs.undervolt;
-      defaultText = "pkgs.undervolt";
+      defaultText = literalExpression "pkgs.undervolt";
       description = ''
         undervolt derivation to use.
       '';
diff --git a/nixos/modules/services/hardware/upower.nix b/nixos/modules/services/hardware/upower.nix
index 449810b5315..92c060147bf 100644
--- a/nixos/modules/services/hardware/upower.nix
+++ b/nixos/modules/services/hardware/upower.nix
@@ -30,8 +30,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.upower;
-        defaultText = "pkgs.upower";
-        example = lib.literalExample "pkgs.upower";
+        defaultText = literalExpression "pkgs.upower";
         description = ''
           Which upower package to use.
         '';
diff --git a/nixos/modules/services/hardware/vdr.nix b/nixos/modules/services/hardware/vdr.nix
index 8a6cde51b06..5ec222b805c 100644
--- a/nixos/modules/services/hardware/vdr.nix
+++ b/nixos/modules/services/hardware/vdr.nix
@@ -17,8 +17,8 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.vdr;
-        defaultText = "pkgs.vdr";
-        example = literalExample "pkgs.wrapVdr.override { plugins = with pkgs.vdrPlugins; [ hello ]; }";
+        defaultText = literalExpression "pkgs.vdr";
+        example = literalExpression "pkgs.wrapVdr.override { plugins = with pkgs.vdrPlugins; [ hello ]; }";
         description = "Package to use.";
       };
 
diff --git a/nixos/modules/services/logging/SystemdJournal2Gelf.nix b/nixos/modules/services/logging/SystemdJournal2Gelf.nix
index f26aef7262b..f28ecab8ac2 100644
--- a/nixos/modules/services/logging/SystemdJournal2Gelf.nix
+++ b/nixos/modules/services/logging/SystemdJournal2Gelf.nix
@@ -36,6 +36,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.systemd-journal2gelf;
+        defaultText = literalExpression "pkgs.systemd-journal2gelf";
         description = ''
           SystemdJournal2Gelf package to use.
         '';
diff --git a/nixos/modules/services/logging/awstats.nix b/nixos/modules/services/logging/awstats.nix
index 896f52302ff..df0124380ff 100644
--- a/nixos/modules/services/logging/awstats.nix
+++ b/nixos/modules/services/logging/awstats.nix
@@ -51,7 +51,7 @@ let
       hostAliases = mkOption {
         type = types.listOf types.str;
         default = [];
-        example = "[ \"www.example.org\" ]";
+        example = [ "www.example.org" ];
         description = ''
           List of aliases the site has.
         '';
@@ -60,12 +60,12 @@ let
       extraConfig = mkOption {
         type = types.attrsOf types.str;
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           {
             "ValidHTTPCodes" = "404";
           }
         '';
-        description = "Extra configuration to be appendend to awstats.\${name}.conf.";
+        description = "Extra configuration to be appended to awstats.\${name}.conf.";
       };
 
       webService = {
@@ -106,7 +106,7 @@ in
     configs = mkOption {
       type = types.attrsOf (types.submodule configOpts);
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         {
           "mysite" = {
             domain = "example.com";
diff --git a/nixos/modules/services/logging/fluentd.nix b/nixos/modules/services/logging/fluentd.nix
index 95825705d9d..dd19617a13f 100644
--- a/nixos/modules/services/logging/fluentd.nix
+++ b/nixos/modules/services/logging/fluentd.nix
@@ -27,7 +27,7 @@ in {
       package = mkOption {
         type = types.path;
         default = pkgs.fluentd;
-        defaultText = "pkgs.fluentd";
+        defaultText = literalExpression "pkgs.fluentd";
         description = "The fluentd package to use.";
       };
 
diff --git a/nixos/modules/services/logging/graylog.nix b/nixos/modules/services/logging/graylog.nix
index 5e20a10f249..e6a23233ba2 100644
--- a/nixos/modules/services/logging/graylog.nix
+++ b/nixos/modules/services/logging/graylog.nix
@@ -38,14 +38,13 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.graylog;
-        defaultText = "pkgs.graylog";
+        defaultText = literalExpression "pkgs.graylog";
         description = "Graylog package to use.";
       };
 
       user = mkOption {
         type = types.str;
         default = "graylog";
-        example = literalExample "graylog";
         description = "User account under which graylog runs";
       };
 
@@ -90,7 +89,7 @@ in
 
       elasticsearchHosts = mkOption {
         type = types.listOf types.str;
-        example = literalExample ''[ "http://node1:9200" "http://user:password@node2:19200" ]'';
+        example = literalExpression ''[ "http://node1:9200" "http://user:password@node2:19200" ]'';
         description = "List of valid URIs of the http ports of your elastic nodes. If one or more of your elasticsearch hosts require authentication, include the credentials in each node URI that requires authentication";
       };
 
diff --git a/nixos/modules/services/logging/journalbeat.nix b/nixos/modules/services/logging/journalbeat.nix
index 89f53b1b245..2d98598c1be 100644
--- a/nixos/modules/services/logging/journalbeat.nix
+++ b/nixos/modules/services/logging/journalbeat.nix
@@ -27,8 +27,8 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.journalbeat;
-        defaultText = "pkgs.journalbeat";
-        example = literalExample "pkgs.journalbeat7";
+        defaultText = literalExpression "pkgs.journalbeat";
+        example = literalExpression "pkgs.journalbeat7";
         description = ''
           The journalbeat package to use
         '';
diff --git a/nixos/modules/services/logging/logcheck.nix b/nixos/modules/services/logging/logcheck.nix
index 348ed8adf90..c8738b734f9 100644
--- a/nixos/modules/services/logging/logcheck.nix
+++ b/nixos/modules/services/logging/logcheck.nix
@@ -172,7 +172,7 @@ in
 
       extraRulesDirs = mkOption {
         default = [];
-        example = "/etc/logcheck";
+        example = [ "/etc/logcheck" ];
         type = types.listOf types.path;
         description = ''
           Directories with extra rules.
diff --git a/nixos/modules/services/logging/logrotate.nix b/nixos/modules/services/logging/logrotate.nix
index 7d6102b8255..624b6cfb121 100644
--- a/nixos/modules/services/logging/logrotate.nix
+++ b/nixos/modules/services/logging/logrotate.nix
@@ -111,7 +111,7 @@ in
           can be controlled by the <link linkend="opt-services.logrotate.paths._name_.priority">priority</link> option
           using the same semantics as `lib.mkOrder`. Smaller values have a greater priority.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           {
             httpd = {
               path = "/var/log/httpd/*.log";
diff --git a/nixos/modules/services/logging/logstash.nix b/nixos/modules/services/logging/logstash.nix
index 7a2f5681612..044d5330231 100644
--- a/nixos/modules/services/logging/logstash.nix
+++ b/nixos/modules/services/logging/logstash.nix
@@ -53,15 +53,14 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.logstash;
-        defaultText = "pkgs.logstash";
-        example = literalExample "pkgs.logstash";
+        defaultText = literalExpression "pkgs.logstash";
         description = "Logstash package to use.";
       };
 
       plugins = mkOption {
         type = types.listOf types.path;
         default = [ ];
-        example = literalExample "[ pkgs.logstash-contrib ]";
+        example = literalExpression "[ pkgs.logstash-contrib ]";
         description = "The paths to find other logstash plugins in.";
       };
 
@@ -102,12 +101,14 @@ in
         type = types.lines;
         default = "generator { }";
         description = "Logstash input configuration.";
-        example = ''
-          # Read from journal
-          pipe {
-            command => "''${pkgs.systemd}/bin/journalctl -f -o json"
-            type => "syslog" codec => json {}
-          }
+        example = literalExpression ''
+          '''
+            # Read from journal
+            pipe {
+              command => "''${pkgs.systemd}/bin/journalctl -f -o json"
+              type => "syslog" codec => json {}
+            }
+          '''
         '';
       };
 
diff --git a/nixos/modules/services/logging/syslog-ng.nix b/nixos/modules/services/logging/syslog-ng.nix
index 35055311680..0a57bf20bd0 100644
--- a/nixos/modules/services/logging/syslog-ng.nix
+++ b/nixos/modules/services/logging/syslog-ng.nix
@@ -43,7 +43,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.syslogng;
-        defaultText = "pkgs.syslogng";
+        defaultText = literalExpression "pkgs.syslogng";
         description = ''
           The package providing syslog-ng binaries.
         '';
@@ -51,7 +51,7 @@ in {
       extraModulePaths = mkOption {
         type = types.listOf types.str;
         default = [];
-        example = literalExample ''
+        example = literalExpression ''
           [ "''${pkgs.syslogng_incubator}/lib/syslog-ng" ]
         '';
         description = ''
diff --git a/nixos/modules/services/mail/davmail.nix b/nixos/modules/services/mail/davmail.nix
index 374a3dd75c1..e9f31e6fb39 100644
--- a/nixos/modules/services/mail/davmail.nix
+++ b/nixos/modules/services/mail/davmail.nix
@@ -42,7 +42,7 @@ in
           and <link xlink:href="http://davmail.sourceforge.net/advanced.html"/>
           for details on supported values.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           {
             davmail.allowRemote = true;
             davmail.imapPort = 55555;
diff --git a/nixos/modules/services/mail/dovecot.nix b/nixos/modules/services/mail/dovecot.nix
index f3500f46e35..223f3bef77d 100644
--- a/nixos/modules/services/mail/dovecot.nix
+++ b/nixos/modules/services/mail/dovecot.nix
@@ -289,7 +289,7 @@ in
     modules = mkOption {
       type = types.listOf types.package;
       default = [];
-      example = literalExample "[ pkgs.dovecot_pigeonhole ]";
+      example = literalExpression "[ pkgs.dovecot_pigeonhole ]";
       description = ''
         Symlinks the contents of lib/dovecot of every given package into
         /etc/dovecot/modules. This will make the given modules available
@@ -339,7 +339,7 @@ in
         (list: listToAttrs (map (entry: { name = entry.name; value = removeAttrs entry ["name"]; }) list))
         (attrsOf (submodule mailboxes));
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         {
           Spam = { specialUse = "Junk"; auto = "create"; };
         }
diff --git a/nixos/modules/services/mail/exim.nix b/nixos/modules/services/mail/exim.nix
index 25b533578c9..7356db2b6a6 100644
--- a/nixos/modules/services/mail/exim.nix
+++ b/nixos/modules/services/mail/exim.nix
@@ -1,7 +1,7 @@
 { config, lib, pkgs, ... }:
 
 let
-  inherit (lib) mkIf mkOption singleton types;
+  inherit (lib) literalExpression mkIf mkOption singleton types;
   inherit (pkgs) coreutils;
   cfg = config.services.exim;
 in
@@ -60,7 +60,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.exim;
-        defaultText = "pkgs.exim";
+        defaultText = literalExpression "pkgs.exim";
         description = ''
           The Exim derivation to use.
           This can be used to enable features such as LDAP or PAM support.
diff --git a/nixos/modules/services/mail/mailman.nix b/nixos/modules/services/mail/mailman.nix
index 831175d5625..0c9b38b44b2 100644
--- a/nixos/modules/services/mail/mailman.nix
+++ b/nixos/modules/services/mail/mailman.nix
@@ -87,8 +87,8 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.mailman;
-        defaultText = "pkgs.mailman";
-        example = literalExample "pkgs.mailman.override { archivers = []; }";
+        defaultText = literalExpression "pkgs.mailman";
+        example = literalExpression "pkgs.mailman.override { archivers = []; }";
         description = "Mailman package to use";
       };
 
diff --git a/nixos/modules/services/mail/offlineimap.nix b/nixos/modules/services/mail/offlineimap.nix
index 294e3806f94..45147758119 100644
--- a/nixos/modules/services/mail/offlineimap.nix
+++ b/nixos/modules/services/mail/offlineimap.nix
@@ -25,14 +25,14 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.offlineimap;
-      defaultText = "pkgs.offlineimap";
+      defaultText = literalExpression "pkgs.offlineimap";
       description = "Offlineimap derivation to use.";
     };
 
     path = mkOption {
       type = types.listOf types.path;
       default = [];
-      example = literalExample "[ pkgs.pass pkgs.bash pkgs.notmuch ]";
+      example = literalExpression "[ pkgs.pass pkgs.bash pkgs.notmuch ]";
       description = "List of derivations to put in Offlineimap's path.";
     };
 
diff --git a/nixos/modules/services/mail/opensmtpd.nix b/nixos/modules/services/mail/opensmtpd.nix
index ef7d53e7d92..7c1df2dda82 100644
--- a/nixos/modules/services/mail/opensmtpd.nix
+++ b/nixos/modules/services/mail/opensmtpd.nix
@@ -34,7 +34,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.opensmtpd;
-        defaultText = "pkgs.opensmtpd";
+        defaultText = literalExpression "pkgs.opensmtpd";
         description = "The OpenSMTPD package to use.";
       };
 
diff --git a/nixos/modules/services/mail/postfix.nix b/nixos/modules/services/mail/postfix.nix
index da18fae4ca7..1fc303ffc8b 100644
--- a/nixos/modules/services/mail/postfix.nix
+++ b/nixos/modules/services/mail/postfix.nix
@@ -505,6 +505,7 @@ in
       tlsTrustedAuthorities = mkOption {
         type = types.str;
         default = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
+        defaultText = literalExpression ''"''${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"'';
         description = ''
           File containing trusted certification authorities (CA) to verify certificates of mailservers contacted for mail delivery. This basically sets smtp_tls_CAfile and enables opportunistic tls. Defaults to NixOS trusted certification authorities.
         '';
diff --git a/nixos/modules/services/mail/roundcube.nix b/nixos/modules/services/mail/roundcube.nix
index f9b63000473..bf5abc7ba55 100644
--- a/nixos/modules/services/mail/roundcube.nix
+++ b/nixos/modules/services/mail/roundcube.nix
@@ -32,8 +32,9 @@ in
     package = mkOption {
       type = types.package;
       default = pkgs.roundcube;
+      defaultText = literalExpression "pkgs.roundcube";
 
-      example = literalExample ''
+      example = literalExpression ''
         roundcube.withPlugins (plugins: [ plugins.persistent_login ])
       '';
 
@@ -89,7 +90,7 @@ in
     dicts = mkOption {
       type = types.listOf types.package;
       default = [];
-      example = literalExample "with pkgs.aspellDicts; [ en fr de ]";
+      example = literalExpression "with pkgs.aspellDicts; [ en fr de ]";
       description = ''
         List of aspell dictionnaries for spell checking. If empty, spell checking is disabled.
       '';
diff --git a/nixos/modules/services/mail/rspamd.nix b/nixos/modules/services/mail/rspamd.nix
index c78f464235a..50208cbeb00 100644
--- a/nixos/modules/services/mail/rspamd.nix
+++ b/nixos/modules/services/mail/rspamd.nix
@@ -240,7 +240,7 @@ in
         description = ''
           Local configuration files, written into <filename>/etc/rspamd/local.d/{name}</filename>.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           { "redis.conf".source = "/nix/store/.../etc/dir/redis.conf";
             "arc.conf".text = "allow_envfrom_empty = true;";
           }
@@ -253,7 +253,7 @@ in
         description = ''
           Overridden configuration files, written into <filename>/etc/rspamd/override.d/{name}</filename>.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           { "redis.conf".source = "/nix/store/.../etc/dir/redis.conf";
             "arc.conf".text = "allow_envfrom_empty = true;";
           }
@@ -278,7 +278,7 @@ in
           normal = {};
           controller = {};
         };
-        example = literalExample ''
+        example = literalExpression ''
           {
             normal = {
               includes = [ "$CONFDIR/worker-normal.inc" ];
@@ -338,10 +338,6 @@ in
             smtpd_milters = ["unix:/run/rspamd/rspamd-milter.sock"];
             non_smtpd_milters = ["unix:/run/rspamd/rspamd-milter.sock"];
           };
-          example = {
-            smtpd_milters = ["unix:/run/rspamd/rspamd-milter.sock"];
-            non_smtpd_milters = ["unix:/run/rspamd/rspamd-milter.sock"];
-          };
         };
       };
     };
diff --git a/nixos/modules/services/mail/sympa.nix b/nixos/modules/services/mail/sympa.nix
index 491b6dba9aa..f3578bef96e 100644
--- a/nixos/modules/services/mail/sympa.nix
+++ b/nixos/modules/services/mail/sympa.nix
@@ -153,7 +153,7 @@ in
         Email domains handled by this instance. There have
         to be MX records for keys of this attribute set.
       '';
-      example = literalExample ''
+      example = literalExpression ''
         {
           "lists.example.org" = {
             webHost = "lists.example.org";
@@ -200,7 +200,7 @@ in
       name = mkOption {
         type = str;
         default = if cfg.database.type == "SQLite" then "${dataDir}/sympa.sqlite" else "sympa";
-        defaultText = ''if database.type == "SQLite" then "${dataDir}/sympa.sqlite" else "sympa"'';
+        defaultText = literalExpression ''if database.type == "SQLite" then "${dataDir}/sympa.sqlite" else "sympa"'';
         description = ''
           Database name. When using SQLite this must be an absolute
           path to the database file.
@@ -279,7 +279,7 @@ in
     settings = mkOption {
       type = attrsOf (oneOf [ str int bool ]);
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         {
           default_home = "lists";
           viewlogs_page_size = 50;
@@ -314,7 +314,7 @@ in
         config.source = mkIf (config.text != null) (mkDefault (pkgs.writeText "sympa-${baseNameOf name}" config.text));
       }));
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         {
           "list_data/lists.example.org/help" = {
             text = "subject This list provides help to users";
diff --git a/nixos/modules/services/misc/airsonic.nix b/nixos/modules/services/misc/airsonic.nix
index c1ce515750b..533a3d367a3 100644
--- a/nixos/modules/services/misc/airsonic.nix
+++ b/nixos/modules/services/misc/airsonic.nix
@@ -74,7 +74,7 @@ in {
       transcoders = mkOption {
         type = types.listOf types.path;
         default = [ "${pkgs.ffmpeg.bin}/bin/ffmpeg" ];
-        defaultText= [ "\${pkgs.ffmpeg.bin}/bin/ffmpeg" ];
+        defaultText = literalExpression ''[ "''${pkgs.ffmpeg.bin}/bin/ffmpeg" ]'';
         description = ''
           List of paths to transcoder executables that should be accessible
           from Airsonic. Symlinks will be created to each executable inside
@@ -85,7 +85,7 @@ in {
       jre = mkOption {
         type = types.package;
         default = pkgs.jre8;
-        defaultText = literalExample "pkgs.jre8";
+        defaultText = literalExpression "pkgs.jre8";
         description = ''
           JRE package to use.
 
@@ -97,7 +97,7 @@ in {
       war = mkOption {
         type = types.path;
         default = "${pkgs.airsonic}/webapps/airsonic.war";
-        defaultText = "\${pkgs.airsonic}/webapps/airsonic.war";
+        defaultText = literalExpression ''"''${pkgs.airsonic}/webapps/airsonic.war"'';
         description = "Airsonic war file to use.";
       };
 
diff --git a/nixos/modules/services/misc/ankisyncd.nix b/nixos/modules/services/misc/ankisyncd.nix
index 5fc19649d3d..69e471f4f57 100644
--- a/nixos/modules/services/misc/ankisyncd.nix
+++ b/nixos/modules/services/misc/ankisyncd.nix
@@ -33,7 +33,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.ankisyncd;
-        defaultText = literalExample "pkgs.ankisyncd";
+        defaultText = literalExpression "pkgs.ankisyncd";
         description = "The package to use for the ankisyncd command.";
       };
 
diff --git a/nixos/modules/services/misc/apache-kafka.nix b/nixos/modules/services/misc/apache-kafka.nix
index 8bc307311a4..d1856fff4aa 100644
--- a/nixos/modules/services/misc/apache-kafka.nix
+++ b/nixos/modules/services/misc/apache-kafka.nix
@@ -102,14 +102,14 @@ in {
     package = mkOption {
       description = "The kafka package to use";
       default = pkgs.apacheKafka;
-      defaultText = "pkgs.apacheKafka";
+      defaultText = literalExpression "pkgs.apacheKafka";
       type = types.package;
     };
 
     jre = mkOption {
       description = "The JRE with which to run Kafka";
       default = cfg.package.passthru.jre;
-      defaultText = "pkgs.apacheKafka.passthru.jre";
+      defaultText = literalExpression "pkgs.apacheKafka.passthru.jre";
       type = types.package;
     };
 
diff --git a/nixos/modules/services/misc/autofs.nix b/nixos/modules/services/misc/autofs.nix
index 541f0d2db19..5fce990afec 100644
--- a/nixos/modules/services/misc/autofs.nix
+++ b/nixos/modules/services/misc/autofs.nix
@@ -29,7 +29,7 @@ in
 
       autoMaster = mkOption {
         type = types.str;
-        example = literalExample ''
+        example = literalExpression ''
           let
             mapConf = pkgs.writeText "auto" '''
              kernel    -ro,soft,intr       ftp.kernel.org:/pub/linux
diff --git a/nixos/modules/services/misc/bees.nix b/nixos/modules/services/misc/bees.nix
index 6b8cae84642..cb97a86b859 100644
--- a/nixos/modules/services/misc/bees.nix
+++ b/nixos/modules/services/misc/bees.nix
@@ -61,7 +61,7 @@ let
       description = ''
         Extra command-line options passed to the daemon. See upstream bees documentation.
       '';
-      example = literalExample ''
+      example = literalExpression ''
         [ "--thread-count" "4" ]
       '';
     };
@@ -75,7 +75,7 @@ in
       type = with types; attrsOf (submodule fsOptions);
       description = "BTRFS filesystems to run block-level deduplication on.";
       default = { };
-      example = literalExample ''
+      example = literalExpression ''
         {
           root = {
             spec = "LABEL=root";
diff --git a/nixos/modules/services/misc/cgminer.nix b/nixos/modules/services/misc/cgminer.nix
index 5afc1546efa..60f75530723 100644
--- a/nixos/modules/services/misc/cgminer.nix
+++ b/nixos/modules/services/misc/cgminer.nix
@@ -35,7 +35,7 @@ in
 
       package = mkOption {
         default = pkgs.cgminer;
-        defaultText = "pkgs.cgminer";
+        defaultText = literalExpression "pkgs.cgminer";
         description = "Which cgminer derivation to use.";
         type = types.package;
       };
diff --git a/nixos/modules/services/misc/clipcat.nix b/nixos/modules/services/misc/clipcat.nix
index 128bb9a89d6..8b749aa7289 100644
--- a/nixos/modules/services/misc/clipcat.nix
+++ b/nixos/modules/services/misc/clipcat.nix
@@ -12,7 +12,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.clipcat;
-      defaultText = "pkgs.clipcat";
+      defaultText = literalExpression "pkgs.clipcat";
       description = "clipcat derivation to use.";
     };
   };
diff --git a/nixos/modules/services/misc/clipmenu.nix b/nixos/modules/services/misc/clipmenu.nix
index 3ba050044ca..ef95985f8d8 100644
--- a/nixos/modules/services/misc/clipmenu.nix
+++ b/nixos/modules/services/misc/clipmenu.nix
@@ -12,7 +12,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.clipmenu;
-      defaultText = "pkgs.clipmenu";
+      defaultText = literalExpression "pkgs.clipmenu";
       description = "clipmenu derivation to use.";
     };
   };
diff --git a/nixos/modules/services/misc/confd.nix b/nixos/modules/services/misc/confd.nix
index c1ebdb3dde9..6c66786524b 100755
--- a/nixos/modules/services/misc/confd.nix
+++ b/nixos/modules/services/misc/confd.nix
@@ -64,7 +64,7 @@ in {
     package = mkOption {
       description = "Confd package to use.";
       default = pkgs.confd;
-      defaultText = "pkgs.confd";
+      defaultText = literalExpression "pkgs.confd";
       type = types.package;
     };
   };
diff --git a/nixos/modules/services/misc/dictd.nix b/nixos/modules/services/misc/dictd.nix
index 6e796a3a1fc..96e2a4e7c26 100644
--- a/nixos/modules/services/misc/dictd.nix
+++ b/nixos/modules/services/misc/dictd.nix
@@ -25,8 +25,8 @@ in
       DBs = mkOption {
         type = types.listOf types.package;
         default = with pkgs.dictdDBs; [ wiktionary wordnet ];
-        defaultText = "with pkgs.dictdDBs; [ wiktionary wordnet ]";
-        example = literalExample "[ pkgs.dictdDBs.nld2eng ]";
+        defaultText = literalExpression "with pkgs.dictdDBs; [ wiktionary wordnet ]";
+        example = literalExpression "[ 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 24a259bb4d2..07c0613336a 100644
--- a/nixos/modules/services/misc/disnix.nix
+++ b/nixos/modules/services/misc/disnix.nix
@@ -31,7 +31,7 @@ in
         type = types.path;
         description = "The Disnix package";
         default = pkgs.disnix;
-        defaultText = "pkgs.disnix";
+        defaultText = literalExpression "pkgs.disnix";
       };
 
       enableProfilePath = mkEnableOption "exposing the Disnix profiles in the system's PATH";
@@ -39,7 +39,6 @@ in
       profiles = mkOption {
         type = types.listOf types.str;
         default = [ "default" ];
-        example = [ "default" ];
         description = "Names of the Disnix profiles to expose in the system's PATH";
       };
     };
diff --git a/nixos/modules/services/misc/dwm-status.nix b/nixos/modules/services/misc/dwm-status.nix
index b98a42e6a6d..5f591b3c5d4 100644
--- a/nixos/modules/services/misc/dwm-status.nix
+++ b/nixos/modules/services/misc/dwm-status.nix
@@ -27,8 +27,8 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.dwm-status;
-        defaultText = "pkgs.dwm-status";
-        example = "pkgs.dwm-status.override { enableAlsaUtils = false; }";
+        defaultText = literalExpression "pkgs.dwm-status";
+        example = literalExpression "pkgs.dwm-status.override { enableAlsaUtils = false; }";
         description = ''
           Which dwm-status package to use.
         '';
diff --git a/nixos/modules/services/misc/etcd.nix b/nixos/modules/services/misc/etcd.nix
index 2b667fab6b0..c4ea091a038 100644
--- a/nixos/modules/services/misc/etcd.nix
+++ b/nixos/modules/services/misc/etcd.nix
@@ -123,7 +123,7 @@ in {
       '';
       type = types.attrsOf types.str;
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         {
           "CORS" = "*";
           "NAME" = "default-name";
diff --git a/nixos/modules/services/misc/etebase-server.nix b/nixos/modules/services/misc/etebase-server.nix
index b6bd6e9fd37..dd84ac37b0d 100644
--- a/nixos/modules/services/misc/etebase-server.nix
+++ b/nixos/modules/services/misc/etebase-server.nix
@@ -97,13 +97,13 @@ in
               static_root = mkOption {
                 type = types.str;
                 default = "${cfg.dataDir}/static";
-                defaultText = "\${config.services.etebase-server.dataDir}/static";
+                defaultText = literalExpression ''"''${config.services.etebase-server.dataDir}/static"'';
                 description = "The directory for static files.";
               };
               media_root = mkOption {
                 type = types.str;
                 default = "${cfg.dataDir}/media";
-                defaultText = "\${config.services.etebase-server.dataDir}/media";
+                defaultText = literalExpression ''"''${config.services.etebase-server.dataDir}/media"'';
                 description = "The media directory.";
               };
             };
@@ -126,7 +126,7 @@ in
               name = mkOption {
                 type = types.str;
                 default = "${cfg.dataDir}/db.sqlite3";
-                defaultText = "\${config.services.etebase-server.dataDir}/db.sqlite3";
+                defaultText = literalExpression ''"''${config.services.etebase-server.dataDir}/db.sqlite3"'';
                 description = "The database name.";
               };
             };
diff --git a/nixos/modules/services/misc/felix.nix b/nixos/modules/services/misc/felix.nix
index 8d438bb9eb1..0283de128af 100644
--- a/nixos/modules/services/misc/felix.nix
+++ b/nixos/modules/services/misc/felix.nix
@@ -22,7 +22,7 @@ in
       bundles = mkOption {
         type = types.listOf types.package;
         default = [ pkgs.felix_remoteshell ];
-        defaultText = "[ pkgs.felix_remoteshell ]";
+        defaultText = literalExpression "[ pkgs.felix_remoteshell ]";
         description = "List of bundles that should be activated on startup";
       };
 
diff --git a/nixos/modules/services/misc/freeswitch.nix b/nixos/modules/services/misc/freeswitch.nix
index b42f36e8663..472b0b73ff6 100644
--- a/nixos/modules/services/misc/freeswitch.nix
+++ b/nixos/modules/services/misc/freeswitch.nix
@@ -32,8 +32,8 @@ in {
       configTemplate = mkOption {
         type = types.path;
         default = "${config.services.freeswitch.package}/share/freeswitch/conf/vanilla";
-        defaultText = literalExample "\${config.services.freeswitch.package}/share/freeswitch/conf/vanilla";
-        example = literalExample "\${config.services.freeswitch.package}/share/freeswitch/conf/minimal";
+        defaultText = literalExpression ''"''${config.services.freeswitch.package}/share/freeswitch/conf/vanilla"'';
+        example = literalExpression ''"''${config.services.freeswitch.package}/share/freeswitch/conf/minimal"'';
         description = ''
           Configuration template to use.
           See available templates in <link xlink:href="https://github.com/signalwire/freeswitch/tree/master/conf">FreeSWITCH repository</link>.
@@ -43,7 +43,7 @@ in {
       configDir = mkOption {
         type = with types; attrsOf path;
         default = { };
-        example = literalExample ''
+        example = literalExpression ''
           {
             "freeswitch.xml" = ./freeswitch.xml;
             "dialplan/default.xml" = pkgs.writeText "dialplan-default.xml" '''
@@ -61,8 +61,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.freeswitch;
-        defaultText = literalExample "pkgs.freeswitch";
-        example = literalExample "pkgs.freeswitch";
+        defaultText = literalExpression "pkgs.freeswitch";
         description = ''
           FreeSWITCH package.
         '';
diff --git a/nixos/modules/services/misc/gitea.nix b/nixos/modules/services/misc/gitea.nix
index 753cb870e7d..afddc18aa04 100644
--- a/nixos/modules/services/misc/gitea.nix
+++ b/nixos/modules/services/misc/gitea.nix
@@ -32,7 +32,7 @@ in
       package = mkOption {
         default = pkgs.gitea;
         type = types.package;
-        defaultText = "pkgs.gitea";
+        defaultText = literalExpression "pkgs.gitea";
         description = "gitea derivation to use";
       };
 
@@ -122,7 +122,7 @@ in
         socket = mkOption {
           type = types.nullOr types.path;
           default = if (cfg.database.createDatabase && usePostgresql) then "/run/postgresql" else if (cfg.database.createDatabase && useMysql) then "/run/mysqld/mysqld.sock" else null;
-          defaultText = "null";
+          defaultText = literalExpression "null";
           example = "/run/mysqld/mysqld.sock";
           description = "Path to the unix socket file to use for authentication.";
         };
@@ -255,8 +255,9 @@ in
       };
 
       staticRootPath = mkOption {
-        type = types.str;
-        default = "${gitea.data}";
+        type = types.either types.str types.path;
+        default = gitea.data;
+        defaultText = literalExpression "package.data";
         example = "/var/lib/gitea/data";
         description = "Upper level of template and static files path.";
       };
@@ -287,7 +288,7 @@ in
           Gitea configuration. Refer to <link xlink:href="https://docs.gitea.io/en-us/config-cheat-sheet/"/>
           for details on supported values.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           {
             "cron.sync_external_users" = {
               RUN_AT_START = true;
diff --git a/nixos/modules/services/misc/gitit.nix b/nixos/modules/services/misc/gitit.nix
index f09565283f3..ceb186c0f04 100644
--- a/nixos/modules/services/misc/gitit.nix
+++ b/nixos/modules/services/misc/gitit.nix
@@ -36,15 +36,15 @@ let
 
       haskellPackages = mkOption {
         default = pkgs.haskellPackages;
-        defaultText = "pkgs.haskellPackages";
-        example = literalExample "pkgs.haskell.packages.ghc784";
+        defaultText = literalExpression "pkgs.haskellPackages";
+        example = literalExpression "pkgs.haskell.packages.ghc784";
         description = "haskellPackages used to build gitit and plugins.";
       };
 
       extraPackages = mkOption {
         type = types.functionTo (types.listOf types.package);
         default = self: [];
-        example = literalExample ''
+        example = literalExpression ''
           haskellPackages: [
             haskellPackages.wreq
           ]
@@ -665,9 +665,9 @@ in
       wantedBy = [ "multi-user.target" ];
       path = with pkgs; [ curl ]
              ++ optional cfg.pdfExport texlive.combined.scheme-basic
-	     ++ optional (cfg.repositoryType == "darcs") darcs
-	     ++ optional (cfg.repositoryType == "mercurial") mercurial
-	     ++ optional (cfg.repositoryType == "git") git;
+             ++ optional (cfg.repositoryType == "darcs") darcs
+             ++ optional (cfg.repositoryType == "mercurial") mercurial
+             ++ optional (cfg.repositoryType == "git") git;
 
       preStart = let
         gm = "gitit@${config.networking.hostName}";
@@ -684,35 +684,35 @@ in
           fi
         done
         cd ${repositoryPath}
-	${
-	  if repositoryType == "darcs" then
-	  ''
-	  if [ ! -d _darcs ]
-	  then
-	    ${pkgs.darcs}/bin/darcs initialize
-	    echo "${gm}" > _darcs/prefs/email
-	  ''
-	  else if repositoryType == "mercurial" then
-	  ''
-	  if [ ! -d .hg ]
-	  then
-	    ${pkgs.mercurial}/bin/hg init
-	    cat >> .hg/hgrc <<NAMED
+        ${
+          if repositoryType == "darcs" then
+          ''
+          if [ ! -d _darcs ]
+          then
+            ${pkgs.darcs}/bin/darcs initialize
+            echo "${gm}" > _darcs/prefs/email
+          ''
+          else if repositoryType == "mercurial" then
+          ''
+          if [ ! -d .hg ]
+          then
+            ${pkgs.mercurial}/bin/hg init
+            cat >> .hg/hgrc <<NAMED
 [ui]
 username = gitit ${gm}
 NAMED
-	  ''
-	  else
-	  ''
-	  if [ ! -d  .git ]
+          ''
+          else
+          ''
+          if [ ! -d  .git ]
           then
             ${pkgs.git}/bin/git init
             ${pkgs.git}/bin/git config user.email "${gm}"
             ${pkgs.git}/bin/git config user.name "gitit"
-	  ''}
+          ''}
           chown ${uid}:${gid} -R ${repositoryPath}
           fi
-	cd -
+        cd -
       '';
 
       serviceConfig = {
diff --git a/nixos/modules/services/misc/gitlab.nix b/nixos/modules/services/misc/gitlab.nix
index c1a1491b3ce..b2abe70627d 100644
--- a/nixos/modules/services/misc/gitlab.nix
+++ b/nixos/modules/services/misc/gitlab.nix
@@ -239,36 +239,36 @@ in {
       packages.gitlab = mkOption {
         type = types.package;
         default = pkgs.gitlab;
-        defaultText = "pkgs.gitlab";
+        defaultText = literalExpression "pkgs.gitlab";
         description = "Reference to the gitlab package";
-        example = "pkgs.gitlab-ee";
+        example = literalExpression "pkgs.gitlab-ee";
       };
 
       packages.gitlab-shell = mkOption {
         type = types.package;
         default = pkgs.gitlab-shell;
-        defaultText = "pkgs.gitlab-shell";
+        defaultText = literalExpression "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";
+        defaultText = literalExpression "pkgs.gitlab-workhorse";
         description = "Reference to the gitlab-workhorse package";
       };
 
       packages.gitaly = mkOption {
         type = types.package;
         default = pkgs.gitaly;
-        defaultText = "pkgs.gitaly";
+        defaultText = literalExpression "pkgs.gitaly";
         description = "Reference to the gitaly package";
       };
 
       packages.pages = mkOption {
         type = types.package;
         default = pkgs.gitlab-pages;
-        defaultText = "pkgs.gitlab-pages";
+        defaultText = literalExpression "pkgs.gitlab-pages";
         description = "Reference to the gitlab-pages package";
       };
 
@@ -356,7 +356,7 @@ in {
       backup.uploadOptions = mkOption {
         type = types.attrs;
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           {
             # Fog storage connection settings, see http://fog.io/storage/
             connection = {
@@ -543,12 +543,10 @@ in {
         };
         certFile = mkOption {
           type = types.path;
-          default = null;
           description = "Path to GitLab container registry certificate.";
         };
         keyFile = mkOption {
           type = types.path;
-          default = null;
           description = "Path to GitLab container registry certificate-key.";
         };
         defaultForProjects = mkOption {
@@ -858,7 +856,7 @@ in {
       extraConfig = mkOption {
         type = types.attrs;
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           {
             gitlab = {
               default_projects_features = {
diff --git a/nixos/modules/services/misc/gitolite.nix b/nixos/modules/services/misc/gitolite.nix
index 190ea9212d2..810ef1f21b9 100644
--- a/nixos/modules/services/misc/gitolite.nix
+++ b/nixos/modules/services/misc/gitolite.nix
@@ -64,11 +64,13 @@ in
       extraGitoliteRc = mkOption {
         type = types.lines;
         default = "";
-        example = literalExample ''
-          $RC{UMASK} = 0027;
-          $RC{SITE_INFO} = 'This is our private repository host';
-          push( @{$RC{ENABLE}}, 'Kindergarten' ); # enable the command/feature
-          @{$RC{ENABLE}} = grep { $_ ne 'desc' } @{$RC{ENABLE}}; # disable the command/feature
+        example = literalExpression ''
+          '''
+            $RC{UMASK} = 0027;
+            $RC{SITE_INFO} = 'This is our private repository host';
+            push( @{$RC{ENABLE}}, 'Kindergarten' ); # enable the command/feature
+            @{$RC{ENABLE}} = grep { $_ ne 'desc' } @{$RC{ENABLE}}; # disable the command/feature
+          '''
         '';
         description = ''
           Extra configuration to append to the default <literal>~/.gitolite.rc</literal>.
diff --git a/nixos/modules/services/misc/greenclip.nix b/nixos/modules/services/misc/greenclip.nix
index 9152a782d7f..32e8d746cb5 100644
--- a/nixos/modules/services/misc/greenclip.nix
+++ b/nixos/modules/services/misc/greenclip.nix
@@ -12,7 +12,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.haskellPackages.greenclip;
-      defaultText = "pkgs.haskellPackages.greenclip";
+      defaultText = literalExpression "pkgs.haskellPackages.greenclip";
       description = "greenclip derivation to use.";
     };
   };
diff --git a/nixos/modules/services/misc/home-assistant.nix b/nixos/modules/services/misc/home-assistant.nix
index 800bea4ff57..8279d075baf 100644
--- a/nixos/modules/services/misc/home-assistant.nix
+++ b/nixos/modules/services/misc/home-assistant.nix
@@ -112,7 +112,7 @@ in {
             emptyValue.value = {};
           };
         in valueType;
-      example = literalExample ''
+      example = literalExpression ''
         {
           homeassistant = {
             name = "Home";
@@ -152,7 +152,7 @@ in {
       default = null;
       type = with types; nullOr attrs;
       # from https://www.home-assistant.io/lovelace/yaml-mode/
-      example = literalExample ''
+      example = literalExpression ''
         {
           title = "My Awesome Home";
           views = [ {
@@ -188,13 +188,13 @@ in {
       default = pkgs.home-assistant.overrideAttrs (oldAttrs: {
         doInstallCheck = false;
       });
-      defaultText = literalExample ''
+      defaultText = literalExpression ''
         pkgs.home-assistant.overrideAttrs (oldAttrs: {
           doInstallCheck = false;
         })
       '';
       type = types.package;
-      example = literalExample ''
+      example = literalExpression ''
         pkgs.home-assistant.override {
           extraPackages = ps: with ps; [ colorlog ];
         }
diff --git a/nixos/modules/services/misc/ihaskell.nix b/nixos/modules/services/misc/ihaskell.nix
index c7332b87803..9978e8a4653 100644
--- a/nixos/modules/services/misc/ihaskell.nix
+++ b/nixos/modules/services/misc/ihaskell.nix
@@ -6,7 +6,7 @@ let
 
   cfg = config.services.ihaskell;
   ihaskell = pkgs.ihaskell.override {
-    packages = self: cfg.extraPackages self;
+    packages = cfg.extraPackages;
   };
 
 in
@@ -22,8 +22,9 @@ in
 
       extraPackages = mkOption {
         type = types.functionTo (types.listOf types.package);
-        default = self: [];
-        example = literalExample ''
+        default = haskellPackages: [];
+        defaultText = literalExpression "haskellPackages: []";
+        example = literalExpression ''
           haskellPackages: [
             haskellPackages.wreq
             haskellPackages.lens
diff --git a/nixos/modules/services/misc/jackett.nix b/nixos/modules/services/misc/jackett.nix
index f2dc6635df9..c2144d4a9a9 100644
--- a/nixos/modules/services/misc/jackett.nix
+++ b/nixos/modules/services/misc/jackett.nix
@@ -38,7 +38,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.jackett;
-        defaultText = "pkgs.jackett";
+        defaultText = literalExpression "pkgs.jackett";
         description = "Jackett package to use.";
       };
     };
diff --git a/nixos/modules/services/misc/jellyfin.nix b/nixos/modules/services/misc/jellyfin.nix
index 6d64acc0291..b9d54f27edc 100644
--- a/nixos/modules/services/misc/jellyfin.nix
+++ b/nixos/modules/services/misc/jellyfin.nix
@@ -19,7 +19,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.jellyfin;
-        example = literalExample "pkgs.jellyfin";
+        defaultText = literalExpression "pkgs.jellyfin";
         description = ''
           Jellyfin package to use.
         '';
diff --git a/nixos/modules/services/misc/klipper.nix b/nixos/modules/services/misc/klipper.nix
index e6b9dd234a9..7b3780b5cc9 100644
--- a/nixos/modules/services/misc/klipper.nix
+++ b/nixos/modules/services/misc/klipper.nix
@@ -19,6 +19,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.klipper;
+        defaultText = literalExpression "pkgs.klipper";
         description = "The Klipper package.";
       };
 
diff --git a/nixos/modules/services/misc/lidarr.nix b/nixos/modules/services/misc/lidarr.nix
index 8ff1adadcf2..20153c7e61a 100644
--- a/nixos/modules/services/misc/lidarr.nix
+++ b/nixos/modules/services/misc/lidarr.nix
@@ -19,7 +19,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.lidarr;
-        defaultText = "pkgs.lidarr";
+        defaultText = literalExpression "pkgs.lidarr";
         description = "The Lidarr package to use";
       };
 
diff --git a/nixos/modules/services/misc/matrix-appservice-discord.nix b/nixos/modules/services/misc/matrix-appservice-discord.nix
index 71d1227f4ff..c448614eca3 100644
--- a/nixos/modules/services/misc/matrix-appservice-discord.nix
+++ b/nixos/modules/services/misc/matrix-appservice-discord.nix
@@ -31,7 +31,7 @@ in {
             botToken = "";
           };
         };
-        example = literalExample ''
+        example = literalExpression ''
           {
             bridge = {
               domain = "public-domain.tld";
diff --git a/nixos/modules/services/misc/matrix-synapse.nix b/nixos/modules/services/misc/matrix-synapse.nix
index e150a1aaaad..437bd05fdc2 100644
--- a/nixos/modules/services/misc/matrix-synapse.nix
+++ b/nixos/modules/services/misc/matrix-synapse.nix
@@ -125,7 +125,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.matrix-synapse;
-        defaultText = "pkgs.matrix-synapse";
+        defaultText = literalExpression "pkgs.matrix-synapse";
         description = ''
           Overridable attribute of the matrix synapse server package to use.
         '';
@@ -133,7 +133,7 @@ in {
       plugins = mkOption {
         type = types.listOf types.package;
         default = [ ];
-        example = literalExample ''
+        example = literalExpression ''
           with config.services.matrix-synapse.package.plugins; [
             matrix-synapse-ldap3
             matrix-synapse-pam
diff --git a/nixos/modules/services/misc/mautrix-telegram.nix b/nixos/modules/services/misc/mautrix-telegram.nix
index 717cf7936ea..59d0b682409 100644
--- a/nixos/modules/services/misc/mautrix-telegram.nix
+++ b/nixos/modules/services/misc/mautrix-telegram.nix
@@ -60,7 +60,7 @@ in {
             };
           };
         };
-        example = literalExample ''
+        example = literalExpression ''
           {
             homeserver = {
               address = "http://localhost:8008";
diff --git a/nixos/modules/services/misc/mbpfan.nix b/nixos/modules/services/misc/mbpfan.nix
index e22d1ed61f9..d80b6fafc2c 100644
--- a/nixos/modules/services/misc/mbpfan.nix
+++ b/nixos/modules/services/misc/mbpfan.nix
@@ -13,7 +13,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.mbpfan;
-      defaultText = "pkgs.mbpfan";
+      defaultText = literalExpression "pkgs.mbpfan";
       description = ''
         The package used for the mbpfan daemon.
       '';
diff --git a/nixos/modules/services/misc/mediatomb.nix b/nixos/modules/services/misc/mediatomb.nix
index a19b73889ce..383090575b2 100644
--- a/nixos/modules/services/misc/mediatomb.nix
+++ b/nixos/modules/services/misc/mediatomb.nix
@@ -216,10 +216,11 @@ in {
 
       package = mkOption {
         type = types.package;
-        example = literalExample "pkgs.mediatomb";
+        example = literalExpression "pkgs.mediatomb";
         default = pkgs.gerbera;
+        defaultText = literalExpression "pkgs.gerbera";
         description = ''
-          Underlying package to be used with the module (default: pkgs.gerbera).
+          Underlying package to be used with the module.
         '';
       };
 
@@ -325,7 +326,7 @@ in {
 
       mediaDirectories = mkOption {
         type = with types; listOf (submodule mediaDirectory);
-        default = {};
+        default = [];
         description = ''
           Declare media directories to index.
         '';
diff --git a/nixos/modules/services/misc/mx-puppet-discord.nix b/nixos/modules/services/misc/mx-puppet-discord.nix
index 11116f7c348..c34803f9722 100644
--- a/nixos/modules/services/misc/mx-puppet-discord.nix
+++ b/nixos/modules/services/misc/mx-puppet-discord.nix
@@ -45,7 +45,7 @@ in {
             lineDateFormat = "MMM-D HH:mm:ss.SSS";
           };
         };
-        example = literalExample ''
+        example = literalExpression ''
           {
             bridge = {
               bindAddress = "localhost";
diff --git a/nixos/modules/services/misc/nitter.nix b/nixos/modules/services/misc/nitter.nix
index 301af76c336..0c562343d85 100644
--- a/nixos/modules/services/misc/nitter.nix
+++ b/nixos/modules/services/misc/nitter.nix
@@ -79,7 +79,7 @@ in
         staticDir = mkOption {
           type = types.path;
           default = "${pkgs.nitter}/share/nitter/public";
-          defaultText = "\${pkgs.nitter}/share/nitter/public";
+          defaultText = literalExpression ''"''${pkgs.nitter}/share/nitter/public"'';
           description = "Path to the static files directory.";
         };
 
diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix
index 70b27b7d3d0..789d0355b05 100644
--- a/nixos/modules/services/misc/nix-daemon.nix
+++ b/nixos/modules/services/misc/nix-daemon.nix
@@ -85,7 +85,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.nix;
-        defaultText = "pkgs.nix";
+        defaultText = literalExpression "pkgs.nix";
         description = ''
           This option specifies the Nix package instance to use throughout the system.
         '';
@@ -460,7 +460,7 @@ in
               flake = mkOption {
                 type = types.nullOr types.attrs;
                 default = null;
-                example = literalExample "nixpkgs";
+                example = literalExpression "nixpkgs";
                 description = ''
                   The flake input to which <option>from></option> is to be rewritten.
                 '';
diff --git a/nixos/modules/services/misc/nzbhydra2.nix b/nixos/modules/services/misc/nzbhydra2.nix
index c396b4b8f6e..500c40f117d 100644
--- a/nixos/modules/services/misc/nzbhydra2.nix
+++ b/nixos/modules/services/misc/nzbhydra2.nix
@@ -25,7 +25,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.nzbhydra2;
-        defaultText = "pkgs.nzbhydra2";
+        defaultText = literalExpression "pkgs.nzbhydra2";
         description = "NZBHydra2 package to use.";
       };
     };
diff --git a/nixos/modules/services/misc/octoprint.nix b/nixos/modules/services/misc/octoprint.nix
index 7129ac69527..cd846d3f268 100644
--- a/nixos/modules/services/misc/octoprint.nix
+++ b/nixos/modules/services/misc/octoprint.nix
@@ -68,8 +68,8 @@ in
       plugins = mkOption {
         type = types.functionTo (types.listOf types.package);
         default = plugins: [];
-        defaultText = "plugins: []";
-        example = literalExample "plugins: with plugins; [ themeify stlviewer ]";
+        defaultText = literalExpression "plugins: []";
+        example = literalExpression "plugins: with plugins; [ themeify stlviewer ]";
         description = "Additional plugins to be used. Available plugins are passed through the plugins input.";
       };
 
diff --git a/nixos/modules/services/misc/paperless-ng.nix b/nixos/modules/services/misc/paperless-ng.nix
index 4b7087e17f9..db8082f072c 100644
--- a/nixos/modules/services/misc/paperless-ng.nix
+++ b/nixos/modules/services/misc/paperless-ng.nix
@@ -107,14 +107,14 @@ in
     mediaDir = mkOption {
       type = types.str;
       default = "${cfg.dataDir}/media";
-      defaultText = "\${dataDir}/consume";
+      defaultText = literalExpression ''"''${dataDir}/media"'';
       description = "Directory to store the Paperless documents.";
     };
 
     consumptionDir = mkOption {
       type = types.str;
       default = "${cfg.dataDir}/consume";
-      defaultText = "\${dataDir}/consume";
+      defaultText = literalExpression ''"''${dataDir}/consume"'';
       description = "Directory from which new documents are imported.";
     };
 
@@ -167,7 +167,7 @@ in
         See <link xlink:href="https://paperless-ng.readthedocs.io/en/latest/configuration.html">the documentation</link>
         for available options.
       '';
-      example = literalExample ''
+      example = literalExpression ''
         {
           PAPERLESS_OCR_LANGUAGE = "deu+eng";
         }
@@ -183,7 +183,7 @@ in
     package = mkOption {
       type = types.package;
       default = pkgs.paperless-ng;
-      defaultText = "pkgs.paperless-ng";
+      defaultText = literalExpression "pkgs.paperless-ng";
       description = "The Paperless package to use.";
     };
   };
diff --git a/nixos/modules/services/misc/plex.nix b/nixos/modules/services/misc/plex.nix
index 7efadf1b9bb..5f99ee866a5 100644
--- a/nixos/modules/services/misc/plex.nix
+++ b/nixos/modules/services/misc/plex.nix
@@ -68,7 +68,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.plex;
-        defaultText = "pkgs.plex";
+        defaultText = literalExpression "pkgs.plex";
         description = ''
           The Plex package to use. Plex subscribers may wish to use their own
           package here, pointing to subscriber-only server versions.
diff --git a/nixos/modules/services/misc/redmine.nix b/nixos/modules/services/misc/redmine.nix
index 66c8e558fb0..696b8d1a25d 100644
--- a/nixos/modules/services/misc/redmine.nix
+++ b/nixos/modules/services/misc/redmine.nix
@@ -2,7 +2,7 @@
 
 let
   inherit (lib) mkBefore mkDefault mkEnableOption mkIf mkOption mkRemovedOptionModule types;
-  inherit (lib) concatStringsSep literalExample mapAttrsToList;
+  inherit (lib) concatStringsSep literalExpression mapAttrsToList;
   inherit (lib) optional optionalAttrs optionalString;
 
   cfg = config.services.redmine;
@@ -54,8 +54,9 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.redmine;
+        defaultText = literalExpression "pkgs.redmine";
         description = "Which Redmine package to use.";
-        example = "pkgs.redmine.override { ruby = pkgs.ruby_2_7; }";
+        example = literalExpression "pkgs.redmine.override { ruby = pkgs.ruby_2_7; }";
       };
 
       user = mkOption {
@@ -90,7 +91,7 @@ in
           <link xlink:href="https://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration"/>
           for details.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           {
             email_delivery = {
               delivery_method = "smtp";
@@ -112,7 +113,7 @@ in
           See <link xlink:href="https://svn.redmine.org/redmine/trunk/config/additional_environment.rb.example"/>
           for details.
         '';
-        example = literalExample ''
+        example = ''
           config.logger.level = Logger::DEBUG
         '';
       };
@@ -121,7 +122,7 @@ in
         type = types.attrsOf types.path;
         default = {};
         description = "Set of themes.";
-        example = literalExample ''
+        example = literalExpression ''
           {
             dkuk-redmine_alex_skin = builtins.fetchurl {
               url = "https://bitbucket.org/dkuk/redmine_alex_skin/get/1842ef675ef3.zip";
@@ -135,7 +136,7 @@ in
         type = types.attrsOf types.path;
         default = {};
         description = "Set of plugins.";
-        example = literalExample ''
+        example = literalExpression ''
           {
             redmine_env_auth = builtins.fetchurl {
               url = "https://github.com/Intera/redmine_env_auth/archive/0.6.zip";
@@ -162,7 +163,7 @@ in
         port = mkOption {
           type = types.int;
           default = if cfg.database.type == "postgresql" then 5432 else 3306;
-          defaultText = "3306";
+          defaultText = literalExpression "3306";
           description = "Database host port.";
         };
 
@@ -194,7 +195,7 @@ in
             if mysqlLocal then "/run/mysqld/mysqld.sock"
             else if pgsqlLocal then "/run/postgresql"
             else null;
-          defaultText = "/run/mysqld/mysqld.sock";
+          defaultText = literalExpression "/run/mysqld/mysqld.sock";
           example = "/run/mysqld/mysqld.sock";
           description = "Path to the unix socket file to use for authentication.";
         };
diff --git a/nixos/modules/services/misc/rippled.nix b/nixos/modules/services/misc/rippled.nix
index 8cdfe0875d8..9c66df2fce1 100644
--- a/nixos/modules/services/misc/rippled.nix
+++ b/nixos/modules/services/misc/rippled.nix
@@ -210,7 +210,7 @@ in
         description = "Which rippled package to use.";
         type = types.package;
         default = pkgs.rippled;
-        defaultText = "pkgs.rippled";
+        defaultText = literalExpression "pkgs.rippled";
       };
 
       ports = mkOption {
diff --git a/nixos/modules/services/misc/sickbeard.nix b/nixos/modules/services/misc/sickbeard.nix
index a32dbfa3108..f560f838e49 100644
--- a/nixos/modules/services/misc/sickbeard.nix
+++ b/nixos/modules/services/misc/sickbeard.nix
@@ -24,7 +24,8 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.sickbeard;
-        example = literalExample "pkgs.sickrage";
+        defaultText = literalExpression "pkgs.sickbeard";
+        example = literalExpression "pkgs.sickrage";
         description =''
           Enable <literal>pkgs.sickrage</literal> or <literal>pkgs.sickgear</literal>
           as an alternative to SickBeard
diff --git a/nixos/modules/services/misc/snapper.nix b/nixos/modules/services/misc/snapper.nix
index 7ab5e147335..3c3f6c4d641 100644
--- a/nixos/modules/services/misc/snapper.nix
+++ b/nixos/modules/services/misc/snapper.nix
@@ -51,16 +51,18 @@ in
 
     configs = mkOption {
       default = { };
-      example = literalExample {
-        home = {
-          subvolume = "/home";
-          extraConfig = ''
-            ALLOW_USERS="alice"
-            TIMELINE_CREATE=yes
-            TIMELINE_CLEANUP=yes
-          '';
-        };
-      };
+      example = literalExpression ''
+        {
+          home = {
+            subvolume = "/home";
+            extraConfig = '''
+              ALLOW_USERS="alice"
+              TIMELINE_CREATE=yes
+              TIMELINE_CLEANUP=yes
+            ''';
+          };
+        }
+      '';
 
       description = ''
         Subvolume configuration
diff --git a/nixos/modules/services/misc/sourcehut/builds.nix b/nixos/modules/services/misc/sourcehut/builds.nix
index e446f08284f..f806e8c51b9 100644
--- a/nixos/modules/services/misc/sourcehut/builds.nix
+++ b/nixos/modules/services/misc/sourcehut/builds.nix
@@ -54,7 +54,7 @@ in
     images = mkOption {
       type = types.attrsOf (types.attrsOf (types.attrsOf types.package));
       default = { };
-      example = lib.literalExample ''(let
+      example = lib.literalExpression ''(let
           # Pinning unstable to allow usage with flakes and limit rebuilds.
           pkgs_unstable = builtins.fetchGit {
               url = "https://github.com/NixOS/nixpkgs";
diff --git a/nixos/modules/services/misc/sourcehut/git.nix b/nixos/modules/services/misc/sourcehut/git.nix
index 99b9aec0612..2653d77876d 100644
--- a/nixos/modules/services/misc/sourcehut/git.nix
+++ b/nixos/modules/services/misc/sourcehut/git.nix
@@ -49,7 +49,8 @@ in
     package = mkOption {
       type = types.package;
       default = pkgs.git;
-      example = literalExample "pkgs.gitFull";
+      defaultText = literalExpression "pkgs.git";
+      example = literalExpression "pkgs.gitFull";
       description = ''
         Git package for git.sr.ht. This can help silence collisions.
       '';
diff --git a/nixos/modules/services/misc/ssm-agent.nix b/nixos/modules/services/misc/ssm-agent.nix
index c29d03d199b..4ae596ade17 100644
--- a/nixos/modules/services/misc/ssm-agent.nix
+++ b/nixos/modules/services/misc/ssm-agent.nix
@@ -23,7 +23,7 @@ in {
       type = types.path;
       description = "The SSM agent package to use";
       default = pkgs.ssm-agent.override { overrideEtc = false; };
-      defaultText = "pkgs.ssm-agent.override { overrideEtc = false; }";
+      defaultText = literalExpression "pkgs.ssm-agent.override { overrideEtc = false; }";
     };
   };
 
diff --git a/nixos/modules/services/misc/subsonic.nix b/nixos/modules/services/misc/subsonic.nix
index e17a98a5e1d..340683ae6f2 100644
--- a/nixos/modules/services/misc/subsonic.nix
+++ b/nixos/modules/services/misc/subsonic.nix
@@ -93,6 +93,7 @@ let cfg = config.services.subsonic; in {
       transcoders = mkOption {
         type = types.listOf types.path;
         default = [ "${pkgs.ffmpeg.bin}/bin/ffmpeg" ];
+        defaultText = literalExpression ''[ "''${pkgs.ffmpeg.bin}/bin/ffmpeg" ]'';
         description = ''
           List of paths to transcoder executables that should be accessible
           from Subsonic. Symlinks will be created to each executable inside
diff --git a/nixos/modules/services/misc/tautulli.nix b/nixos/modules/services/misc/tautulli.nix
index aded33629f1..9a972b29122 100644
--- a/nixos/modules/services/misc/tautulli.nix
+++ b/nixos/modules/services/misc/tautulli.nix
@@ -47,7 +47,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.tautulli;
-        defaultText = "pkgs.tautulli";
+        defaultText = literalExpression "pkgs.tautulli";
         description = ''
           The Tautulli package to use.
         '';
diff --git a/nixos/modules/services/misc/tp-auto-kbbl.nix b/nixos/modules/services/misc/tp-auto-kbbl.nix
index 3ddece88e56..59018f7f81f 100644
--- a/nixos/modules/services/misc/tp-auto-kbbl.nix
+++ b/nixos/modules/services/misc/tp-auto-kbbl.nix
@@ -14,7 +14,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.tp-auto-kbbl;
-        defaultText = literalExample "pkgs.tp-auto-kbbl";
+        defaultText = literalExpression "pkgs.tp-auto-kbbl";
         description = "Package providing <command>tp-auto-kbbl</command>.";
       };
 
diff --git a/nixos/modules/services/misc/uhub.nix b/nixos/modules/services/misc/uhub.nix
index da2613e6db1..0d0a8c2a4cb 100644
--- a/nixos/modules/services/misc/uhub.nix
+++ b/nixos/modules/services/misc/uhub.nix
@@ -50,7 +50,7 @@ in {
                 options = {
                   plugin = mkOption {
                     type = path;
-                    example = literalExample
+                    example = literalExpression
                       "$${pkgs.uhub}/plugins/mod_auth_sqlite.so";
                     description = "Path to plugin file.";
                   };
diff --git a/nixos/modules/services/misc/weechat.nix b/nixos/modules/services/misc/weechat.nix
index 9ac2b0ea490..7a4c4dca2ac 100644
--- a/nixos/modules/services/misc/weechat.nix
+++ b/nixos/modules/services/misc/weechat.nix
@@ -21,11 +21,10 @@ in
     };
     binary = mkOption {
       type = types.path;
-      description = "Binary to execute (by default \${weechat}/bin/weechat).";
-      example = literalExample ''
-        ''${pkgs.weechat}/bin/weechat-headless
-      '';
+      description = "Binary to execute.";
       default = "${pkgs.weechat}/bin/weechat";
+      defaultText = literalExpression ''"''${pkgs.weechat}/bin/weechat"'';
+      example = literalExpression ''"''${pkgs.weechat}/bin/weechat-headless"'';
     };
   };
 
diff --git a/nixos/modules/services/misc/xmr-stak.nix b/nixos/modules/services/misc/xmr-stak.nix
index a87878c31e0..9256e9ae01c 100644
--- a/nixos/modules/services/misc/xmr-stak.nix
+++ b/nixos/modules/services/misc/xmr-stak.nix
@@ -29,7 +29,7 @@ in
       configFiles = mkOption {
         type = types.attrsOf types.str;
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           {
             "config.txt" = '''
               "verbose_level" : 4,
diff --git a/nixos/modules/services/misc/zigbee2mqtt.nix b/nixos/modules/services/misc/zigbee2mqtt.nix
index 4458da1346b..b378d9f362f 100644
--- a/nixos/modules/services/misc/zigbee2mqtt.nix
+++ b/nixos/modules/services/misc/zigbee2mqtt.nix
@@ -25,7 +25,7 @@ in
       default = pkgs.zigbee2mqtt.override {
         dataDir = cfg.dataDir;
       };
-      defaultText = literalExample ''
+      defaultText = literalExpression ''
         pkgs.zigbee2mqtt {
           dataDir = services.zigbee2mqtt.dataDir
         }
@@ -42,7 +42,7 @@ in
     settings = mkOption {
       type = format.type;
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         {
           homeassistant = config.services.home-assistant.enable;
           permit_join = true;
diff --git a/nixos/modules/services/misc/zookeeper.nix b/nixos/modules/services/misc/zookeeper.nix
index 0e5880983e4..3809a93a61e 100644
--- a/nixos/modules/services/misc/zookeeper.nix
+++ b/nixos/modules/services/misc/zookeeper.nix
@@ -110,7 +110,7 @@ in {
     package = mkOption {
       description = "The zookeeper package to use";
       default = pkgs.zookeeper;
-      defaultText = "pkgs.zookeeper";
+      defaultText = literalExpression "pkgs.zookeeper";
       type = types.package;
     };
 
diff --git a/nixos/modules/services/monitoring/alerta.nix b/nixos/modules/services/monitoring/alerta.nix
index 7c6eff713cb..c4ce23361e9 100644
--- a/nixos/modules/services/monitoring/alerta.nix
+++ b/nixos/modules/services/monitoring/alerta.nix
@@ -32,7 +32,6 @@ in
     bind = mkOption {
       type = types.str;
       default = "0.0.0.0";
-      example = literalExample "0.0.0.0";
       description = "Address to bind to. The default is to bind to all addresses";
     };
 
@@ -46,21 +45,18 @@ in
       type = types.str;
       description = "URL of the MongoDB or PostgreSQL database to connect to";
       default = "mongodb://localhost";
-      example = "mongodb://localhost";
     };
 
     databaseName = mkOption {
       type = types.str;
       description = "Name of the database instance to connect to";
       default = "monitoring";
-      example = "monitoring";
     };
 
     corsOrigins = mkOption {
       type = types.listOf types.str;
       description = "List of URLs that can access the API for Cross-Origin Resource Sharing (CORS)";
       example = [ "http://localhost" "http://localhost:5000" ];
-      default = [ "http://localhost" "http://localhost:5000" ];
     };
 
     authenticationRequired = mkOption {
diff --git a/nixos/modules/services/monitoring/arbtt.nix b/nixos/modules/services/monitoring/arbtt.nix
index b41a3c7b501..94eead220ae 100644
--- a/nixos/modules/services/monitoring/arbtt.nix
+++ b/nixos/modules/services/monitoring/arbtt.nix
@@ -18,8 +18,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.haskellPackages.arbtt;
-        defaultText = "pkgs.haskellPackages.arbtt";
-        example = literalExample "pkgs.haskellPackages.arbtt";
+        defaultText = literalExpression "pkgs.haskellPackages.arbtt";
         description = ''
           The package to use for the arbtt binaries.
         '';
diff --git a/nixos/modules/services/monitoring/bosun.nix b/nixos/modules/services/monitoring/bosun.nix
index 04e9da1c81a..4b278b9c200 100644
--- a/nixos/modules/services/monitoring/bosun.nix
+++ b/nixos/modules/services/monitoring/bosun.nix
@@ -33,8 +33,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.bosun;
-        defaultText = "pkgs.bosun";
-        example = literalExample "pkgs.bosun";
+        defaultText = literalExpression "pkgs.bosun";
         description = ''
           bosun binary to use.
         '';
diff --git a/nixos/modules/services/monitoring/collectd.nix b/nixos/modules/services/monitoring/collectd.nix
index ef3663c62e0..ad0cf4735ad 100644
--- a/nixos/modules/services/monitoring/collectd.nix
+++ b/nixos/modules/services/monitoring/collectd.nix
@@ -45,7 +45,7 @@ in {
 
     package = mkOption {
       default = pkgs.collectd;
-      defaultText = "pkgs.collectd";
+      defaultText = literalExpression "pkgs.collectd";
       description = ''
         Which collectd package to use.
       '';
diff --git a/nixos/modules/services/monitoring/datadog-agent.nix b/nixos/modules/services/monitoring/datadog-agent.nix
index ea9eca18090..6d9d1ef973a 100644
--- a/nixos/modules/services/monitoring/datadog-agent.nix
+++ b/nixos/modules/services/monitoring/datadog-agent.nix
@@ -59,7 +59,7 @@ in {
 
     package = mkOption {
       default = pkgs.datadog-agent;
-      defaultText = "pkgs.datadog-agent";
+      defaultText = literalExpression "pkgs.datadog-agent";
       description = ''
         Which DataDog v7 agent package to use. Note that the provided
         package is expected to have an overridable `pythonPackages`-attribute
@@ -135,9 +135,11 @@ in {
         package set must be provided.
       '';
 
-      example = {
-        ntp = (pythonPackages: [ pythonPackages.ntplib ]);
-      };
+      example = literalExpression ''
+        {
+          ntp = pythonPackages: [ pythonPackages.ntplib ];
+        }
+      '';
     };
 
     extraConfig = mkOption {
diff --git a/nixos/modules/services/monitoring/grafana-reporter.nix b/nixos/modules/services/monitoring/grafana-reporter.nix
index 893c15d568b..e40d78f538f 100644
--- a/nixos/modules/services/monitoring/grafana-reporter.nix
+++ b/nixos/modules/services/monitoring/grafana-reporter.nix
@@ -41,8 +41,9 @@ in {
 
     templateDir = mkOption {
       description = "Optional template directory to use custom tex templates";
-      default = "${pkgs.grafana_reporter}";
-      type = types.str;
+      default = pkgs.grafana_reporter;
+      defaultText = literalExpression "pkgs.grafana_reporter";
+      type = types.either types.str types.path;
     };
   };
 
diff --git a/nixos/modules/services/monitoring/grafana.nix b/nixos/modules/services/monitoring/grafana.nix
index d46e38e82af..9b21dc78b19 100644
--- a/nixos/modules/services/monitoring/grafana.nix
+++ b/nixos/modules/services/monitoring/grafana.nix
@@ -330,13 +330,14 @@ in {
     staticRootPath = mkOption {
       description = "Root path for static assets.";
       default = "${cfg.package}/share/grafana/public";
+      defaultText = literalExpression ''"''${package}/share/grafana/public"'';
       type = types.str;
     };
 
     package = mkOption {
       description = "Package to use.";
       default = pkgs.grafana;
-      defaultText = "pkgs.grafana";
+      defaultText = literalExpression "pkgs.grafana";
       type = types.package;
     };
 
@@ -344,7 +345,7 @@ in {
       type = with types; nullOr (listOf path);
       default = null;
       description = "If non-null, then a list of packages containing Grafana plugins to install. If set, plugins cannot be manually installed.";
-      example = literalExample "with pkgs.grafanaPlugins; [ grafana-piechart-panel ]";
+      example = literalExpression "with pkgs.grafanaPlugins; [ grafana-piechart-panel ]";
       # Make sure each plugin is added only once; otherwise building
       # the link farm fails, since the same path is added multiple
       # times.
diff --git a/nixos/modules/services/monitoring/graphite.nix b/nixos/modules/services/monitoring/graphite.nix
index 502afce5233..4690a252c92 100644
--- a/nixos/modules/services/monitoring/graphite.nix
+++ b/nixos/modules/services/monitoring/graphite.nix
@@ -132,7 +132,7 @@ in {
       finders = mkOption {
         description = "List of finder plugins to load.";
         default = [];
-        example = literalExample "[ pkgs.python3Packages.influxgraph ]";
+        example = literalExpression "[ pkgs.python3Packages.influxgraph ]";
         type = types.listOf types.package;
       };
 
@@ -160,7 +160,7 @@ in {
       package = mkOption {
         description = "Package to use for graphite api.";
         default = pkgs.python3Packages.graphite_api;
-        defaultText = "pkgs.python3Packages.graphite_api";
+        defaultText = literalExpression "pkgs.python3Packages.graphite_api";
         type = types.package;
       };
 
@@ -335,7 +335,7 @@ in {
           <link xlink:href='https://github.com/scobal/seyren#config' />
         '';
         type = types.attrsOf types.str;
-        example = literalExample ''
+        example = literalExpression ''
           {
             GRAPHITE_USERNAME = "user";
             GRAPHITE_PASSWORD = "pass";
diff --git a/nixos/modules/services/monitoring/heapster.nix b/nixos/modules/services/monitoring/heapster.nix
index 1bf7203d682..44f53e1890a 100644
--- a/nixos/modules/services/monitoring/heapster.nix
+++ b/nixos/modules/services/monitoring/heapster.nix
@@ -33,7 +33,7 @@ in {
     package = mkOption {
       description = "Package to use by heapster";
       default = pkgs.heapster;
-      defaultText = "pkgs.heapster";
+      defaultText = literalExpression "pkgs.heapster";
       type = types.package;
     };
   };
diff --git a/nixos/modules/services/monitoring/incron.nix b/nixos/modules/services/monitoring/incron.nix
index 255e1d9e30b..2681c35d6a0 100644
--- a/nixos/modules/services/monitoring/incron.nix
+++ b/nixos/modules/services/monitoring/incron.nix
@@ -56,7 +56,7 @@ in
       extraPackages = mkOption {
         type = types.listOf types.package;
         default = [];
-        example = literalExample "[ pkgs.rsync ]";
+        example = literalExpression "[ pkgs.rsync ]";
         description = "Extra packages available to the system incrontab.";
       };
 
diff --git a/nixos/modules/services/monitoring/kapacitor.nix b/nixos/modules/services/monitoring/kapacitor.nix
index 9b4ff3c5612..5f2233d747f 100644
--- a/nixos/modules/services/monitoring/kapacitor.nix
+++ b/nixos/modules/services/monitoring/kapacitor.nix
@@ -62,7 +62,6 @@ in
     dataDir = mkOption {
       type = types.path;
       example = "/var/lib/kapacitor";
-      default = "/var/lib/kapacitor";
       description = "Location where Kapacitor stores its state";
     };
 
@@ -75,7 +74,7 @@ in
     bind = mkOption {
       type = types.str;
       default = "";
-      example = literalExample "0.0.0.0";
+      example = "0.0.0.0";
       description = "Address to bind to. The default is to bind to all addresses";
     };
 
@@ -101,7 +100,6 @@ in
       type = types.str;
       description = "Specifies how often to snapshot the task state  (in InfluxDB time units)";
       default = "1m0s";
-      example = "1m0s";
     };
 
     loadDirectory = mkOption {
@@ -136,7 +134,6 @@ in
       url = mkOption {
         description = "The URL to the Alerta REST API";
         default = "http://localhost:5000";
-        example = "http://localhost:5000";
         type = types.str;
       };
 
diff --git a/nixos/modules/services/monitoring/loki.nix b/nixos/modules/services/monitoring/loki.nix
index 51cabaa274a..ebac70c30c2 100644
--- a/nixos/modules/services/monitoring/loki.nix
+++ b/nixos/modules/services/monitoring/loki.nix
@@ -1,7 +1,7 @@
 { config, lib, pkgs, ... }:
 
 let
-  inherit (lib) escapeShellArgs literalExample mkEnableOption mkIf mkOption types;
+  inherit (lib) escapeShellArgs mkEnableOption mkIf mkOption types;
 
   cfg = config.services.loki;
 
@@ -57,7 +57,7 @@ in {
     extraFlags = mkOption {
       type = types.listOf types.str;
       default = [];
-      example = literalExample [ "--server.http-listen-port=3101" ];
+      example = [ "--server.http-listen-port=3101" ];
       description = ''
         Specify a list of additional command line flags,
         which get escaped and are then passed to Loki.
diff --git a/nixos/modules/services/monitoring/mackerel-agent.nix b/nixos/modules/services/monitoring/mackerel-agent.nix
index 7046de9d403..aeb6247abd8 100644
--- a/nixos/modules/services/monitoring/mackerel-agent.nix
+++ b/nixos/modules/services/monitoring/mackerel-agent.nix
@@ -19,7 +19,6 @@ in {
 
     apiKeyFile = mkOption {
       type = types.path;
-      default = "";
       example = "/run/keys/mackerel-api-key";
       description = ''
         Path to file containing the Mackerel API key. The file should contain a
diff --git a/nixos/modules/services/monitoring/metricbeat.nix b/nixos/modules/services/monitoring/metricbeat.nix
index b285559eaa9..e75039daa10 100644
--- a/nixos/modules/services/monitoring/metricbeat.nix
+++ b/nixos/modules/services/monitoring/metricbeat.nix
@@ -3,7 +3,7 @@
 let
   inherit (lib)
     attrValues
-    literalExample
+    literalExpression
     mkEnableOption
     mkIf
     mkOption
@@ -24,8 +24,8 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.metricbeat;
-        defaultText = literalExample "pkgs.metricbeat";
-        example = literalExample "pkgs.metricbeat7";
+        defaultText = literalExpression "pkgs.metricbeat";
+        example = literalExpression "pkgs.metricbeat7";
         description = ''
           The metricbeat package to use
         '';
@@ -51,7 +51,6 @@ in
             module = mkOption {
               type = types.str;
               default = name;
-              defaultText = literalExample ''<name>'';
               description = ''
                 The name of the module.
 
diff --git a/nixos/modules/services/monitoring/munin.nix b/nixos/modules/services/monitoring/munin.nix
index 1ebf7ee6a76..4fddb1e37e2 100644
--- a/nixos/modules/services/monitoring/munin.nix
+++ b/nixos/modules/services/monitoring/munin.nix
@@ -189,7 +189,7 @@ in
           <literal>/bin</literal>, <literal>/usr/bin</literal>,
           <literal>/sbin</literal>, and <literal>/usr/sbin</literal>.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           {
             zfs_usage_bigpool = /src/munin-contrib/plugins/zfs/zfs_usage_;
             zfs_usage_smallpool = /src/munin-contrib/plugins/zfs/zfs_usage_;
@@ -220,7 +220,7 @@ in
           <literal>/bin</literal>, <literal>/usr/bin</literal>,
           <literal>/sbin</literal>, and <literal>/usr/sbin</literal>.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           [
             /src/munin-contrib/plugins/zfs
             /src/munin-contrib/plugins/ssh
@@ -285,9 +285,11 @@ in
           host for cron to succeed. See
           <link xlink:href='http://guide.munin-monitoring.org/en/latest/reference/munin.conf.html' />
         '';
-        example = ''
-          [''${config.networking.hostName}]
-          address localhost
+        example = literalExpression ''
+          '''
+            [''${config.networking.hostName}]
+            address localhost
+          '''
         '';
       };
 
diff --git a/nixos/modules/services/monitoring/nagios.nix b/nixos/modules/services/monitoring/nagios.nix
index 280a9a001b5..83020d52fc8 100644
--- a/nixos/modules/services/monitoring/nagios.nix
+++ b/nixos/modules/services/monitoring/nagios.nix
@@ -97,13 +97,13 @@ in
           network that you want Nagios to monitor.
         ";
         type = types.listOf types.path;
-        example = literalExample "[ ./objects.cfg ]";
+        example = literalExpression "[ ./objects.cfg ]";
       };
 
       plugins = mkOption {
         type = types.listOf types.package;
         default = with pkgs; [ monitoring-plugins ssmtp mailutils ];
-        defaultText = "[pkgs.monitoring-plugins pkgs.ssmtp pkgs.mailutils]";
+        defaultText = literalExpression "[pkgs.monitoring-plugins pkgs.ssmtp pkgs.mailutils]";
         description = "
           Packages to be added to the Nagios <envar>PATH</envar>.
           Typically used to add plugins, but can be anything.
@@ -137,7 +137,7 @@ in
       cgiConfigFile = mkOption {
         type = types.package;
         default = nagiosCGICfgFile;
-        defaultText = "nagiosCGICfgFile";
+        defaultText = literalExpression "nagiosCGICfgFile";
         description = "
           Derivation for the configuration file of Nagios CGI scripts
           that can be used in web servers for running the Nagios web interface.
@@ -155,7 +155,7 @@ in
 
       virtualHost = mkOption {
         type = types.submodule (import ../web-servers/apache-httpd/vhost-options.nix);
-        example = literalExample ''
+        example = literalExpression ''
           { hostName = "example.org";
             adminAddr = "webmaster@example.org";
             enableSSL = true;
diff --git a/nixos/modules/services/monitoring/netdata.nix b/nixos/modules/services/monitoring/netdata.nix
index 3ea84ca815f..00bdd9fcda0 100644
--- a/nixos/modules/services/monitoring/netdata.nix
+++ b/nixos/modules/services/monitoring/netdata.nix
@@ -45,7 +45,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.netdata;
-        defaultText = "pkgs.netdata";
+        defaultText = literalExpression "pkgs.netdata";
         description = "Netdata package to use.";
       };
 
@@ -84,8 +84,8 @@ in {
         extraPackages = mkOption {
           type = types.functionTo (types.listOf types.package);
           default = ps: [];
-          defaultText = "ps: []";
-          example = literalExample ''
+          defaultText = literalExpression "ps: []";
+          example = literalExpression ''
             ps: [
               ps.psycopg2
               ps.docker
@@ -102,7 +102,7 @@ in {
       extraPluginPaths = mkOption {
         type = types.listOf types.path;
         default = [ ];
-        example = literalExample ''
+        example = literalExpression ''
           [ "/path/to/plugins.d" ]
         '';
         description = ''
@@ -121,7 +121,7 @@ in {
         type = types.attrsOf types.attrs;
         default = {};
         description = "netdata.conf configuration as nix attributes. cannot be combined with configText.";
-        example = literalExample ''
+        example = literalExpression ''
           global = {
             "debug log" = "syslog";
             "access log" = "syslog";
diff --git a/nixos/modules/services/monitoring/parsedmarc.nix b/nixos/modules/services/monitoring/parsedmarc.nix
index e6a72dea026..eeee04b4400 100644
--- a/nixos/modules/services/monitoring/parsedmarc.nix
+++ b/nixos/modules/services/monitoring/parsedmarc.nix
@@ -39,7 +39,7 @@ in
         hostname = lib.mkOption {
           type = lib.types.str;
           default = config.networking.fqdn;
-          defaultText = "config.networking.fqdn";
+          defaultText = lib.literalExpression "config.networking.fqdn";
           example = "monitoring.example.com";
           description = ''
             The hostname to use when configuring Postfix.
diff --git a/nixos/modules/services/monitoring/prometheus/alertmanager.nix b/nixos/modules/services/monitoring/prometheus/alertmanager.nix
index 1b02ebf3704..1f396634ae0 100644
--- a/nixos/modules/services/monitoring/prometheus/alertmanager.nix
+++ b/nixos/modules/services/monitoring/prometheus/alertmanager.nix
@@ -45,7 +45,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.prometheus-alertmanager;
-        defaultText = "pkgs.alertmanager";
+        defaultText = literalExpression "pkgs.alertmanager";
         description = ''
           Package that should be used for alertmanager.
         '';
diff --git a/nixos/modules/services/monitoring/prometheus/default.nix b/nixos/modules/services/monitoring/prometheus/default.nix
index 1161d18ab14..d2b37cf688b 100644
--- a/nixos/modules/services/monitoring/prometheus/default.nix
+++ b/nixos/modules/services/monitoring/prometheus/default.nix
@@ -692,7 +692,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.prometheus;
-      defaultText = "pkgs.prometheus";
+      defaultText = literalExpression "pkgs.prometheus";
       description = ''
         The prometheus package that should be used.
       '';
@@ -833,7 +833,7 @@ in {
 
     alertmanagers = mkOption {
       type = types.listOf types.attrs;
-      example = literalExample ''
+      example = literalExpression ''
         [ {
           scheme = "https";
           path_prefix = "/alertmanager";
diff --git a/nixos/modules/services/monitoring/prometheus/exporters.nix b/nixos/modules/services/monitoring/prometheus/exporters.nix
index 83de9a3f5eb..99dfea6daa7 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters.nix
@@ -1,7 +1,7 @@
 { config, pkgs, lib, options, ... }:
 
 let
-  inherit (lib) concatStrings foldl foldl' genAttrs literalExample maintainers
+  inherit (lib) concatStrings foldl foldl' genAttrs literalExpression maintainers
                 mapAttrsToList mkDefault mkEnableOption mkIf mkMerge mkOption
                 optional types mkOptionDefault flip attrNames;
 
@@ -109,7 +109,7 @@ let
     firewallFilter = mkOption {
       type = types.nullOr types.str;
       default = null;
-      example = literalExample ''
+      example = literalExpression ''
         "-i eth0 -p tcp -m tcp --dport ${toString port}"
       '';
       description = ''
@@ -204,7 +204,7 @@ in
     };
     description = "Prometheus exporter configuration";
     default = {};
-    example = literalExample ''
+    example = literalExpression ''
       {
         node = {
           enable = true;
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/buildkite-agent.nix b/nixos/modules/services/monitoring/prometheus/exporters/buildkite-agent.nix
index 7557480ac06..e9be39608fc 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/buildkite-agent.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/buildkite-agent.nix
@@ -36,7 +36,7 @@ in
     queues = mkOption {
       type = with types; nullOr (listOf str);
       default = null;
-      example = literalExample ''[ "my-queue1" "my-queue2" ]'';
+      example = literalExpression ''[ "my-queue1" "my-queue2" ]'';
       description = ''
         Which specific queues to process.
       '';
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/flow.nix b/nixos/modules/services/monitoring/prometheus/exporters/flow.nix
index 6a35f46308f..b85e5461f21 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/flow.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/flow.nix
@@ -9,7 +9,7 @@ in {
   extraOpts = {
     brokers = mkOption {
       type = types.listOf types.str;
-      example = literalExample ''[ "kafka.example.org:19092" ]'';
+      example = literalExpression ''[ "kafka.example.org:19092" ]'';
       description = "List of Kafka brokers to connect to.";
     };
 
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/kea.nix b/nixos/modules/services/monitoring/prometheus/exporters/kea.nix
index 9677281f877..0571325c5d9 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/kea.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/kea.nix
@@ -13,7 +13,7 @@ in {
   extraOpts = {
     controlSocketPaths = mkOption {
       type = types.listOf types.str;
-      example = literalExample ''
+      example = literalExpression ''
         [
           "/run/kea/kea-dhcp4.socket"
           "/run/kea/kea-dhcp6.socket"
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/knot.nix b/nixos/modules/services/monitoring/prometheus/exporters/knot.nix
index 46c28fe0a57..2acaac293b6 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/knot.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/knot.nix
@@ -10,7 +10,7 @@ in {
     knotLibraryPath = mkOption {
       type = types.str;
       default = "${pkgs.knot-dns.out}/lib/libknot.so";
-      defaultText = "\${pkgs.knot-dns}/lib/libknot.so";
+      defaultText = literalExpression ''"''${pkgs.knot-dns.out}/lib/libknot.so"'';
       description = ''
         Path to the library of <package>knot-dns</package>.
       '';
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/mail.nix b/nixos/modules/services/monitoring/prometheus/exporters/mail.nix
index 7e196149fbb..956bd96aa45 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/mail.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/mail.nix
@@ -100,7 +100,7 @@ let
     servers = mkOption {
       type = types.listOf (types.submodule serverOptions);
       default = [];
-      example = literalExample ''
+      example = literalExpression ''
         [ {
           name = "testserver";
           server = "smtp.domain.tld";
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/mikrotik.nix b/nixos/modules/services/monitoring/prometheus/exporters/mikrotik.nix
index 62c2cc56847..8f9536b702a 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/mikrotik.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/mikrotik.nix
@@ -15,7 +15,7 @@ in
         Path to a mikrotik exporter configuration file. Mutually exclusive with
         <option>configuration</option> option.
       '';
-      example = literalExample "./mikrotik.yml";
+      example = literalExpression "./mikrotik.yml";
     };
 
     configuration = mkOption {
@@ -28,7 +28,7 @@ in
         See <link xlink:href="https://github.com/nshttpd/mikrotik-exporter/blob/master/README.md"/>
         for the description of the configuration file format.
       '';
-      example = literalExample ''
+      example = literalExpression ''
         {
           devices = [
             {
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/node.nix b/nixos/modules/services/monitoring/prometheus/exporters/node.nix
index adc2abe0b91..ed594460d95 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/node.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/node.nix
@@ -11,7 +11,7 @@ in
     enabledCollectors = mkOption {
       type = types.listOf types.str;
       default = [];
-      example = ''[ "systemd" ]'';
+      example = [ "systemd" ];
       description = ''
         Collectors to enable. The collectors listed here are enabled in addition to the default ones.
       '';
@@ -19,7 +19,7 @@ in
     disabledCollectors = mkOption {
       type = types.listOf types.str;
       default = [];
-      example = ''[ "timex" ]'';
+      example = [ "timex" ];
       description = ''
         Collectors to disable which are enabled by default.
       '';
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/pihole.nix b/nixos/modules/services/monitoring/prometheus/exporters/pihole.nix
index 21c2e5eab4c..4bc27ebc32f 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/pihole.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/pihole.nix
@@ -42,8 +42,8 @@ in
     };
     piholePort = mkOption {
       type = types.port;
-      default = "80";
-      example = "443";
+      default = 80;
+      example = 443;
       description = ''
         The port pihole webinterface is reachable on
       '';
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/process.nix b/nixos/modules/services/monitoring/prometheus/exporters/process.nix
index e3b3d18367f..1e9c402fb55 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/process.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/process.nix
@@ -11,14 +11,12 @@ in
   extraOpts = {
     settings.process_names = mkOption {
       type = types.listOf types.anything;
-      default = {};
-      example = literalExample ''
-        {
-          process_names = [
-            # Remove nix store path from process name
-            { name = "{{.Matches.Wrapped}} {{ .Matches.Args }}"; cmdline = [ "^/nix/store[^ ]*/(?P<Wrapped>[^ /]*) (?P<Args>.*)" ]; }
-          ];
-        }
+      default = [];
+      example = literalExpression ''
+        [
+          # Remove nix store path from process name
+          { name = "{{.Matches.Wrapped}} {{ .Matches.Args }}"; cmdline = [ "^/nix/store[^ ]*/(?P<Wrapped>[^ /]*) (?P<Args>.*)" ]; }
+        ]
       '';
       description = ''
         All settings expressed as an Nix attrset.
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/rspamd.nix b/nixos/modules/services/monitoring/prometheus/exporters/rspamd.nix
index 994670a376e..ed985751e42 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/rspamd.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/rspamd.nix
@@ -62,8 +62,8 @@ in
       default = {
         host = config.networking.hostName;
       };
-      defaultText = "{ host = config.networking.hostName; }";
-      example = literalExample ''
+      defaultText = literalExpression "{ host = config.networking.hostName; }";
+      example = literalExpression ''
         {
           host = config.networking.hostName;
           custom_label = "some_value";
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/script.nix b/nixos/modules/services/monitoring/prometheus/exporters/script.nix
index 104ab859f2e..a805a0ad335 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/script.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/script.nix
@@ -30,7 +30,7 @@ in
           };
         };
       });
-      example = literalExample ''
+      example = literalExpression ''
         {
           scripts = [
             { name = "sleep"; script = "sleep 5"; }
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/snmp.nix b/nixos/modules/services/monitoring/prometheus/exporters/snmp.nix
index 01276366e97..de42663e67f 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/snmp.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/snmp.nix
@@ -14,7 +14,7 @@ in
       description = ''
         Path to a snmp exporter configuration file. Mutually exclusive with 'configuration' option.
       '';
-      example = "./snmp.yml";
+      example = literalExpression "./snmp.yml";
     };
 
     configuration = mkOption {
@@ -23,16 +23,14 @@ in
       description = ''
         Snmp exporter configuration as nix attribute set. Mutually exclusive with 'configurationPath' option.
       '';
-      example = ''
-        {
-          "default" = {
-            "version" = 2;
-            "auth" = {
-              "community" = "public";
-            };
+      example = {
+        "default" = {
+          "version" = 2;
+          "auth" = {
+            "community" = "public";
           };
         };
-      '';
+      };
     };
 
     logFormat = mkOption {
diff --git a/nixos/modules/services/monitoring/prometheus/pushgateway.nix b/nixos/modules/services/monitoring/prometheus/pushgateway.nix
index f8fcc3eb97e..01b99376243 100644
--- a/nixos/modules/services/monitoring/prometheus/pushgateway.nix
+++ b/nixos/modules/services/monitoring/prometheus/pushgateway.nix
@@ -26,7 +26,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.prometheus-pushgateway;
-        defaultText = "pkgs.prometheus-pushgateway";
+        defaultText = literalExpression "pkgs.prometheus-pushgateway";
         description = ''
           Package that should be used for the prometheus pushgateway.
         '';
diff --git a/nixos/modules/services/monitoring/scollector.nix b/nixos/modules/services/monitoring/scollector.nix
index ef535585e9b..6a6fe110f94 100644
--- a/nixos/modules/services/monitoring/scollector.nix
+++ b/nixos/modules/services/monitoring/scollector.nix
@@ -43,8 +43,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.scollector;
-        defaultText = "pkgs.scollector";
-        example = literalExample "pkgs.scollector";
+        defaultText = literalExpression "pkgs.scollector";
         description = ''
           scollector binary to use.
         '';
@@ -78,7 +77,7 @@ in {
       collectors = mkOption {
         type = with types; attrsOf (listOf path);
         default = {};
-        example = literalExample "{ \"0\" = [ \"\${postgresStats}/bin/collect-stats\" ]; }";
+        example = literalExpression ''{ "0" = [ "''${postgresStats}/bin/collect-stats" ]; }'';
         description = ''
           An attribute set mapping the frequency of collection to a list of
           binaries that should be executed at that frequency. You can use "0"
diff --git a/nixos/modules/services/monitoring/telegraf.nix b/nixos/modules/services/monitoring/telegraf.nix
index 4046260c164..13aae58d0f3 100644
--- a/nixos/modules/services/monitoring/telegraf.nix
+++ b/nixos/modules/services/monitoring/telegraf.nix
@@ -15,7 +15,7 @@ in {
 
       package = mkOption {
         default = pkgs.telegraf;
-        defaultText = "pkgs.telegraf";
+        defaultText = literalExpression "pkgs.telegraf";
         description = "Which telegraf derivation to use";
         type = types.package;
       };
@@ -23,7 +23,7 @@ in {
       environmentFiles = mkOption {
         type = types.listOf types.path;
         default = [];
-        example = "/run/keys/telegraf.env";
+        example = [ "/run/keys/telegraf.env" ];
         description = ''
           File to load as environment file. Environment variables from this file
           will be interpolated into the config file using envsubst with this
diff --git a/nixos/modules/services/monitoring/thanos.nix b/nixos/modules/services/monitoring/thanos.nix
index 96addf392bd..da626788d82 100644
--- a/nixos/modules/services/monitoring/thanos.nix
+++ b/nixos/modules/services/monitoring/thanos.nix
@@ -120,7 +120,7 @@ let
           type = with types; nullOr str;
           default = if cfg.tracing.config == null then null
                     else toString (toYAML "tracing.yaml" cfg.tracing.config);
-          defaultText = ''
+          defaultText = literalExpression ''
             if config.services.thanos.<cmd>.tracing.config == null then null
             else toString (toYAML "tracing.yaml" config.services.thanos.<cmd>.tracing.config);
           '';
@@ -185,7 +185,7 @@ let
           type = with types; nullOr str;
           default = if cfg.objstore.config == null then null
                     else toString (toYAML "objstore.yaml" cfg.objstore.config);
-          defaultText = ''
+          defaultText = literalExpression ''
             if config.services.thanos.<cmd>.objstore.config == null then null
             else toString (toYAML "objstore.yaml" config.services.thanos.<cmd>.objstore.config);
           '';
@@ -227,7 +227,7 @@ let
         option = mkOption {
           type = types.str;
           default = "/var/lib/${config.services.prometheus.stateDir}/data";
-          defaultText = "/var/lib/\${config.services.prometheus.stateDir}/data";
+          defaultText = literalExpression ''"/var/lib/''${config.services.prometheus.stateDir}/data"'';
           description = ''
             Data directory of TSDB.
           '';
@@ -656,7 +656,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.thanos;
-      defaultText = "pkgs.thanos";
+      defaultText = literalExpression "pkgs.thanos";
       description = ''
         The thanos package that should be used.
       '';
diff --git a/nixos/modules/services/monitoring/unifi-poller.nix b/nixos/modules/services/monitoring/unifi-poller.nix
index 208f5e4875b..81a7b408bcc 100644
--- a/nixos/modules/services/monitoring/unifi-poller.nix
+++ b/nixos/modules/services/monitoring/unifi-poller.nix
@@ -87,7 +87,7 @@ in {
       pass = mkOption {
         type = types.path;
         default = pkgs.writeText "unifi-poller-influxdb-default.password" "unifipoller";
-        defaultText = "unifi-poller-influxdb-default.password";
+        defaultText = literalExpression "unifi-poller-influxdb-default.password";
         description = ''
           Path of a file containing the password for influxdb.
           This file needs to be readable by the unifi-poller user.
@@ -130,7 +130,7 @@ in {
         pass = mkOption {
           type = types.path;
           default = pkgs.writeText "unifi-poller-unifi-default.password" "unifi";
-          defaultText = "unifi-poller-unifi-default.password";
+          defaultText = literalExpression "unifi-poller-unifi-default.password";
           description = ''
             Path of a file containing the password for the unifi service user.
             This file needs to be readable by the unifi-poller user.
diff --git a/nixos/modules/services/monitoring/zabbix-agent.nix b/nixos/modules/services/monitoring/zabbix-agent.nix
index 7eb6449e384..c48b973f1ef 100644
--- a/nixos/modules/services/monitoring/zabbix-agent.nix
+++ b/nixos/modules/services/monitoring/zabbix-agent.nix
@@ -4,7 +4,7 @@ let
   cfg = config.services.zabbixAgent;
 
   inherit (lib) mkDefault mkEnableOption mkIf mkMerge mkOption;
-  inherit (lib) attrValues concatMapStringsSep literalExample optionalString types;
+  inherit (lib) attrValues concatMapStringsSep literalExpression optionalString types;
   inherit (lib.generators) toKeyValue;
 
   user = "zabbix-agent";
@@ -34,15 +34,15 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.zabbix.agent;
-        defaultText = "pkgs.zabbix.agent";
+        defaultText = literalExpression "pkgs.zabbix.agent";
         description = "The Zabbix package to use.";
       };
 
       extraPackages = mkOption {
         type = types.listOf types.package;
         default = with pkgs; [ nettools ];
-        defaultText = "[ nettools ]";
-        example = "[ nettools mysql ]";
+        defaultText = literalExpression "with pkgs; [ nettools ]";
+        example = literalExpression "with pkgs; [ nettools mysql ]";
         description = ''
           Packages to be added to the Zabbix <envar>PATH</envar>.
           Typically used to add executables for scripts, but can be anything.
@@ -53,7 +53,7 @@ in
         type = types.attrsOf types.package;
         description = "A set of modules to load.";
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           {
             "dummy.so" = pkgs.stdenv.mkDerivation {
               name = "zabbix-dummy-module-''${cfg.package.version}";
diff --git a/nixos/modules/services/monitoring/zabbix-proxy.nix b/nixos/modules/services/monitoring/zabbix-proxy.nix
index 8c7a2970e9b..b5009f47f17 100644
--- a/nixos/modules/services/monitoring/zabbix-proxy.nix
+++ b/nixos/modules/services/monitoring/zabbix-proxy.nix
@@ -6,7 +6,7 @@ let
   mysql = config.services.mysql;
 
   inherit (lib) mkAfter mkDefault mkEnableOption mkIf mkMerge mkOption;
-  inherit (lib) attrValues concatMapStringsSep getName literalExample optional optionalAttrs optionalString types;
+  inherit (lib) attrValues concatMapStringsSep getName literalExpression optional optionalAttrs optionalString types;
   inherit (lib.generators) toKeyValue;
 
   user = "zabbix";
@@ -52,14 +52,14 @@ in
           if cfg.database.type == "mysql" then pkgs.zabbix.proxy-mysql
           else if cfg.database.type == "pgsql" then pkgs.zabbix.proxy-pgsql
           else pkgs.zabbix.proxy-sqlite;
-        defaultText = "pkgs.zabbix.proxy-pgsql";
+        defaultText = literalExpression "pkgs.zabbix.proxy-pgsql";
         description = "The Zabbix package to use.";
       };
 
       extraPackages = mkOption {
         type = types.listOf types.package;
         default = with pkgs; [ nettools nmap traceroute ];
-        defaultText = "[ nettools nmap traceroute ]";
+        defaultText = literalExpression "[ nettools nmap traceroute ]";
         description = ''
           Packages to be added to the Zabbix <envar>PATH</envar>.
           Typically used to add executables for scripts, but can be anything.
@@ -70,7 +70,7 @@ in
         type = types.attrsOf types.package;
         description = "A set of modules to load.";
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           {
             "dummy.so" = pkgs.stdenv.mkDerivation {
               name = "zabbix-dummy-module-''${cfg.package.version}";
@@ -109,7 +109,7 @@ in
         name = mkOption {
           type = types.str;
           default = if cfg.database.type == "sqlite" then "${stateDir}/zabbix.db" else "zabbix";
-          defaultText = "zabbix";
+          defaultText = literalExpression "zabbix";
           description = "Database name.";
         };
 
diff --git a/nixos/modules/services/monitoring/zabbix-server.nix b/nixos/modules/services/monitoring/zabbix-server.nix
index c8658634ecb..9b0fd9dbff1 100644
--- a/nixos/modules/services/monitoring/zabbix-server.nix
+++ b/nixos/modules/services/monitoring/zabbix-server.nix
@@ -6,7 +6,7 @@ let
   mysql = config.services.mysql;
 
   inherit (lib) mkAfter mkDefault mkEnableOption mkIf mkMerge mkOption;
-  inherit (lib) attrValues concatMapStringsSep getName literalExample optional optionalAttrs optionalString types;
+  inherit (lib) attrValues concatMapStringsSep getName literalExpression optional optionalAttrs optionalString types;
   inherit (lib.generators) toKeyValue;
 
   user = "zabbix";
@@ -44,14 +44,14 @@ in
       package = mkOption {
         type = types.package;
         default = if cfg.database.type == "mysql" then pkgs.zabbix.server-mysql else pkgs.zabbix.server-pgsql;
-        defaultText = "pkgs.zabbix.server-pgsql";
+        defaultText = literalExpression "pkgs.zabbix.server-pgsql";
         description = "The Zabbix package to use.";
       };
 
       extraPackages = mkOption {
         type = types.listOf types.package;
         default = with pkgs; [ nettools nmap traceroute ];
-        defaultText = "[ nettools nmap traceroute ]";
+        defaultText = literalExpression "[ nettools nmap traceroute ]";
         description = ''
           Packages to be added to the Zabbix <envar>PATH</envar>.
           Typically used to add executables for scripts, but can be anything.
@@ -62,7 +62,7 @@ in
         type = types.attrsOf types.package;
         description = "A set of modules to load.";
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           {
             "dummy.so" = pkgs.stdenv.mkDerivation {
               name = "zabbix-dummy-module-''${cfg.package.version}";
diff --git a/nixos/modules/services/network-filesystems/ceph.nix b/nixos/modules/services/network-filesystems/ceph.nix
index d833062c473..e313589134f 100644
--- a/nixos/modules/services/network-filesystems/ceph.nix
+++ b/nixos/modules/services/network-filesystems/ceph.nix
@@ -97,6 +97,7 @@ in
       mgrModulePath = mkOption {
         type = types.path;
         default = "${pkgs.ceph.lib}/lib/ceph/mgr";
+        defaultText = literalExpression ''"''${pkgs.ceph.lib}/lib/ceph/mgr"'';
         description = ''
           Path at which to find ceph-mgr modules.
         '';
@@ -181,6 +182,7 @@ in
       rgwMimeTypesFile = mkOption {
         type = with types; nullOr path;
         default = "${pkgs.mime-types}/etc/mime.types";
+        defaultText = literalExpression ''"''${pkgs.mime-types}/etc/mime.types"'';
         description = ''
           Path to mime types used by radosgw.
         '';
@@ -190,11 +192,9 @@ in
     extraConfig = mkOption {
       type = with types; attrsOf str;
       default = {};
-      example = ''
-        {
-          "ms bind ipv6" = "true";
-        };
-      '';
+      example = {
+        "ms bind ipv6" = "true";
+      };
       description = ''
         Extra configuration to add to the global section. Use for setting values that are common for all daemons in the cluster.
       '';
@@ -205,9 +205,7 @@ in
       daemons = mkOption {
         type = with types; listOf str;
         default = [];
-        example = ''
-          [ "name1" "name2" ];
-        '';
+        example = [ "name1" "name2" ];
         description = ''
           A list of names for manager daemons that should have a service created. The names correspond
           to the id part in ceph i.e. [ "name1" ] would result in mgr.name1
@@ -227,9 +225,7 @@ in
       daemons = mkOption {
         type = with types; listOf str;
         default = [];
-        example = ''
-          [ "name1" "name2" ];
-        '';
+        example = [ "name1" "name2" ];
         description = ''
           A list of monitor daemons that should have a service created. The names correspond
           to the id part in ceph i.e. [ "name1" ] would result in mon.name1
@@ -249,9 +245,7 @@ in
       daemons = mkOption {
         type = with types; listOf str;
         default = [];
-        example = ''
-          [ "name1" "name2" ];
-        '';
+        example = [ "name1" "name2" ];
         description = ''
           A list of OSD daemons that should have a service created. The names correspond
           to the id part in ceph i.e. [ "name1" ] would result in osd.name1
@@ -279,9 +273,7 @@ in
       daemons = mkOption {
         type = with types; listOf str;
         default = [];
-        example = ''
-          [ "name1" "name2" ];
-        '';
+        example = [ "name1" "name2" ];
         description = ''
           A list of metadata service daemons that should have a service created. The names correspond
           to the id part in ceph i.e. [ "name1" ] would result in mds.name1
@@ -301,9 +293,7 @@ in
       daemons = mkOption {
         type = with types; listOf str;
         default = [];
-        example = ''
-          [ "name1" "name2" ];
-        '';
+        example = [ "name1" "name2" ];
         description = ''
           A list of rados gateway daemons that should have a service created. The names correspond
           to the id part in ceph i.e. [ "name1" ] would result in client.name1, radosgw daemons
@@ -318,7 +308,7 @@ in
       extraConfig = mkOption {
         type = with types; attrsOf (attrsOf str);
         default = {};
-        example = ''
+        example = literalExpression ''
           {
             # This would create a section for a radosgw daemon named node0 and related
             # configuration for it
diff --git a/nixos/modules/services/network-filesystems/glusterfs.nix b/nixos/modules/services/network-filesystems/glusterfs.nix
index d70092999f6..bc8be05ca8c 100644
--- a/nixos/modules/services/network-filesystems/glusterfs.nix
+++ b/nixos/modules/services/network-filesystems/glusterfs.nix
@@ -113,19 +113,16 @@ in
         type = types.nullOr (types.submodule {
           options = {
             tlsKeyPath = mkOption {
-              default = null;
               type = types.str;
               description = "Path to the private key used for TLS.";
             };
 
             tlsPem = mkOption {
-              default = null;
               type = types.path;
               description = "Path to the certificate used for TLS.";
             };
 
             caCert = mkOption {
-              default = null;
               type = types.path;
               description = "Path certificate authority used to sign the cluster certificates.";
             };
diff --git a/nixos/modules/services/network-filesystems/ipfs.nix b/nixos/modules/services/network-filesystems/ipfs.nix
index faa515835b6..36b72ca48b2 100644
--- a/nixos/modules/services/network-filesystems/ipfs.nix
+++ b/nixos/modules/services/network-filesystems/ipfs.nix
@@ -57,7 +57,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.ipfs;
-        defaultText = "pkgs.ipfs";
+        defaultText = literalExpression "pkgs.ipfs";
         description = "Which IPFS package to use.";
       };
 
diff --git a/nixos/modules/services/network-filesystems/litestream/default.nix b/nixos/modules/services/network-filesystems/litestream/default.nix
index f1806c5af0a..51eb920d778 100644
--- a/nixos/modules/services/network-filesystems/litestream/default.nix
+++ b/nixos/modules/services/network-filesystems/litestream/default.nix
@@ -13,7 +13,7 @@ in
     package = mkOption {
       description = "Package to use.";
       default = pkgs.litestream;
-      defaultText = "pkgs.litestream";
+      defaultText = literalExpression "pkgs.litestream";
       type = types.package;
     };
 
diff --git a/nixos/modules/services/network-filesystems/openafs/client.nix b/nixos/modules/services/network-filesystems/openafs/client.nix
index 03884cb7297..c8cc5052c2a 100644
--- a/nixos/modules/services/network-filesystems/openafs/client.nix
+++ b/nixos/modules/services/network-filesystems/openafs/client.nix
@@ -4,7 +4,7 @@
 with import ./lib.nix { inherit config lib pkgs; };
 
 let
-  inherit (lib) getBin mkOption mkIf optionalString singleton types;
+  inherit (lib) getBin literalExpression mkOption mkIf optionalString singleton types;
 
   cfg = config.services.openafsClient;
 
@@ -57,11 +57,10 @@ in
           CellServDB. See CellServDB(5) man page for syntax. Ignored when
           <literal>afsdb</literal> is set to <literal>true</literal>.
         '';
-        example = ''
-          [ { ip = "1.2.3.4"; dnsname = "first.afsdb.server.dns.fqdn.org"; }
-            { ip = "2.3.4.5"; dnsname = "second.afsdb.server.dns.fqdn.org"; }
-          ]
-        '';
+        example = [
+          { ip = "1.2.3.4"; dnsname = "first.afsdb.server.dns.fqdn.org"; }
+          { ip = "2.3.4.5"; dnsname = "second.afsdb.server.dns.fqdn.org"; }
+        ];
       };
 
       cache = {
@@ -149,13 +148,13 @@ in
       packages = {
         module = mkOption {
           default = config.boot.kernelPackages.openafs;
-          defaultText = "config.boot.kernelPackages.openafs";
+          defaultText = literalExpression "config.boot.kernelPackages.openafs";
           type = types.package;
           description = "OpenAFS kernel module package. MUST match the userland package!";
         };
         programs = mkOption {
           default = getBin pkgs.openafs;
-          defaultText = "getBin pkgs.openafs";
+          defaultText = literalExpression "getBin pkgs.openafs";
           type = types.package;
           description = "OpenAFS programs package. MUST match the kernel module package!";
         };
diff --git a/nixos/modules/services/network-filesystems/openafs/server.nix b/nixos/modules/services/network-filesystems/openafs/server.nix
index 4fce650b013..c1bf83be77b 100644
--- a/nixos/modules/services/network-filesystems/openafs/server.nix
+++ b/nixos/modules/services/network-filesystems/openafs/server.nix
@@ -4,7 +4,7 @@
 with import ./lib.nix { inherit config lib pkgs; };
 
 let
-  inherit (lib) concatStringsSep mkIf mkOption optionalString types;
+  inherit (lib) concatStringsSep literalExpression mkIf mkOption optionalString types;
 
   bosConfig = pkgs.writeText "BosConfig" (''
     restrictmode 1
@@ -81,7 +81,7 @@ in {
 
       package = mkOption {
         default = pkgs.openafs.server or pkgs.openafs;
-        defaultText = "pkgs.openafs.server or pkgs.openafs";
+        defaultText = literalExpression "pkgs.openafs.server or pkgs.openafs";
         type = types.package;
         description = "OpenAFS package for the server binaries";
       };
diff --git a/nixos/modules/services/network-filesystems/orangefs/client.nix b/nixos/modules/services/network-filesystems/orangefs/client.nix
index b69d9e713c3..36ea5af2168 100644
--- a/nixos/modules/services/network-filesystems/orangefs/client.nix
+++ b/nixos/modules/services/network-filesystems/orangefs/client.nix
@@ -47,7 +47,6 @@ in {
 
             target = mkOption {
               type = types.str;
-              default = null;
               example = "tcp://server:3334/orangefs";
               description = "Target URL";
             };
diff --git a/nixos/modules/services/network-filesystems/orangefs/server.nix b/nixos/modules/services/network-filesystems/orangefs/server.nix
index 8c55ccf5ffb..621c2fe8f78 100644
--- a/nixos/modules/services/network-filesystems/orangefs/server.nix
+++ b/nixos/modules/services/network-filesystems/orangefs/server.nix
@@ -118,12 +118,10 @@ in {
       servers = mkOption {
         type = with types; attrsOf types.str;
         default = {};
-        example = ''
-          {
-            node1="tcp://node1:3334";
-            node2="tcp://node2:3334";
-          }
-        '';
+        example = {
+          node1 = "tcp://node1:3334";
+          node2 = "tcp://node2:3334";
+        };
         description = "URLs for storage server including port. The attribute names define the server alias.";
       };
 
@@ -132,8 +130,7 @@ in {
           These options will create the <literal>&lt;FileSystem&gt;</literal> sections of config file.
         '';
         default = { orangefs = {}; };
-        defaultText = literalExample "{ orangefs = {}; }";
-        example = literalExample ''
+        example = literalExpression ''
           {
             fs1 = {
               id = 101;
diff --git a/nixos/modules/services/network-filesystems/samba.nix b/nixos/modules/services/network-filesystems/samba.nix
index 78ea245cb35..3fedaeb4952 100644
--- a/nixos/modules/services/network-filesystems/samba.nix
+++ b/nixos/modules/services/network-filesystems/samba.nix
@@ -117,8 +117,8 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.samba;
-        defaultText = "pkgs.samba";
-        example = literalExample "pkgs.samba4Full";
+        defaultText = literalExpression "pkgs.samba";
+        example = literalExpression "pkgs.samba4Full";
         description = ''
           Defines which package should be used for the samba server.
         '';
@@ -176,7 +176,7 @@ in
           See <command>man smb.conf</command> for options.
         '';
         type = types.attrsOf (types.attrsOf types.unspecified);
-        example = literalExample ''
+        example = literalExpression ''
           { public =
             { path = "/srv/public";
               "read only" = true;
diff --git a/nixos/modules/services/network-filesystems/tahoe.nix b/nixos/modules/services/network-filesystems/tahoe.nix
index 7d75eb28610..5426463dffa 100644
--- a/nixos/modules/services/network-filesystems/tahoe.nix
+++ b/nixos/modules/services/network-filesystems/tahoe.nix
@@ -34,9 +34,8 @@ in
             };
             package = mkOption {
               default = pkgs.tahoelafs;
-              defaultText = "pkgs.tahoelafs";
+              defaultText = literalExpression "pkgs.tahoelafs";
               type = types.package;
-              example = literalExample "pkgs.tahoelafs";
               description = ''
                 The package to use for the Tahoe LAFS daemon.
               '';
@@ -179,9 +178,8 @@ in
             };
             package = mkOption {
               default = pkgs.tahoelafs;
-              defaultText = "pkgs.tahoelafs";
+              defaultText = literalExpression "pkgs.tahoelafs";
               type = types.package;
-              example = literalExample "pkgs.tahoelafs";
               description = ''
                 The package to use for the Tahoe LAFS daemon.
               '';
diff --git a/nixos/modules/services/network-filesystems/xtreemfs.nix b/nixos/modules/services/network-filesystems/xtreemfs.nix
index 6cc8a05ee00..fc072311578 100644
--- a/nixos/modules/services/network-filesystems/xtreemfs.nix
+++ b/nixos/modules/services/network-filesystems/xtreemfs.nix
@@ -142,7 +142,7 @@ in
           '';
         };
         syncMode = mkOption {
-          type = types.enum [ "ASYNC" "SYNC_WRITE_METADATA" "SYNC_WRITE" "FDATASYNC" "ASYNC" ];
+          type = types.enum [ "ASYNC" "SYNC_WRITE_METADATA" "SYNC_WRITE" "FDATASYNC" "FSYNC" ];
           default = "FSYNC";
           example = "FDATASYNC";
           description = ''
@@ -268,7 +268,7 @@ in
         };
         syncMode = mkOption {
           default = "FSYNC";
-          type = types.enum [ "ASYNC" "SYNC_WRITE_METADATA" "SYNC_WRITE" "FDATASYNC" "ASYNC" ];
+          type = types.enum [ "ASYNC" "SYNC_WRITE_METADATA" "SYNC_WRITE" "FDATASYNC" "FSYNC" ];
           example = "FDATASYNC";
           description = ''
             The sync mode influences how operations are committed to the disk
diff --git a/nixos/modules/services/networking/3proxy.nix b/nixos/modules/services/networking/3proxy.nix
index 37a48657c1c..326a8671fcc 100644
--- a/nixos/modules/services/networking/3proxy.nix
+++ b/nixos/modules/services/networking/3proxy.nix
@@ -205,7 +205,7 @@ in {
               };
             });
             default = [ ];
-            example = literalExample ''
+            example = literalExpression ''
               [
                 {
                   rule = "allow";
@@ -244,7 +244,7 @@ in {
         };
       });
       default = [ ];
-      example = literalExample ''
+      example = literalExpression ''
         [
           {
             type = "proxy";
@@ -290,17 +290,6 @@ in {
         "::1"
         "fc00::/7"
       ];
-      example = [
-        "0.0.0.0/8"
-        "127.0.0.0/8"
-        "10.0.0.0/8"
-        "100.64.0.0/10"
-        "172.16.0.0/12"
-        "192.168.0.0/16"
-        "::"
-        "::1"
-        "fc00::/7"
-      ];
       description = ''
         What IP ranges to deny access when denyPrivate is set tu true.
       '';
@@ -322,19 +311,17 @@ in {
           nscache = mkOption {
             type = types.int;
             default = 65535;
-            example = 65535;
             description = "Set name cache size for IPv4.";
           };
           nscache6 = mkOption {
             type = types.int;
             default = 65535;
-            example = 65535;
             description = "Set name cache size for IPv6.";
           };
           nsrecord = mkOption {
             type = types.attrsOf types.str;
             default = { };
-            example = literalExample ''
+            example = literalExpression ''
               {
                 "files.local" = "192.168.1.12";
                 "site.local" = "192.168.1.43";
diff --git a/nixos/modules/services/networking/asterisk.nix b/nixos/modules/services/networking/asterisk.nix
index 03a2544b9a7..af091d55c01 100644
--- a/nixos/modules/services/networking/asterisk.nix
+++ b/nixos/modules/services/networking/asterisk.nix
@@ -115,7 +115,7 @@ in
       confFiles = mkOption {
         default = {};
         type = types.attrsOf types.str;
-        example = literalExample
+        example = literalExpression
           ''
             {
               "extensions.conf" = '''
@@ -200,7 +200,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.asterisk;
-        defaultText = "pkgs.asterisk";
+        defaultText = literalExpression "pkgs.asterisk";
         description = "The Asterisk package to use.";
       };
     };
diff --git a/nixos/modules/services/networking/atftpd.nix b/nixos/modules/services/networking/atftpd.nix
index e7fd48c99a8..da5e305201f 100644
--- a/nixos/modules/services/networking/atftpd.nix
+++ b/nixos/modules/services/networking/atftpd.nix
@@ -28,7 +28,7 @@ in
       extraOptions = mkOption {
         default = [];
         type = types.listOf types.str;
-        example = literalExample ''
+        example = literalExpression ''
           [ "--bind-address 192.168.9.1"
             "--verbose=7"
           ]
diff --git a/nixos/modules/services/networking/avahi-daemon.nix b/nixos/modules/services/networking/avahi-daemon.nix
index 020a817f259..50c4ffdedce 100644
--- a/nixos/modules/services/networking/avahi-daemon.nix
+++ b/nixos/modules/services/networking/avahi-daemon.nix
@@ -54,7 +54,7 @@ in
     hostName = mkOption {
       type = types.str;
       default = config.networking.hostName;
-      defaultText = literalExample "config.networking.hostName";
+      defaultText = literalExpression "config.networking.hostName";
       description = ''
         Host name advertised on the LAN. If not set, avahi will use the value
         of <option>config.networking.hostName</option>.
@@ -87,7 +87,7 @@ in
     ipv6 = mkOption {
       type = types.bool;
       default = config.networking.enableIPv6;
-      defaultText = "config.networking.enableIPv6";
+      defaultText = literalExpression "config.networking.enableIPv6";
       description = "Whether to use IPv6.";
     };
 
@@ -134,7 +134,7 @@ in
     extraServiceFiles = mkOption {
       type = with types; attrsOf (either str path);
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         {
           ssh = "''${pkgs.avahi}/etc/avahi/services/ssh.service";
           smb = '''
diff --git a/nixos/modules/services/networking/bee.nix b/nixos/modules/services/networking/bee.nix
index 8a77ce23ab4..d6efade0630 100644
--- a/nixos/modules/services/networking/bee.nix
+++ b/nixos/modules/services/networking/bee.nix
@@ -20,8 +20,8 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.bee;
-        defaultText = "pkgs.bee";
-        example = "pkgs.bee-unstable";
+        defaultText = literalExpression "pkgs.bee";
+        example = literalExpression "pkgs.bee-unstable";
         description = "The package providing the bee binary for the service.";
       };
 
diff --git a/nixos/modules/services/networking/biboumi.nix b/nixos/modules/services/networking/biboumi.nix
index 66ddca93d81..3f46b95eaf0 100644
--- a/nixos/modules/services/networking/biboumi.nix
+++ b/nixos/modules/services/networking/biboumi.nix
@@ -107,6 +107,7 @@ in
           options.policy_directory = mkOption {
             type = types.path;
             default = "${pkgs.biboumi}/etc/biboumi";
+            defaultText = literalExpression ''"''${pkgs.biboumi}/etc/biboumi"'';
             description = ''
               A directory that should contain the policy files,
               used to customize Botan’s behaviour
diff --git a/nixos/modules/services/networking/bind.nix b/nixos/modules/services/networking/bind.nix
index 0c23fb7e40f..f2b2e4c4d5d 100644
--- a/nixos/modules/services/networking/bind.nix
+++ b/nixos/modules/services/networking/bind.nix
@@ -110,7 +110,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.bind;
-        defaultText = "pkgs.bind";
+        defaultText = literalExpression "pkgs.bind";
         description = "The BIND package to use.";
       };
 
@@ -209,7 +209,7 @@ in
       configFile = mkOption {
         type = types.path;
         default = confFile;
-        defaultText = "confFile";
+        defaultText = literalExpression "confFile";
         description = "
           Overridable config file to use for named. By default, that
           generated by nixos.
diff --git a/nixos/modules/services/networking/bitcoind.nix b/nixos/modules/services/networking/bitcoind.nix
index bc9aa53f49a..80033d95860 100644
--- a/nixos/modules/services/networking/bitcoind.nix
+++ b/nixos/modules/services/networking/bitcoind.nix
@@ -40,7 +40,7 @@ let
       package = mkOption {
         type = types.package;
         default = pkgs.bitcoind;
-        defaultText = "pkgs.bitcoind";
+        defaultText = literalExpression "pkgs.bitcoind";
         description = "The package providing bitcoin binaries.";
       };
 
@@ -88,7 +88,7 @@ let
         };
         users = mkOption {
           default = {};
-          example = literalExample ''
+          example = literalExpression ''
             {
               alice.passwordHMAC = "f7efda5c189b999524f151318c0c86$d5b51b3beffbc02b724e5d095828e0bc8b2456e9ac8757ae3211a5d9b16a22ae";
               bob.passwordHMAC = "b2dd077cb54591a2f3139e69a897ac$4e71f08d48b4347cf8eff3815c0e25ae2e9a4340474079f55705f40574f4ec99";
diff --git a/nixos/modules/services/networking/bitlbee.nix b/nixos/modules/services/networking/bitlbee.nix
index 59ad9e54686..97e126d3069 100644
--- a/nixos/modules/services/networking/bitlbee.nix
+++ b/nixos/modules/services/networking/bitlbee.nix
@@ -109,7 +109,7 @@ in
       plugins = mkOption {
         type = types.listOf types.package;
         default = [];
-        example = literalExample "[ pkgs.bitlbee-facebook ]";
+        example = literalExpression "[ pkgs.bitlbee-facebook ]";
         description = ''
           The list of bitlbee plugins to install.
         '';
@@ -118,7 +118,7 @@ in
       libpurple_plugins = mkOption {
         type = types.listOf types.package;
         default = [];
-        example = literalExample "[ pkgs.purple-matrix ]";
+        example = literalExpression "[ pkgs.purple-matrix ]";
         description = ''
           The list of libpurple plugins to install.
         '';
diff --git a/nixos/modules/services/networking/blockbook-frontend.nix b/nixos/modules/services/networking/blockbook-frontend.nix
index ca323e495ec..eeea521c8d5 100644
--- a/nixos/modules/services/networking/blockbook-frontend.nix
+++ b/nixos/modules/services/networking/blockbook-frontend.nix
@@ -15,6 +15,7 @@ let
       package = mkOption {
         type = types.package;
         default = pkgs.blockbook;
+        defaultText = literalExpression "pkgs.blockbook";
         description = "Which blockbook package to use.";
       };
 
@@ -50,7 +51,6 @@ let
       coinName = mkOption {
         type = types.str;
         default = "Bitcoin";
-        example = "Bitcoin";
         description = ''
           See <link xlink:href="https://github.com/trezor/blockbook/blob/master/bchain/coins/blockchain.go#L61"/>
           for current of coins supported in master (Note: may differ from release).
@@ -60,7 +60,8 @@ let
       cssDir = mkOption {
         type = types.path;
         default = "${config.package}/share/css/";
-        example = "${config.dataDir}/static/css/";
+        defaultText = literalExpression ''"''${package}/share/css/"'';
+        example = literalExpression ''"''${dataDir}/static/css/"'';
         description = ''
           Location of the dir with <filename>main.css</filename> CSS file.
           By default, the one shipped with the package is used.
@@ -82,21 +83,18 @@ let
       internal = mkOption {
         type = types.nullOr types.str;
         default = ":9030";
-        example = ":9030";
         description = "Internal http server binding <literal>[address]:port</literal>.";
       };
 
       messageQueueBinding = mkOption {
         type = types.str;
         default = "tcp://127.0.0.1:38330";
-        example = "tcp://127.0.0.1:38330";
         description = "Message Queue Binding <literal>address:port</literal>.";
       };
 
       public = mkOption {
         type = types.nullOr types.str;
         default = ":9130";
-        example = ":9130";
         description = "Public http server binding <literal>[address]:port</literal>.";
       };
 
@@ -116,14 +114,12 @@ let
         user = mkOption {
           type = types.str;
           default = "rpc";
-          example = "rpc";
           description = "Username for JSON-RPC connections.";
         };
 
         password = mkOption {
           type = types.str;
           default = "rpc";
-          example = "rpc";
           description = ''
             RPC password for JSON-RPC connections.
             Warning: this is stored in cleartext in the Nix store!!!
@@ -150,14 +146,15 @@ let
       templateDir = mkOption {
         type = types.path;
         default = "${config.package}/share/templates/";
-        example = "${config.dataDir}/templates/static/";
+        defaultText = literalExpression ''"''${package}/share/templates/"'';
+        example = literalExpression ''"''${dataDir}/templates/static/"'';
         description = "Location of the HTML templates. By default, ones shipped with the package are used.";
       };
 
       extraConfig = mkOption {
         type = types.attrs;
         default = {};
-        example = literalExample '' {
+        example = literalExpression '' {
           "alternative_estimate_fee" = "whatthefee-disabled";
           "alternative_estimate_fee_params" = "{\"url\": \"https://whatthefee.io/data.json\", \"periodSeconds\": 60}";
           "fiat_rates" = "coingecko";
diff --git a/nixos/modules/services/networking/cjdns.nix b/nixos/modules/services/networking/cjdns.nix
index ca95d00c2ff..0d97d379e90 100644
--- a/nixos/modules/services/networking/cjdns.nix
+++ b/nixos/modules/services/networking/cjdns.nix
@@ -150,7 +150,7 @@ in
         connectTo = mkOption {
           type = types.attrsOf ( types.submodule ( connectToSubmodule ) );
           default = { };
-          example = literalExample ''
+          example = literalExpression ''
             {
               "192.168.1.1:27313" = {
                 hostname = "homer.hype";
@@ -197,7 +197,7 @@ in
         connectTo = mkOption {
           type = types.attrsOf ( types.submodule ( connectToSubmodule ) );
           default = { };
-          example = literalExample ''
+          example = literalExpression ''
             {
               "01:02:03:04:05:06" = {
                 hostname = "homer.hype";
diff --git a/nixos/modules/services/networking/connman.nix b/nixos/modules/services/networking/connman.nix
index 608672c6446..8886e7a30f1 100644
--- a/nixos/modules/services/networking/connman.nix
+++ b/nixos/modules/services/networking/connman.nix
@@ -77,10 +77,11 @@ in {
       };
 
       package = mkOption {
-        type = types.path;
+        type = types.package;
         description = "The connman package / build flavor";
         default = connman;
-        example = literalExample "pkgs.connmanFull";
+        defaultText = literalExpression "pkgs.connman";
+        example = literalExpression "pkgs.connmanFull";
       };
 
     };
diff --git a/nixos/modules/services/networking/consul.nix b/nixos/modules/services/networking/consul.nix
index 476ca738dd1..792b2e7f5df 100644
--- a/nixos/modules/services/networking/consul.nix
+++ b/nixos/modules/services/networking/consul.nix
@@ -34,7 +34,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.consul;
-        defaultText = "pkgs.consul";
+        defaultText = literalExpression "pkgs.consul";
         description = ''
           The package used for the Consul agent and CLI.
         '';
@@ -121,7 +121,7 @@ in
         package = mkOption {
           description = "Package to use for consul-alerts.";
           default = pkgs.consul-alerts;
-          defaultText = "pkgs.consul-alerts";
+          defaultText = literalExpression "pkgs.consul-alerts";
           type = types.package;
         };
 
diff --git a/nixos/modules/services/networking/coredns.nix b/nixos/modules/services/networking/coredns.nix
index afb2b547a46..88615d8e610 100644
--- a/nixos/modules/services/networking/coredns.nix
+++ b/nixos/modules/services/networking/coredns.nix
@@ -22,7 +22,7 @@ in {
 
     package = mkOption {
       default = pkgs.coredns;
-      defaultText = "pkgs.coredns";
+      defaultText = literalExpression "pkgs.coredns";
       type = types.package;
       description = "Coredns package to use.";
     };
diff --git a/nixos/modules/services/networking/corerad.nix b/nixos/modules/services/networking/corerad.nix
index e76ba9a2d00..9d79d5d7686 100644
--- a/nixos/modules/services/networking/corerad.nix
+++ b/nixos/modules/services/networking/corerad.nix
@@ -14,7 +14,7 @@ in {
 
     settings = mkOption {
       type = settingsFormat.type;
-      example = literalExample ''
+      example = literalExpression ''
         {
           interfaces = [
             # eth0 is an upstream interface monitoring for IPv6 router advertisements.
@@ -44,13 +44,13 @@ in {
 
     configFile = mkOption {
       type = types.path;
-      example = literalExample "\"\${pkgs.corerad}/etc/corerad/corerad.toml\"";
+      example = literalExpression ''"''${pkgs.corerad}/etc/corerad/corerad.toml"'';
       description = "Path to CoreRAD TOML configuration file.";
     };
 
     package = mkOption {
       default = pkgs.corerad;
-      defaultText = literalExample "pkgs.corerad";
+      defaultText = literalExpression "pkgs.corerad";
       type = types.package;
       description = "CoreRAD package to use.";
     };
diff --git a/nixos/modules/services/networking/coturn.nix b/nixos/modules/services/networking/coturn.nix
index 12098ec6d33..610754e9bd3 100644
--- a/nixos/modules/services/networking/coturn.nix
+++ b/nixos/modules/services/networking/coturn.nix
@@ -68,7 +68,7 @@ in {
       alt-listening-port = mkOption {
         type = types.int;
         default = cfg.listening-port + 1;
-        defaultText = "listening-port + 1";
+        defaultText = literalExpression "listening-port + 1";
         description = ''
           Alternative listening port for UDP and TCP listeners;
           default (or zero) value means "listening port plus one".
@@ -83,7 +83,7 @@ in {
       alt-tls-listening-port = mkOption {
         type = types.int;
         default = cfg.tls-listening-port + 1;
-        defaultText = "tls-listening-port + 1";
+        defaultText = literalExpression "tls-listening-port + 1";
         description = ''
           Alternative listening port for TLS and DTLS protocols.
         '';
diff --git a/nixos/modules/services/networking/dnscache.nix b/nixos/modules/services/networking/dnscache.nix
index d06032daecc..7452210de47 100644
--- a/nixos/modules/services/networking/dnscache.nix
+++ b/nixos/modules/services/networking/dnscache.nix
@@ -61,7 +61,7 @@ in {
           Table of {hostname: server} pairs to use as authoritative servers for hosts (and subhosts).
           If entry for @ is not specified predefined list of root servers is used.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           {
             "@" = ["8.8.8.8" "8.8.4.4"];
             "example.com" = ["192.168.100.100"];
diff --git a/nixos/modules/services/networking/dnscrypt-proxy2.nix b/nixos/modules/services/networking/dnscrypt-proxy2.nix
index 72965c267a8..dc6a019e9b7 100644
--- a/nixos/modules/services/networking/dnscrypt-proxy2.nix
+++ b/nixos/modules/services/networking/dnscrypt-proxy2.nix
@@ -13,7 +13,7 @@ in
         Attrset that is converted and passed as TOML config file.
         For available params, see: <link xlink:href="https://github.com/DNSCrypt/dnscrypt-proxy/blob/${pkgs.dnscrypt-proxy2.version}/dnscrypt-proxy/example-dnscrypt-proxy.toml"/>
       '';
-      example = literalExample ''
+      example = literalExpression ''
         {
           sources.public-resolvers = {
             urls = [ "https://download.dnscrypt.info/resolvers-list/v2/public-resolvers.md" ];
@@ -29,7 +29,7 @@ in
 
     upstreamDefaults = mkOption {
       description = ''
-        Whether to base the config declared in <literal>services.dnscrypt-proxy2.settings</literal> on the upstream example config (<link xlink:href="https://github.com/DNSCrypt/dnscrypt-proxy/blob/master/dnscrypt-proxy/example-dnscrypt-proxy.toml"/>)
+        Whether to base the config declared in <option>services.dnscrypt-proxy2.settings</option> on the upstream example config (<link xlink:href="https://github.com/DNSCrypt/dnscrypt-proxy/blob/master/dnscrypt-proxy/example-dnscrypt-proxy.toml"/>)
 
         Disable this if you want to declare your dnscrypt config from scratch.
       '';
@@ -56,7 +56,7 @@ in
         ''}
         ${pkgs.remarshal}/bin/json2toml < config.json > $out
       '';
-      defaultText = literalExample "TOML file generated from services.dnscrypt-proxy2.settings";
+      defaultText = literalDocBook "TOML file generated from <option>services.dnscrypt-proxy2.settings</option>";
     };
   };
 
diff --git a/nixos/modules/services/networking/doh-proxy-rust.nix b/nixos/modules/services/networking/doh-proxy-rust.nix
index 0e55bc38665..efd492e23f8 100644
--- a/nixos/modules/services/networking/doh-proxy-rust.nix
+++ b/nixos/modules/services/networking/doh-proxy-rust.nix
@@ -15,7 +15,7 @@ in {
     flags = mkOption {
       type = types.listOf types.str;
       default = [];
-      example = literalExample [ "--server-address=9.9.9.9:53" ];
+      example = [ "--server-address=9.9.9.9:53" ];
       description = ''
         A list of command-line flags to pass to doh-proxy. For details on the
         available options, see <link xlink:href="https://github.com/jedisct1/doh-server#usage"/>.
diff --git a/nixos/modules/services/networking/ejabberd.nix b/nixos/modules/services/networking/ejabberd.nix
index a5af25b983b..daf8d5c4247 100644
--- a/nixos/modules/services/networking/ejabberd.nix
+++ b/nixos/modules/services/networking/ejabberd.nix
@@ -32,7 +32,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.ejabberd;
-        defaultText = "pkgs.ejabberd";
+        defaultText = literalExpression "pkgs.ejabberd";
         description = "ejabberd server package to use";
       };
 
@@ -76,7 +76,7 @@ in {
         type = types.listOf types.path;
         default = [];
         description = "Configuration dumps that should be loaded on the first startup";
-        example = literalExample "[ ./myejabberd.dump ]";
+        example = literalExpression "[ ./myejabberd.dump ]";
       };
 
       imagemagick = mkOption {
diff --git a/nixos/modules/services/networking/epmd.nix b/nixos/modules/services/networking/epmd.nix
index 3899d164f16..75d78476e57 100644
--- a/nixos/modules/services/networking/epmd.nix
+++ b/nixos/modules/services/networking/epmd.nix
@@ -20,6 +20,7 @@ in
     package = mkOption {
       type = types.package;
       default = pkgs.erlang;
+      defaultText = literalExpression "pkgs.erlang";
       description = ''
         The Erlang package to use to get epmd binary. That way you can re-use
         an Erlang runtime that is already installed for other purposes.
diff --git a/nixos/modules/services/networking/ferm.nix b/nixos/modules/services/networking/ferm.nix
index 07338ccf4d9..8e03f30efc0 100644
--- a/nixos/modules/services/networking/ferm.nix
+++ b/nixos/modules/services/networking/ferm.nix
@@ -30,14 +30,14 @@ in {
       config = mkOption {
         description = "Verbatim ferm.conf configuration.";
         default = "";
-        defaultText = "empty firewall, allows any traffic";
+        defaultText = literalDocBook "empty firewall, allows any traffic";
         type = types.lines;
       };
       package = mkOption {
         description = "The ferm package.";
         type = types.package;
         default = pkgs.ferm;
-        defaultText = "pkgs.ferm";
+        defaultText = literalExpression "pkgs.ferm";
       };
     };
   };
diff --git a/nixos/modules/services/networking/firewall.nix b/nixos/modules/services/networking/firewall.nix
index f982621e232..b5b46fe6042 100644
--- a/nixos/modules/services/networking/firewall.nix
+++ b/nixos/modules/services/networking/firewall.nix
@@ -325,8 +325,8 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.iptables;
-        defaultText = "pkgs.iptables";
-        example = literalExample "pkgs.iptables-nftables-compat";
+        defaultText = literalExpression "pkgs.iptables";
+        example = literalExpression "pkgs.iptables-nftables-compat";
         description =
           ''
             The iptables package to use for running the firewall service."
@@ -500,7 +500,7 @@ in
       extraPackages = mkOption {
         type = types.listOf types.package;
         default = [ ];
-        example = literalExample "[ pkgs.ipset ]";
+        example = literalExpression "[ pkgs.ipset ]";
         description =
           ''
             Additional packages to be included in the environment of the system
diff --git a/nixos/modules/services/networking/flannel.nix b/nixos/modules/services/networking/flannel.nix
index 2d67a2a2ad2..b15339870ee 100644
--- a/nixos/modules/services/networking/flannel.nix
+++ b/nixos/modules/services/networking/flannel.nix
@@ -20,7 +20,7 @@ in {
       description = "Package to use for flannel";
       type = types.package;
       default = pkgs.flannel;
-      defaultText = "pkgs.flannel";
+      defaultText = literalExpression "pkgs.flannel";
     };
 
     publicIp = mkOption {
diff --git a/nixos/modules/services/networking/ghostunnel.nix b/nixos/modules/services/networking/ghostunnel.nix
index 58a51df6cca..7a62d378e2c 100644
--- a/nixos/modules/services/networking/ghostunnel.nix
+++ b/nixos/modules/services/networking/ghostunnel.nix
@@ -5,7 +5,7 @@ let
     concatMap
     concatStringsSep
     escapeShellArg
-    literalExample
+    literalExpression
     mapAttrs'
     mkDefault
     mkEnableOption
@@ -219,7 +219,7 @@ in
       description = "The ghostunnel package to use.";
       type = types.package;
       default = pkgs.ghostunnel;
-      defaultText = literalExample ''pkgs.ghostunnel'';
+      defaultText = literalExpression "pkgs.ghostunnel";
     };
 
     services.ghostunnel.servers = mkOption {
diff --git a/nixos/modules/services/networking/globalprotect-vpn.nix b/nixos/modules/services/networking/globalprotect-vpn.nix
index 367a42687e1..976fdf2b962 100644
--- a/nixos/modules/services/networking/globalprotect-vpn.nix
+++ b/nixos/modules/services/networking/globalprotect-vpn.nix
@@ -21,7 +21,7 @@ in
         as described at <link xlink:href="https://www.infradead.org/openconnect/hip.html" />
       '';
       default = null;
-      example = literalExample "\${pkgs.openconnect}/libexec/openconnect/hipreport.sh";
+      example = literalExpression ''"''${pkgs.openconnect}/libexec/openconnect/hipreport.sh"'';
       type = types.nullOr types.path;
     };
   };
diff --git a/nixos/modules/services/networking/gnunet.nix b/nixos/modules/services/networking/gnunet.nix
index cf3d1841a97..5c41967d279 100644
--- a/nixos/modules/services/networking/gnunet.nix
+++ b/nixos/modules/services/networking/gnunet.nix
@@ -115,9 +115,9 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.gnunet;
-        defaultText = "pkgs.gnunet";
+        defaultText = literalExpression "pkgs.gnunet";
         description = "Overridable attribute of the gnunet package to use.";
-        example = literalExample "pkgs.gnunet_git";
+        example = literalExpression "pkgs.gnunet_git";
       };
 
       extraOptions = mkOption {
diff --git a/nixos/modules/services/networking/gobgpd.nix b/nixos/modules/services/networking/gobgpd.nix
index d3b03471f4e..29ef9a5cf1e 100644
--- a/nixos/modules/services/networking/gobgpd.nix
+++ b/nixos/modules/services/networking/gobgpd.nix
@@ -18,7 +18,7 @@ in {
         <link xlink:href="https://github.com/osrg/gobgp#documentation"/>
         for details on supported values.
       '';
-      example = literalExample ''
+      example = literalExpression ''
         {
           global = {
             config = {
diff --git a/nixos/modules/services/networking/hans.nix b/nixos/modules/services/networking/hans.nix
index 84147db00f6..2639b4b6800 100644
--- a/nixos/modules/services/networking/hans.nix
+++ b/nixos/modules/services/networking/hans.nix
@@ -27,7 +27,7 @@ in
           where <replaceable>name</replaceable> is the name of the
           corresponding attribute name.
         '';
-        example = literalExample ''
+        example = literalExpression ''
         {
           foo = {
             server = "192.0.2.1";
diff --git a/nixos/modules/services/networking/hylafax/options.nix b/nixos/modules/services/networking/hylafax/options.nix
index 74960e69b9a..8e59c68054d 100644
--- a/nixos/modules/services/networking/hylafax/options.nix
+++ b/nixos/modules/services/networking/hylafax/options.nix
@@ -2,7 +2,7 @@
 
 let
 
-  inherit (lib.options) literalExample mkEnableOption mkOption;
+  inherit (lib.options) literalExpression mkEnableOption mkOption;
   inherit (lib.types) bool enum ints lines attrsOf nullOr path str submodule;
   inherit (lib.modules) mkDefault mkIf mkMerge;
 
@@ -197,7 +197,7 @@ in
 
     sendmailPath = mkOption {
       type = path;
-      example = literalExample "''${pkgs.postfix}/bin/sendmail";
+      example = literalExpression ''"''${pkgs.postfix}/bin/sendmail"'';
       # '' ;  # fix vim
       description = ''
         Path to <filename>sendmail</filename> program.
@@ -344,7 +344,7 @@ in
     faxqclean.doneqMinutes = mkOption {
       type = ints.positive;
       default = 15;
-      example = literalExample "24*60";
+      example = literalExpression "24*60";
       description = ''
         Set the job
         age threshold (in minutes) that controls how long
@@ -354,7 +354,7 @@ in
     faxqclean.docqMinutes = mkOption {
       type = ints.positive;
       default = 60;
-      example = literalExample "24*60";
+      example = literalExpression "24*60";
       description = ''
         Set the document
         age threshold (in minutes) that controls how long
diff --git a/nixos/modules/services/networking/i2pd.nix b/nixos/modules/services/networking/i2pd.nix
index fba0d817006..17828ca44ff 100644
--- a/nixos/modules/services/networking/i2pd.nix
+++ b/nixos/modules/services/networking/i2pd.nix
@@ -481,7 +481,7 @@ in
       exploratory.inbound = i2cpOpts "exploratory";
       exploratory.outbound = i2cpOpts "exploratory";
 
-      ntcp2.enable = mkEnableTrueOption "NTCP2.";
+      ntcp2.enable = mkEnableTrueOption "NTCP2";
       ntcp2.published = mkEnableOption "NTCP2 publication";
       ntcp2.port = mkOption {
         type = types.int;
diff --git a/nixos/modules/services/networking/icecream/daemon.nix b/nixos/modules/services/networking/icecream/daemon.nix
index 2975696f9c2..8593c94e34d 100644
--- a/nixos/modules/services/networking/icecream/daemon.nix
+++ b/nixos/modules/services/networking/icecream/daemon.nix
@@ -101,7 +101,7 @@ in {
 
       package = mkOption {
         default = pkgs.icecream;
-        defaultText = "pkgs.icecream";
+        defaultText = literalExpression "pkgs.icecream";
         type = types.package;
         description = "Icecream package to use.";
       };
diff --git a/nixos/modules/services/networking/icecream/scheduler.nix b/nixos/modules/services/networking/icecream/scheduler.nix
index 4ccbf27015d..14fbc966b98 100644
--- a/nixos/modules/services/networking/icecream/scheduler.nix
+++ b/nixos/modules/services/networking/icecream/scheduler.nix
@@ -56,7 +56,7 @@ in {
 
       package = mkOption {
         default = pkgs.icecream;
-        defaultText = "pkgs.icecream";
+        defaultText = literalExpression "pkgs.icecream";
         type = types.package;
         description = "Icecream package to use.";
       };
diff --git a/nixos/modules/services/networking/inspircd.nix b/nixos/modules/services/networking/inspircd.nix
index 8cb2b406ee2..81c367ec8f7 100644
--- a/nixos/modules/services/networking/inspircd.nix
+++ b/nixos/modules/services/networking/inspircd.nix
@@ -17,8 +17,8 @@ in {
       package = lib.mkOption {
         type = lib.types.package;
         default = pkgs.inspircd;
-        defaultText = lib.literalExample "pkgs.inspircd";
-        example = lib.literalExample "pkgs.inspircdMinimal";
+        defaultText = lib.literalExpression "pkgs.inspircd";
+        example = lib.literalExpression "pkgs.inspircdMinimal";
         description = ''
           The InspIRCd package to use. This is mainly useful
           to specify an overridden version of the
diff --git a/nixos/modules/services/networking/iodine.nix b/nixos/modules/services/networking/iodine.nix
index f67e2d9a5e7..e241afe3269 100644
--- a/nixos/modules/services/networking/iodine.nix
+++ b/nixos/modules/services/networking/iodine.nix
@@ -36,7 +36,7 @@ in
           where <replaceable>name</replaceable> is the name of the
           corresponding attribute name.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           {
             foo = {
               server = "tunnel.mdomain.com";
diff --git a/nixos/modules/services/networking/ircd-hybrid/default.nix b/nixos/modules/services/networking/ircd-hybrid/default.nix
index 1f5636e4e3a..f659f3f3e8c 100644
--- a/nixos/modules/services/networking/ircd-hybrid/default.nix
+++ b/nixos/modules/services/networking/ircd-hybrid/default.nix
@@ -64,7 +64,7 @@ in
 
       rsaKey = mkOption {
         default = null;
-        example = literalExample "/root/certificates/irc.key";
+        example = literalExpression "/root/certificates/irc.key";
         type = types.nullOr types.path;
         description = "
           IRCD server RSA key.
@@ -73,7 +73,7 @@ in
 
       certificate = mkOption {
         default = null;
-        example = literalExample "/root/certificates/irc.pem";
+        example = literalExpression "/root/certificates/irc.pem";
         type = types.nullOr types.path;
         description = "
           IRCD server SSL certificate. There are some limitations - read manual.
diff --git a/nixos/modules/services/networking/iscsi/initiator.nix b/nixos/modules/services/networking/iscsi/initiator.nix
index cbc919a2f76..051c9c7bff3 100644
--- a/nixos/modules/services/networking/iscsi/initiator.nix
+++ b/nixos/modules/services/networking/iscsi/initiator.nix
@@ -23,7 +23,7 @@ in
       type = package;
       description = "openiscsi package to use";
       default = pkgs.openiscsi;
-      defaultText = "pkgs.openiscsi";
+      defaultText = literalExpression "pkgs.openiscsi";
     };
 
     extraConfig = mkOption {
diff --git a/nixos/modules/services/networking/jicofo.nix b/nixos/modules/services/networking/jicofo.nix
index 160a5fea91a..647119b9039 100644
--- a/nixos/modules/services/networking/jicofo.nix
+++ b/nixos/modules/services/networking/jicofo.nix
@@ -70,7 +70,7 @@ in
     config = mkOption {
       type = attrsOf str;
       default = { };
-      example = literalExample ''
+      example = literalExpression ''
         {
           "org.jitsi.jicofo.auth.URL" = "XMPP:jitsi-meet.example.com";
         }
diff --git a/nixos/modules/services/networking/jitsi-videobridge.nix b/nixos/modules/services/networking/jitsi-videobridge.nix
index 80f35d56e2d..dd06ad98a97 100644
--- a/nixos/modules/services/networking/jitsi-videobridge.nix
+++ b/nixos/modules/services/networking/jitsi-videobridge.nix
@@ -56,7 +56,7 @@ in
     config = mkOption {
       type = attrs;
       default = { };
-      example = literalExample ''
+      example = literalExpression ''
         {
           videobridge = {
             ice.udp.port = 5000;
@@ -82,7 +82,7 @@ in
         See <link xlink:href="https://github.com/jitsi/jitsi-videobridge/blob/master/doc/muc.md" /> for more information.
       '';
       default = { };
-      example = literalExample ''
+      example = literalExpression ''
         {
           "localhost" = {
             hostName = "localhost";
@@ -199,7 +199,7 @@ in
         Needed for monitoring jitsi.
       '';
       default = [];
-      example = literalExample "[ \"colibri\" \"rest\" ]";
+      example = literalExpression "[ \"colibri\" \"rest\" ]";
     };
   };
 
diff --git a/nixos/modules/services/networking/keepalived/vrrp-instance-options.nix b/nixos/modules/services/networking/keepalived/vrrp-instance-options.nix
index 85b9bc33772..e96dde5fa89 100644
--- a/nixos/modules/services/networking/keepalived/vrrp-instance-options.nix
+++ b/nixos/modules/services/networking/keepalived/vrrp-instance-options.nix
@@ -102,9 +102,7 @@ with lib;
         inherit lib;
       }));
       default = [];
-      example = literalExample ''
-        TODO: Example
-      '';
+      # TODO: example
       description = "Declarative vhost config";
     };
 
diff --git a/nixos/modules/services/networking/keepalived/vrrp-script-options.nix b/nixos/modules/services/networking/keepalived/vrrp-script-options.nix
index a3f794c40a8..df7a89cff8c 100644
--- a/nixos/modules/services/networking/keepalived/vrrp-script-options.nix
+++ b/nixos/modules/services/networking/keepalived/vrrp-script-options.nix
@@ -7,7 +7,7 @@ with lib.types;
 
     script = mkOption {
       type = str;
-      example = "\${pkgs.curl} -f http://localhost:80";
+      example = literalExpression ''"''${pkgs.curl} -f http://localhost:80"'';
       description = "(Path of) Script command to execute followed by args, i.e. cmd [args]...";
     };
 
diff --git a/nixos/modules/services/networking/knot.nix b/nixos/modules/services/networking/knot.nix
index 12ff89fe849..67eadbd7670 100644
--- a/nixos/modules/services/networking/knot.nix
+++ b/nixos/modules/services/networking/knot.nix
@@ -71,7 +71,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.knot-dns;
-        defaultText = "pkgs.knot-dns";
+        defaultText = literalExpression "pkgs.knot-dns";
         description = ''
           Which Knot DNS package to use
         '';
diff --git a/nixos/modules/services/networking/kresd.nix b/nixos/modules/services/networking/kresd.nix
index 6882a315f61..3a36ac7e667 100644
--- a/nixos/modules/services/networking/kresd.nix
+++ b/nixos/modules/services/networking/kresd.nix
@@ -62,8 +62,8 @@ in {
         knot-resolver package to use.
       ";
       default = pkgs.knot-resolver;
-      defaultText = "pkgs.knot-resolver";
-      example = literalExample "pkgs.knot-resolver.override { extraFeatures = true; }";
+      defaultText = literalExpression "pkgs.knot-resolver";
+      example = literalExpression "pkgs.knot-resolver.override { extraFeatures = true; }";
     };
     extraConfig = mkOption {
       type = types.lines;
diff --git a/nixos/modules/services/networking/lambdabot.nix b/nixos/modules/services/networking/lambdabot.nix
index b7c8bd008fe..3005e582455 100644
--- a/nixos/modules/services/networking/lambdabot.nix
+++ b/nixos/modules/services/networking/lambdabot.nix
@@ -27,7 +27,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.lambdabot;
-        defaultText = "pkgs.lambdabot";
+        defaultText = literalExpression "pkgs.lambdabot";
         description = "Used lambdabot package";
       };
 
diff --git a/nixos/modules/services/networking/libreswan.nix b/nixos/modules/services/networking/libreswan.nix
index 1f0423ac3d8..429167aed9d 100644
--- a/nixos/modules/services/networking/libreswan.nix
+++ b/nixos/modules/services/networking/libreswan.nix
@@ -66,7 +66,7 @@ in
       connections = mkOption {
         type = types.attrsOf types.lines;
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           { myconnection = '''
               auto=add
               left=%defaultroute
@@ -85,7 +85,7 @@ in
       policies = mkOption {
         type = types.attrsOf types.lines;
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           { private-or-clear = '''
               # Attempt opportunistic IPsec for the entire Internet
               0.0.0.0/0
diff --git a/nixos/modules/services/networking/minidlna.nix b/nixos/modules/services/networking/minidlna.nix
index c580ba47dad..c860f63efa6 100644
--- a/nixos/modules/services/networking/minidlna.nix
+++ b/nixos/modules/services/networking/minidlna.nix
@@ -39,7 +39,7 @@ in
     services.minidlna.friendlyName = mkOption {
       type = types.str;
       default = "${config.networking.hostName} MiniDLNA";
-      defaultText = "$HOSTNAME MiniDLNA";
+      defaultText = literalExpression ''"''${config.networking.hostName} MiniDLNA"'';
       example = "rpi3";
       description =
         ''
diff --git a/nixos/modules/services/networking/miredo.nix b/nixos/modules/services/networking/miredo.nix
index 2c8393fb5b4..b7f657efb71 100644
--- a/nixos/modules/services/networking/miredo.nix
+++ b/nixos/modules/services/networking/miredo.nix
@@ -25,7 +25,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.miredo;
-        defaultText = "pkgs.miredo";
+        defaultText = literalExpression "pkgs.miredo";
         description = ''
           The package to use for the miredo daemon's binary.
         '';
diff --git a/nixos/modules/services/networking/morty.nix b/nixos/modules/services/networking/morty.nix
index c627feb527b..dff2f482ca6 100644
--- a/nixos/modules/services/networking/morty.nix
+++ b/nixos/modules/services/networking/morty.nix
@@ -23,7 +23,6 @@ in
         type = types.bool;
         default = true;
         description = "Allow IPv6 HTTP requests?";
-        defaultText = "Allow IPv6 HTTP requests.";
       };
 
       key = mkOption {
@@ -33,21 +32,20 @@ in
           HMAC url validation key (hexadecimal encoded).
           Leave blank to disable. Without validation key, anyone can
           submit proxy requests. Leave blank to disable.
+          Generate with <literal>printf %s somevalue | openssl dgst -sha1 -hmac somekey</literal>
         '';
-        defaultText = "No HMAC url validation. Generate with echo -n somevalue | openssl dgst -sha1 -hmac somekey";
       };
 
       timeout = mkOption {
         type = types.int;
         default = 2;
         description = "Request timeout in seconds.";
-        defaultText = "A resource now gets 2 seconds to respond.";
       };
 
       package = mkOption {
         type = types.package;
         default = pkgs.morty;
-        defaultText = "pkgs.morty";
+        defaultText = literalExpression "pkgs.morty";
         description = "morty package to use.";
       };
 
@@ -61,7 +59,6 @@ in
         type = types.str;
         default = "127.0.0.1";
         description = "The address on which the service listens";
-        defaultText = "127.0.0.1 (localhost)";
       };
 
     };
diff --git a/nixos/modules/services/networking/mosquitto.nix b/nixos/modules/services/networking/mosquitto.nix
index 8e814ffd0b9..b0fbfc19408 100644
--- a/nixos/modules/services/networking/mosquitto.nix
+++ b/nixos/modules/services/networking/mosquitto.nix
@@ -56,7 +56,6 @@ in
 
       port = mkOption {
         default = 1883;
-        example = 1883;
         type = types.int;
         description = ''
           Port on which to listen without SSL.
@@ -95,7 +94,6 @@ in
 
         port = mkOption {
           default = 8883;
-          example = 8883;
           type = types.int;
           description = ''
             Port on which to listen with SSL.
diff --git a/nixos/modules/services/networking/murmur.nix b/nixos/modules/services/networking/murmur.nix
index f8bb878ec65..bbbe1e181bb 100644
--- a/nixos/modules/services/networking/murmur.nix
+++ b/nixos/modules/services/networking/murmur.nix
@@ -112,7 +112,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.murmur;
-        defaultText = "pkgs.murmur";
+        defaultText = literalExpression "pkgs.murmur";
         description = "Overridable attribute of the murmur package to use.";
       };
 
diff --git a/nixos/modules/services/networking/mxisd.nix b/nixos/modules/services/networking/mxisd.nix
index f29d190c626..803f0689d1f 100644
--- a/nixos/modules/services/networking/mxisd.nix
+++ b/nixos/modules/services/networking/mxisd.nix
@@ -42,7 +42,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.ma1sd;
-        defaultText = "pkgs.ma1sd";
+        defaultText = literalExpression "pkgs.ma1sd";
         description = "The mxisd/ma1sd package to use";
       };
 
diff --git a/nixos/modules/services/networking/nat.nix b/nixos/modules/services/networking/nat.nix
index 45eb500fe8c..2e58cd699b2 100644
--- a/nixos/modules/services/networking/nat.nix
+++ b/nixos/modules/services/networking/nat.nix
@@ -247,7 +247,7 @@ in
           loopbackIPs = mkOption {
             type = types.listOf types.str;
             default = [];
-            example = literalExample ''[ "55.1.2.3" ]'';
+            example = literalExpression ''[ "55.1.2.3" ]'';
             description = "Public IPs for NAT reflection; for connections to `loopbackip:sourcePort' from the host itself and from other hosts behind NAT";
           };
         };
diff --git a/nixos/modules/services/networking/nats.nix b/nixos/modules/services/networking/nats.nix
index eb0c65bc656..3e86a4f07bc 100644
--- a/nixos/modules/services/networking/nats.nix
+++ b/nixos/modules/services/networking/nats.nix
@@ -43,7 +43,6 @@ in {
 
       port = mkOption {
         default = 4222;
-        example = 4222;
         type = types.port;
         description = ''
           Port on which to listen.
@@ -67,7 +66,7 @@ in {
       settings = mkOption {
         default = { };
         type = format.type;
-        example = literalExample ''
+        example = literalExpression ''
           {
             jetstream = {
               max_mem = "1G";
diff --git a/nixos/modules/services/networking/ncdns.nix b/nixos/modules/services/networking/ncdns.nix
index c5ea5d95057..af17fc0814b 100644
--- a/nixos/modules/services/networking/ncdns.nix
+++ b/nixos/modules/services/networking/ncdns.nix
@@ -164,7 +164,7 @@ in
       settings = mkOption {
         type = configType;
         default = { };
-        example = literalExample ''
+        example = literalExpression ''
           { # enable webserver
             ncdns.httplistenaddr = ":8202";
 
diff --git a/nixos/modules/services/networking/ndppd.nix b/nixos/modules/services/networking/ndppd.nix
index 77e979a8a42..6046ac860cf 100644
--- a/nixos/modules/services/networking/ndppd.nix
+++ b/nixos/modules/services/networking/ndppd.nix
@@ -142,7 +142,7 @@ in {
         messages, and respond to them according to a set of rules.
       '';
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         {
           eth0.rules."1111::/64" = {};
         }
diff --git a/nixos/modules/services/networking/nebula.nix b/nixos/modules/services/networking/nebula.nix
index e7ebfe1b4db..de4439415cf 100644
--- a/nixos/modules/services/networking/nebula.nix
+++ b/nixos/modules/services/networking/nebula.nix
@@ -30,7 +30,7 @@ in
             package = mkOption {
               type = types.package;
               default = pkgs.nebula;
-              defaultText = "pkgs.nebula";
+              defaultText = literalExpression "pkgs.nebula";
               description = "Nebula derivation to use.";
             };
 
@@ -59,9 +59,7 @@ in
                 The static host map defines a set of hosts with fixed IP addresses on the internet (or any network).
                 A host can have multiple fixed IP addresses defined here, and nebula will try each when establishing a tunnel.
               '';
-              example = literalExample ''
-                { "192.168.100.1" = [ "100.64.22.11:4242" ]; }
-              '';
+              example = { "192.168.100.1" = [ "100.64.22.11:4242" ]; };
             };
 
             isLighthouse = mkOption {
@@ -77,7 +75,7 @@ in
                 List of IPs of lighthouse hosts this node should report to and query from. This should be empty on lighthouse
                 nodes. The IPs should be the lighthouse's Nebula IPs, not their external IPs.
               '';
-              example = ''[ "192.168.100.1" ]'';
+              example = [ "192.168.100.1" ];
             };
 
             listen.host = mkOption {
@@ -110,14 +108,14 @@ in
               type = types.listOf types.attrs;
               default = [];
               description = "Firewall rules for outbound traffic.";
-              example = ''[ { port = "any"; proto = "any"; host = "any"; } ]'';
+              example = [ { port = "any"; proto = "any"; host = "any"; } ];
             };
 
             firewall.inbound = mkOption {
               type = types.listOf types.attrs;
               default = [];
               description = "Firewall rules for inbound traffic.";
-              example = ''[ { port = "any"; proto = "any"; host = "any"; } ]'';
+              example = [ { port = "any"; proto = "any"; host = "any"; } ];
             };
 
             settings = mkOption {
@@ -128,7 +126,7 @@ in
                 <link xlink:href="https://github.com/slackhq/nebula/blob/master/examples/config.yml"/>
                 for details on supported values.
               '';
-              example = literalExample ''
+              example = literalExpression ''
                 {
                   lighthouse.dns = {
                     host = "0.0.0.0";
diff --git a/nixos/modules/services/networking/networkmanager.nix b/nixos/modules/services/networking/networkmanager.nix
index ba13f575c39..2a826e0f087 100644
--- a/nixos/modules/services/networking/networkmanager.nix
+++ b/nixos/modules/services/networking/networkmanager.nix
@@ -353,7 +353,7 @@ in {
           };
         });
         default = [];
-        example = literalExample ''
+        example = literalExpression ''
         [ {
               source = pkgs.writeText "upHook" '''
 
diff --git a/nixos/modules/services/networking/nftables.nix b/nixos/modules/services/networking/nftables.nix
index 72f37c32253..eb74d373b0a 100644
--- a/nixos/modules/services/networking/nftables.nix
+++ b/nixos/modules/services/networking/nftables.nix
@@ -32,6 +32,7 @@ in
     };
     networking.nftables.ruleset = mkOption {
       type = types.lines;
+      default = "";
       example = ''
         # Check out https://wiki.nftables.org/ for better documentation.
         # Table for both IPv4 and IPv6.
@@ -86,6 +87,7 @@ in
         name = "nftables-rules";
         text = cfg.ruleset;
       };
+      defaultText = literalDocBook ''a file with the contents of <option>networking.nftables.ruleset</option>'';
       description =
         ''
           The ruleset file to be used with nftables.  Should be in a format that
diff --git a/nixos/modules/services/networking/ngircd.nix b/nixos/modules/services/networking/ngircd.nix
index 1b631de3b02..c0b9c98fb4b 100644
--- a/nixos/modules/services/networking/ngircd.nix
+++ b/nixos/modules/services/networking/ngircd.nix
@@ -34,7 +34,7 @@ in {
         type = types.package;
 
         default = pkgs.ngircd;
-        defaultText = "pkgs.ngircd";
+        defaultText = literalExpression "pkgs.ngircd";
       };
     };
   };
diff --git a/nixos/modules/services/networking/nixops-dns.nix b/nixos/modules/services/networking/nixops-dns.nix
index 2bb1263b7fa..5e33d872ea4 100644
--- a/nixos/modules/services/networking/nixops-dns.nix
+++ b/nixos/modules/services/networking/nixops-dns.nix
@@ -34,7 +34,6 @@ in
 
           For example "ops" will resolve "vm.ops".
         '';
-        example = "ops";
         default = "ops";
       };
 
diff --git a/nixos/modules/services/networking/nntp-proxy.nix b/nixos/modules/services/networking/nntp-proxy.nix
index 0083990cff5..a5973cd5933 100644
--- a/nixos/modules/services/networking/nntp-proxy.nix
+++ b/nixos/modules/services/networking/nntp-proxy.nix
@@ -159,7 +159,6 @@ in
           options = {
             username = mkOption {
               type = types.str;
-              default = null;
               description = ''
                 Username
               '';
@@ -167,7 +166,6 @@ in
 
             passwordHash = mkOption {
               type = types.str;
-              default = null;
               example = "$6$GtzE7FrpE$wwuVgFYU.TZH4Rz.Snjxk9XGua89IeVwPQ/fEUD8eujr40q5Y021yhn0aNcsQ2Ifw.BLclyzvzgegopgKcneL0";
               description = ''
                 SHA-512 password hash (can be generated by
@@ -189,15 +187,17 @@ in
         '';
 
         default = {};
-        example = literalExample ''
-          "user1" = {
-            passwordHash = "$6$1l0t5Kn2Dk$appzivc./9l/kjq57eg5UCsBKlcfyCr0zNWYNerKoPsI1d7eAwiT0SVsOVx/CTgaBNT/u4fi2vN.iGlPfv1ek0";
-            maxConnections = 5;
-          };
-          "anotheruser" = {
-            passwordHash = "$6$6lwEsWB.TmsS$W7m1riUx4QrA8pKJz8hvff0dnF1NwtZXgdjmGqA1Dx2MDPj07tI9GNcb0SWlMglE.2/hBgynDdAd/XqqtRqVQ0";
-            maxConnections = 7;
-          };
+        example = literalExpression ''
+          {
+            "user1" = {
+              passwordHash = "$6$1l0t5Kn2Dk$appzivc./9l/kjq57eg5UCsBKlcfyCr0zNWYNerKoPsI1d7eAwiT0SVsOVx/CTgaBNT/u4fi2vN.iGlPfv1ek0";
+              maxConnections = 5;
+            };
+            "anotheruser" = {
+              passwordHash = "$6$6lwEsWB.TmsS$W7m1riUx4QrA8pKJz8hvff0dnF1NwtZXgdjmGqA1Dx2MDPj07tI9GNcb0SWlMglE.2/hBgynDdAd/XqqtRqVQ0";
+              maxConnections = 7;
+            };
+          }
         '';
       };
     };
diff --git a/nixos/modules/services/networking/nomad.nix b/nixos/modules/services/networking/nomad.nix
index 48689f1195c..3bd15bd5c80 100644
--- a/nixos/modules/services/networking/nomad.nix
+++ b/nixos/modules/services/networking/nomad.nix
@@ -13,7 +13,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.nomad;
-        defaultText = "pkgs.nomad";
+        defaultText = literalExpression "pkgs.nomad";
         description = ''
           The package used for the Nomad agent and CLI.
         '';
@@ -25,7 +25,7 @@ in
         description = ''
           Extra packages to add to <envar>PATH</envar> for the Nomad agent process.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           with pkgs; [ cni-plugins ]
         '';
       };
@@ -55,7 +55,7 @@ in
         description = ''
           Additional settings paths used to configure nomad. These can be files or directories.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           [ "/etc/nomad-mutable.json" "/run/keys/nomad-with-secrets.json" "/etc/nomad/config.d" ]
         '';
       };
@@ -81,7 +81,7 @@ in
           the <literal>DynamicUser</literal> feature of systemd which directly
           manages and operates on <literal>StateDirectory</literal>.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           {
             # A minimal config example:
             server = {
diff --git a/nixos/modules/services/networking/nsd.nix b/nixos/modules/services/networking/nsd.nix
index 2ac0a8c7922..893995165b9 100644
--- a/nixos/modules/services/networking/nsd.nix
+++ b/nixos/modules/services/networking/nsd.nix
@@ -260,7 +260,6 @@ let
       data = mkOption {
         type = types.lines;
         default = "";
-        example = "";
         description = ''
           The actual zone data. This is the content of your zone file.
           Use imports or pkgs.lib.readFile if you don't want this data in your config file.
@@ -397,7 +396,6 @@ let
       requestXFR = mkOption {
         type = types.listOf types.str;
         default = [];
-        example = [];
         description = ''
           Format: <code>[AXFR|UDP] &lt;ip-address&gt; &lt;key-name | NOKEY&gt;</code>
         '';
@@ -726,7 +724,7 @@ in
         };
       });
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         { "tsig.example.org" = {
             algorithm = "hmac-md5";
             keyFile = "/path/to/my/key";
@@ -861,7 +859,7 @@ in
     zones = mkOption {
       type = types.attrsOf zoneOptions;
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         { "serverGroup1" = {
             provideXFR = [ "10.1.2.3 NOKEY" ];
             children = {
diff --git a/nixos/modules/services/networking/ntp/chrony.nix b/nixos/modules/services/networking/ntp/chrony.nix
index ed61c178c68..d414936a2c2 100644
--- a/nixos/modules/services/networking/ntp/chrony.nix
+++ b/nixos/modules/services/networking/ntp/chrony.nix
@@ -44,7 +44,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.chrony;
-        defaultText = "pkgs.chrony";
+        defaultText = literalExpression "pkgs.chrony";
         description = ''
           Which chrony package to use.
         '';
diff --git a/nixos/modules/services/networking/ntp/ntpd.nix b/nixos/modules/services/networking/ntp/ntpd.nix
index 1dffbd78bbe..ce4802ce024 100644
--- a/nixos/modules/services/networking/ntp/ntpd.nix
+++ b/nixos/modules/services/networking/ntp/ntpd.nix
@@ -97,7 +97,7 @@ in
       extraFlags = mkOption {
         type = types.listOf types.str;
         description = "Extra flags passed to the ntpd command.";
-        example = literalExample ''[ "--interface=eth0" ]'';
+        example = literalExpression ''[ "--interface=eth0" ]'';
         default = [];
       };
 
diff --git a/nixos/modules/services/networking/ofono.nix b/nixos/modules/services/networking/ofono.nix
index 40ef9433de0..460b06443c4 100644
--- a/nixos/modules/services/networking/ofono.nix
+++ b/nixos/modules/services/networking/ofono.nix
@@ -24,7 +24,7 @@ in
       plugins = mkOption {
         type = types.listOf types.package;
         default = [];
-        example = literalExample "[ pkgs.modem-manager-gui ]";
+        example = literalExpression "[ pkgs.modem-manager-gui ]";
         description = ''
           The list of plugins to install.
         '';
diff --git a/nixos/modules/services/networking/onedrive.nix b/nixos/modules/services/networking/onedrive.nix
index c52f920bae2..0256a6a4111 100644
--- a/nixos/modules/services/networking/onedrive.nix
+++ b/nixos/modules/services/networking/onedrive.nix
@@ -35,8 +35,7 @@ in {
      package = lib.mkOption {
        type = lib.types.package;
        default = pkgs.onedrive;
-       defaultText = "pkgs.onedrive";
-       example = lib.literalExample "pkgs.onedrive";
+       defaultText = lib.literalExpression "pkgs.onedrive";
        description = ''
          OneDrive package to use.
        '';
diff --git a/nixos/modules/services/networking/openvpn.nix b/nixos/modules/services/networking/openvpn.nix
index b4c2c944b6e..cf3f79fc578 100644
--- a/nixos/modules/services/networking/openvpn.nix
+++ b/nixos/modules/services/networking/openvpn.nix
@@ -84,7 +84,7 @@ in
     services.openvpn.servers = mkOption {
       default = {};
 
-      example = literalExample ''
+      example = literalExpression ''
         {
           server = {
             config = '''
diff --git a/nixos/modules/services/networking/ostinato.nix b/nixos/modules/services/networking/ostinato.nix
index 5e8cce5b89a..4da11984b9f 100644
--- a/nixos/modules/services/networking/ostinato.nix
+++ b/nixos/modules/services/networking/ostinato.nix
@@ -65,7 +65,7 @@ in
         include = mkOption {
           type = types.listOf types.str;
           default = [];
-          example = ''[ "eth*" "lo*" ]'';
+          example = [ "eth*" "lo*" ];
           description = ''
             For a port to pass the filter and appear on the port list managed
             by drone, it be allowed by this include list.
@@ -74,7 +74,7 @@ in
         exclude = mkOption {
           type = types.listOf types.str;
           default = [];
-          example = ''[ "usbmon*" "eth0" ]'';
+          example = [ "usbmon*" "eth0" ];
           description = ''
             A list of ports does not appear on the port list managed by drone.
           '';
diff --git a/nixos/modules/services/networking/pdns-recursor.nix b/nixos/modules/services/networking/pdns-recursor.nix
index a326eccfd65..0579d314a9b 100644
--- a/nixos/modules/services/networking/pdns-recursor.nix
+++ b/nixos/modules/services/networking/pdns-recursor.nix
@@ -127,7 +127,7 @@ in {
     settings = mkOption {
       type = configType;
       default = { };
-      example = literalExample ''
+      example = literalExpression ''
         {
           loglevel = 8;
           log-common-errors = true;
diff --git a/nixos/modules/services/networking/pleroma.nix b/nixos/modules/services/networking/pleroma.nix
index 93ab29b71e5..2f32faf387c 100644
--- a/nixos/modules/services/networking/pleroma.nix
+++ b/nixos/modules/services/networking/pleroma.nix
@@ -9,6 +9,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.pleroma;
+        defaultText = literalExpression "pkgs.pleroma";
         description = "Pleroma package to use.";
       };
 
diff --git a/nixos/modules/services/networking/pppd.nix b/nixos/modules/services/networking/pppd.nix
index 37f44f07ac4..d1ed25b0238 100644
--- a/nixos/modules/services/networking/pppd.nix
+++ b/nixos/modules/services/networking/pppd.nix
@@ -16,7 +16,7 @@ in
 
       package = mkOption {
         default = pkgs.ppp;
-        defaultText = "pkgs.ppp";
+        defaultText = literalExpression "pkgs.ppp";
         type = types.package;
         description = "pppd package to use.";
       };
diff --git a/nixos/modules/services/networking/privoxy.nix b/nixos/modules/services/networking/privoxy.nix
index df818baa465..7bc964d5f34 100644
--- a/nixos/modules/services/networking/privoxy.nix
+++ b/nixos/modules/services/networking/privoxy.nix
@@ -164,7 +164,7 @@ in
         };
       };
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         { # Listen on IPv6 only
           listen-address = "[::]:8118";
 
diff --git a/nixos/modules/services/networking/prosody.nix b/nixos/modules/services/networking/prosody.nix
index e7a7aa700be..42596ccfefd 100644
--- a/nixos/modules/services/networking/prosody.nix
+++ b/nixos/modules/services/networking/prosody.nix
@@ -500,8 +500,8 @@ in
         type = types.package;
         description = "Prosody package to use";
         default = pkgs.prosody;
-        defaultText = "pkgs.prosody";
-        example = literalExample ''
+        defaultText = literalExpression "pkgs.prosody";
+        example = literalExpression ''
           pkgs.prosody.override {
             withExtraLibs = [ pkgs.luaPackages.lpty ];
             withCommunityModules = [ "auth_external" ];
diff --git a/nixos/modules/services/networking/quassel.nix b/nixos/modules/services/networking/quassel.nix
index bfbd3b46ab4..22940ef7a13 100644
--- a/nixos/modules/services/networking/quassel.nix
+++ b/nixos/modules/services/networking/quassel.nix
@@ -37,11 +37,10 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.quasselDaemon;
-        defaultText = "pkgs.quasselDaemon";
+        defaultText = literalExpression "pkgs.quasselDaemon";
         description = ''
           The package of the quassel daemon.
         '';
-        example = literalExample "pkgs.quasselDaemon";
       };
 
       interfaces = mkOption {
diff --git a/nixos/modules/services/networking/quorum.nix b/nixos/modules/services/networking/quorum.nix
index 2f612c9db68..50148dc314d 100644
--- a/nixos/modules/services/networking/quorum.nix
+++ b/nixos/modules/services/networking/quorum.nix
@@ -1,7 +1,7 @@
 { config, pkgs, lib, ... }:
 let
 
-  inherit (lib) mkEnableOption mkIf mkOption literalExample types optionalString;
+  inherit (lib) mkEnableOption mkIf mkOption literalExpression types optionalString;
 
   cfg = config.services.quorum;
   dataDir = "/var/lib/quorum";
@@ -130,7 +130,7 @@ in {
       genesis = mkOption {
         type = types.nullOr types.attrs;
         default = null;
-        example = literalExample '' {
+        example = literalExpression '' {
           alloc = {
             a47385db68718bdcbddc2d2bb7c54018066ec111 = {
               balance = "1000000000000000000000000000";
diff --git a/nixos/modules/services/networking/radicale.nix b/nixos/modules/services/networking/radicale.nix
index 368259b5b0b..c121008d529 100644
--- a/nixos/modules/services/networking/radicale.nix
+++ b/nixos/modules/services/networking/radicale.nix
@@ -33,7 +33,7 @@ in {
       # warnings about incompatible configuration and storage formats.
       type = with types; nullOr package // { inherit (package) description; };
       default = null;
-      defaultText = "pkgs.radicale";
+      defaultText = literalExpression "pkgs.radicale";
     };
 
     config = mkOption {
@@ -55,7 +55,7 @@ in {
         <link xlink:href="https://radicale.org/3.0.html#documentation/configuration" />.
         This option is mutually exclusive with <option>config</option>.
       '';
-      example = literalExample ''
+      example = literalExpression ''
         server = {
           hosts = [ "0.0.0.0:5232" "[::]:5232" ];
         };
@@ -80,7 +80,7 @@ in {
         <option>settings.rights.file</option> to approriate values.
       '';
       default = { };
-      example = literalExample ''
+      example = literalExpression ''
         root = {
           user = ".+";
           collection = "";
diff --git a/nixos/modules/services/networking/searx.nix b/nixos/modules/services/networking/searx.nix
index 04f7d7e31f4..9fb06af7442 100644
--- a/nixos/modules/services/networking/searx.nix
+++ b/nixos/modules/services/networking/searx.nix
@@ -68,7 +68,7 @@ in
       settings = mkOption {
         type = types.attrsOf settingType;
         default = { };
-        example = literalExample ''
+        example = literalExpression ''
           { server.port = 8080;
             server.bind_address = "0.0.0.0";
             server.secret_key = "@SEARX_SECRET_KEY@";
@@ -116,7 +116,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.searx;
-        defaultText = "pkgs.searx";
+        defaultText = literalExpression "pkgs.searx";
         description = "searx package to use.";
       };
 
@@ -138,7 +138,7 @@ in
       uwsgiConfig = mkOption {
         type = options.services.uwsgi.instance.type;
         default = { http = ":8080"; };
-        example = literalExample ''
+        example = literalExpression ''
           {
             disable-logging = true;
             http = ":8080";                   # serve via HTTP...
diff --git a/nixos/modules/services/networking/shadowsocks.nix b/nixos/modules/services/networking/shadowsocks.nix
index d2541f9a6df..7bea269a9ed 100644
--- a/nixos/modules/services/networking/shadowsocks.nix
+++ b/nixos/modules/services/networking/shadowsocks.nix
@@ -98,7 +98,7 @@ in
       plugin = mkOption {
         type = types.nullOr types.str;
         default = null;
-        example = "\${pkgs.shadowsocks-v2ray-plugin}/bin/v2ray-plugin";
+        example = literalExpression ''"''${pkgs.shadowsocks-v2ray-plugin}/bin/v2ray-plugin"'';
         description = ''
           SIP003 plugin for shadowsocks
         '';
@@ -116,11 +116,9 @@ in
       extraConfig = mkOption {
         type = types.attrs;
         default = {};
-        example = ''
-          {
-            nameserver = "8.8.8.8";
-          }
-        '';
+        example = {
+          nameserver = "8.8.8.8";
+        };
         description = ''
           Additional configuration for shadowsocks that is not covered by the
           provided options. The provided attrset will be serialized to JSON and
diff --git a/nixos/modules/services/networking/shellhub-agent.nix b/nixos/modules/services/networking/shellhub-agent.nix
index 4ce4b8250bc..a45ef148544 100644
--- a/nixos/modules/services/networking/shellhub-agent.nix
+++ b/nixos/modules/services/networking/shellhub-agent.nix
@@ -23,7 +23,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.shellhub-agent;
-        defaultText = "pkgs.shellhub-agent";
+        defaultText = literalExpression "pkgs.shellhub-agent";
         description = ''
           Which ShellHub Agent package to use.
         '';
diff --git a/nixos/modules/services/networking/shorewall.nix b/nixos/modules/services/networking/shorewall.nix
index 16383be2530..ac732d4b12e 100644
--- a/nixos/modules/services/networking/shorewall.nix
+++ b/nixos/modules/services/networking/shorewall.nix
@@ -22,7 +22,7 @@ in {
       package = lib.mkOption {
         type        = types.package;
         default     = pkgs.shorewall;
-        defaultText = "pkgs.shorewall";
+        defaultText = lib.literalExpression "pkgs.shorewall";
         description = "The shorewall package to use.";
       };
       configs = lib.mkOption {
diff --git a/nixos/modules/services/networking/shorewall6.nix b/nixos/modules/services/networking/shorewall6.nix
index e081aedc6c3..4235c74a3f8 100644
--- a/nixos/modules/services/networking/shorewall6.nix
+++ b/nixos/modules/services/networking/shorewall6.nix
@@ -22,7 +22,7 @@ in {
       package = lib.mkOption {
         type        = types.package;
         default     = pkgs.shorewall;
-        defaultText = "pkgs.shorewall";
+        defaultText = lib.literalExpression "pkgs.shorewall";
         description = "The shorewall package to use.";
       };
       configs = lib.mkOption {
diff --git a/nixos/modules/services/networking/skydns.nix b/nixos/modules/services/networking/skydns.nix
index ea466de9327..c4e959b57bb 100644
--- a/nixos/modules/services/networking/skydns.nix
+++ b/nixos/modules/services/networking/skydns.nix
@@ -56,7 +56,7 @@ in {
 
     package = mkOption {
       default = pkgs.skydns;
-      defaultText = "pkgs.skydns";
+      defaultText = literalExpression "pkgs.skydns";
       type = types.package;
       description = "Skydns package to use.";
     };
diff --git a/nixos/modules/services/networking/smartdns.nix b/nixos/modules/services/networking/smartdns.nix
index f84c727f034..7f9df42ce9c 100644
--- a/nixos/modules/services/networking/smartdns.nix
+++ b/nixos/modules/services/networking/smartdns.nix
@@ -32,7 +32,7 @@ in {
       type =
       let atom = oneOf [ str int bool ];
       in attrsOf (coercedTo atom toList (listOf atom));
-      example = literalExample ''
+      example = literalExpression ''
         {
           bind = ":5353 -no-rule -group example";
           cache-size = 4096;
diff --git a/nixos/modules/services/networking/smokeping.nix b/nixos/modules/services/networking/smokeping.nix
index 0f123fd1877..021368488a3 100644
--- a/nixos/modules/services/networking/smokeping.nix
+++ b/nixos/modules/services/networking/smokeping.nix
@@ -60,7 +60,7 @@ in
           to = root@localhost
           from = smokeping@localhost
         '';
-        example = literalExample ''
+        example = ''
           to = alertee@address.somewhere
           from = smokealert@company.xy
 
@@ -75,7 +75,7 @@ in
       cgiUrl = mkOption {
         type = types.str;
         default = "http://${cfg.hostName}:${toString cfg.port}/smokeping.cgi";
-        defaultText = "http://\${hostName}:\${toString port}/smokeping.cgi";
+        defaultText = literalExpression ''"http://''${hostName}:''${toString port}/smokeping.cgi"'';
         example = "https://somewhere.example.com/smokeping.cgi";
         description = "URL to the smokeping cgi.";
       };
@@ -100,7 +100,7 @@ in
               MIN  0.5 144   720
 
         '';
-        example = literalExample ''
+        example = ''
           # near constant pings.
           step     = 30
           pings    = 20
@@ -125,14 +125,14 @@ in
       hostName = mkOption {
         type = types.str;
         default = config.networking.fqdn;
-        defaultText = "\${config.networking.fqdn}";
+        defaultText = literalExpression "config.networking.fqdn";
         example = "somewhere.example.com";
         description = "DNS name for the urls generated in the cgi.";
       };
       imgUrl = mkOption {
         type = types.str;
         default = "http://${cfg.hostName}:${toString cfg.port}/cache";
-        defaultText = "http://\${hostName}:\${toString port}/cache";
+        defaultText = literalExpression ''"http://''${hostName}:''${toString port}/cache"'';
         example = "https://somewhere.example.com/cache";
         description = "Base url for images generated in the cgi.";
       };
@@ -157,20 +157,19 @@ in
       ownerEmail = mkOption {
         type = types.str;
         default = "no-reply@${cfg.hostName}";
-        defaultText = "no-reply@\${hostName}";
+        defaultText = literalExpression ''"no-reply@''${hostName}"'';
         example = "no-reply@yourdomain.com";
         description = "Email contact for owner";
       };
       package = mkOption {
         type = types.package;
         default = pkgs.smokeping;
-        defaultText = "pkgs.smokeping";
+        defaultText = literalExpression "pkgs.smokeping";
         description = "Specify a custom smokeping package";
       };
       port = mkOption {
         type = types.int;
         default = 8081;
-        example = 8081;
         description = "TCP port to use for the web server.";
       };
       presentationConfig = mkOption {
@@ -217,6 +216,7 @@ in
       presentationTemplate = mkOption {
         type = types.str;
         default = "${pkgs.smokeping}/etc/basepage.html.dist";
+        defaultText = literalExpression ''"''${pkgs.smokeping}/etc/basepage.html.dist"'';
         description = "Default page layout for the web UI.";
       };
       probeConfig = mkOption {
@@ -236,6 +236,7 @@ in
       smokeMailTemplate = mkOption {
         type = types.str;
         default = "${cfg.package}/etc/smokemail.dist";
+        defaultText = literalExpression ''"''${package}/etc/smokemail.dist"'';
         description = "Specify the smokemail template for alerts.";
       };
       targetConfig = mkOption {
diff --git a/nixos/modules/services/networking/sniproxy.nix b/nixos/modules/services/networking/sniproxy.nix
index 0345c12d3af..28c201f0565 100644
--- a/nixos/modules/services/networking/sniproxy.nix
+++ b/nixos/modules/services/networking/sniproxy.nix
@@ -34,7 +34,7 @@ in
         type = types.lines;
         default = "";
         description = "sniproxy.conf configuration excluding the daemon username and pid file.";
-        example = literalExample ''
+        example = ''
           error_log {
             filename /var/log/sniproxy/error.log
           }
@@ -47,7 +47,7 @@ in
           table {
             example.com 192.0.2.10
             example.net 192.0.2.20
-        }
+          }
         '';
       };
 
diff --git a/nixos/modules/services/networking/softether.nix b/nixos/modules/services/networking/softether.nix
index 2dc73d81b25..5405f56871e 100644
--- a/nixos/modules/services/networking/softether.nix
+++ b/nixos/modules/services/networking/softether.nix
@@ -21,7 +21,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.softether;
-        defaultText = "pkgs.softether";
+        defaultText = literalExpression "pkgs.softether";
         description = ''
           softether derivation to use.
         '';
diff --git a/nixos/modules/services/networking/spacecookie.nix b/nixos/modules/services/networking/spacecookie.nix
index e0bef9e9628..400f3e26cc9 100644
--- a/nixos/modules/services/networking/spacecookie.nix
+++ b/nixos/modules/services/networking/spacecookie.nix
@@ -30,8 +30,8 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.spacecookie;
-        defaultText = literalExample "pkgs.spacecookie";
-        example = literalExample "pkgs.haskellPackages.spacecookie";
+        defaultText = literalExpression "pkgs.spacecookie";
+        example = literalExpression "pkgs.haskellPackages.spacecookie";
         description = ''
           The spacecookie derivation to use. This can be used to
           override the used package or to use another version.
diff --git a/nixos/modules/services/networking/spiped.nix b/nixos/modules/services/networking/spiped.nix
index e60d9abf42a..3c229ecfc72 100644
--- a/nixos/modules/services/networking/spiped.nix
+++ b/nixos/modules/services/networking/spiped.nix
@@ -138,7 +138,7 @@ in
 
         default = {};
 
-        example = literalExample ''
+        example = literalExpression ''
           {
             pipe1 =
               { keyfile = "/var/lib/spiped/pipe1.key";
diff --git a/nixos/modules/services/networking/strongswan-swanctl/module.nix b/nixos/modules/services/networking/strongswan-swanctl/module.nix
index 6e619f22546..9287943fcde 100644
--- a/nixos/modules/services/networking/strongswan-swanctl/module.nix
+++ b/nixos/modules/services/networking/strongswan-swanctl/module.nix
@@ -13,7 +13,7 @@ in  {
     package = mkOption {
       type = types.package;
       default = pkgs.strongswan;
-      defaultText = "pkgs.strongswan";
+      defaultText = literalExpression "pkgs.strongswan";
       description = ''
         The strongswan derivation to use.
       '';
diff --git a/nixos/modules/services/networking/strongswan.nix b/nixos/modules/services/networking/strongswan.nix
index 401f7be4028..e3a97207be7 100644
--- a/nixos/modules/services/networking/strongswan.nix
+++ b/nixos/modules/services/networking/strongswan.nix
@@ -4,7 +4,7 @@ let
 
   inherit (builtins) toFile;
   inherit (lib) concatMapStringsSep concatStringsSep mapAttrsToList
-                mkIf mkEnableOption mkOption types literalExample;
+                mkIf mkEnableOption mkOption types literalExpression;
 
   cfg = config.services.strongswan;
 
@@ -79,7 +79,7 @@ in
     connections = mkOption {
       type = types.attrsOf (types.attrsOf types.str);
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         {
           "%default" = {
             keyexchange = "ikev2";
diff --git a/nixos/modules/services/networking/stunnel.nix b/nixos/modules/services/networking/stunnel.nix
index fe1616f411f..70d0a7d3c12 100644
--- a/nixos/modules/services/networking/stunnel.nix
+++ b/nixos/modules/services/networking/stunnel.nix
@@ -69,6 +69,7 @@ let
       CAFile = mkOption {
         type = types.nullOr types.path;
         default = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
+        defaultText = literalExpression ''"''${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"'';
         description = "Path to a file containing certificates to validate against.";
       };
 
diff --git a/nixos/modules/services/networking/supplicant.nix b/nixos/modules/services/networking/supplicant.nix
index 4f4b5cef374..eb24130e519 100644
--- a/nixos/modules/services/networking/supplicant.nix
+++ b/nixos/modules/services/networking/supplicant.nix
@@ -73,7 +73,7 @@ in
             path = mkOption {
               type = types.nullOr types.path;
               default = null;
-              example = literalExample "/etc/wpa_supplicant.conf";
+              example = literalExpression "/etc/wpa_supplicant.conf";
               description = ''
                 External <literal>wpa_supplicant.conf</literal> configuration file.
                 The configuration options defined declaratively within <literal>networking.supplicant</literal> have
@@ -170,7 +170,7 @@ in
 
       default = { };
 
-      example = literalExample ''
+      example = literalExpression ''
         { "wlan0 wlan1" = {
             configFile.path = "/etc/wpa_supplicant.conf";
             userControlled.group = "network";
diff --git a/nixos/modules/services/networking/supybot.nix b/nixos/modules/services/networking/supybot.nix
index 332c3ced06f..94b79c7e247 100644
--- a/nixos/modules/services/networking/supybot.nix
+++ b/nixos/modules/services/networking/supybot.nix
@@ -24,7 +24,7 @@ in
         default = if versionAtLeast config.system.stateVersion "20.09"
           then "/var/lib/supybot"
           else "/home/supybot";
-        defaultText = "/var/lib/supybot";
+        defaultText = literalExpression "/var/lib/supybot";
         description = "The root directory, logs and plugins are stored here";
       };
 
@@ -49,7 +49,7 @@ in
           Please note that you still need to add the plugins to the config
           file (or with <literal>!load</literal>) using their attribute name.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           let
             plugins = pkgs.fetchzip {
               url = "https://github.com/ProgVal/Supybot-plugins/archive/57c2450c.zip";
@@ -66,12 +66,13 @@ in
       extraPackages = mkOption {
         type = types.functionTo (types.listOf types.package);
         default = p: [];
+        defaultText = literalExpression "p: []";
         description = ''
           Extra Python packages available to supybot plugins. The
           value must be a function which receives the attrset defined
           in <varname>python3Packages</varname> as the sole argument.
         '';
-        example = literalExample "p: [ p.lxml p.requests ]";
+        example = literalExpression "p: [ p.lxml p.requests ]";
       };
 
     };
diff --git a/nixos/modules/services/networking/syncthing.nix b/nixos/modules/services/networking/syncthing.nix
index ebe4d89a0e7..8c44687a382 100644
--- a/nixos/modules/services/networking/syncthing.nix
+++ b/nixos/modules/services/networking/syncthing.nix
@@ -182,7 +182,7 @@ in {
           will be reverted on restart if <link linkend="opt-services.syncthing.overrideDevices">overrideDevices</link>
           is enabled.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           {
             "/home/user/sync" = {
               id = "syncme";
@@ -243,7 +243,7 @@ in {
                 There are 4 different types of versioning with different parameters.
                 See <link xlink:href="https://docs.syncthing.net/users/versioning.html"/>.
               '';
-              example = literalExample ''
+              example = literalExpression ''
                 [
                   {
                     versioning = {
@@ -430,8 +430,8 @@ in {
         description = ''
           The path where the settings and keys will exist.
         '';
-        default = cfg.dataDir + (optionalString cond "/.config/syncthing");
-        defaultText = literalExample "dataDir${optionalString cond " + \"/.config/syncthing\""}";
+        default = cfg.dataDir + optionalString cond "/.config/syncthing";
+        defaultText = literalExpression "dataDir${optionalString cond " + \"/.config/syncthing\""}";
       };
 
       extraFlags = mkOption {
@@ -461,7 +461,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.syncthing;
-        defaultText = literalExample "pkgs.syncthing";
+        defaultText = literalExpression "pkgs.syncthing";
         description = ''
           The Syncthing package to use.
         '';
diff --git a/nixos/modules/services/networking/tailscale.nix b/nixos/modules/services/networking/tailscale.nix
index 3f88ff53dff..3f41646bf01 100644
--- a/nixos/modules/services/networking/tailscale.nix
+++ b/nixos/modules/services/networking/tailscale.nix
@@ -24,7 +24,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.tailscale;
-      defaultText = "pkgs.tailscale";
+      defaultText = literalExpression "pkgs.tailscale";
       description = "The package to use for tailscale";
     };
   };
diff --git a/nixos/modules/services/networking/tedicross.nix b/nixos/modules/services/networking/tedicross.nix
index 0716975f594..c7830289dca 100644
--- a/nixos/modules/services/networking/tedicross.nix
+++ b/nixos/modules/services/networking/tedicross.nix
@@ -18,7 +18,7 @@ in {
       config = mkOption {
         type = types.attrs;
         # from https://github.com/TediCross/TediCross/blob/master/example.settings.yaml
-        example = literalExample ''
+        example = literalExpression ''
           {
             telegram = {
               useFirstNameInsteadOfUsername = false;
diff --git a/nixos/modules/services/networking/thelounge.nix b/nixos/modules/services/networking/thelounge.nix
index a1b06703484..b9449163916 100644
--- a/nixos/modules/services/networking/thelounge.nix
+++ b/nixos/modules/services/networking/thelounge.nix
@@ -32,7 +32,7 @@ in {
     extraConfig = mkOption {
       default = {};
       type = types.attrs;
-      example = literalExample ''{
+      example = literalExpression ''{
         reverseProxy = true;
         defaults = {
           name = "Your Network";
diff --git a/nixos/modules/services/networking/tinc.nix b/nixos/modules/services/networking/tinc.nix
index 22caf9f4ec5..1d77503d68b 100644
--- a/nixos/modules/services/networking/tinc.nix
+++ b/nixos/modules/services/networking/tinc.nix
@@ -226,7 +226,7 @@ in
 
             hostSettings = mkOption {
               default = { };
-              example = literalExample ''
+              example = literalExpression ''
                 {
                   host1 = {
                     addresses = [
@@ -282,7 +282,7 @@ in
             package = mkOption {
               type = types.package;
               default = pkgs.tinc_pre;
-              defaultText = "pkgs.tinc_pre";
+              defaultText = literalExpression "pkgs.tinc_pre";
               description = ''
                 The package to use for the tinc daemon's binary.
               '';
@@ -302,7 +302,7 @@ in
             settings = mkOption {
               default = { };
               type = types.submodule { freeformType = tincConfType; };
-              example = literalExample ''
+              example = literalExpression ''
                 {
                   Interface = "custom.interface";
                   DirectOnly = true;
diff --git a/nixos/modules/services/networking/toxvpn.nix b/nixos/modules/services/networking/toxvpn.nix
index 1765ef3ea2d..18cf7672d5f 100644
--- a/nixos/modules/services/networking/toxvpn.nix
+++ b/nixos/modules/services/networking/toxvpn.nix
@@ -22,7 +22,7 @@ with lib;
       auto_add_peers = mkOption {
         type        = types.listOf types.str;
         default     = [];
-        example     = ''[ "toxid1" "toxid2" ]'';
+        example     = [ "toxid1" "toxid2" ];
         description = "peers to automatically connect to on startup";
       };
     };
diff --git a/nixos/modules/services/networking/trickster.nix b/nixos/modules/services/networking/trickster.nix
index 49c945adb80..e48bba8fa58 100644
--- a/nixos/modules/services/networking/trickster.nix
+++ b/nixos/modules/services/networking/trickster.nix
@@ -20,7 +20,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.trickster;
-        defaultText = "pkgs.trickster";
+        defaultText = literalExpression "pkgs.trickster";
         description = ''
           Package that should be used for trickster.
         '';
diff --git a/nixos/modules/services/networking/ucarp.nix b/nixos/modules/services/networking/ucarp.nix
index 9b19a19687b..189e4f99cef 100644
--- a/nixos/modules/services/networking/ucarp.nix
+++ b/nixos/modules/services/networking/ucarp.nix
@@ -91,10 +91,10 @@ in {
         Command to run after become master, the interface name, virtual address
         and optional extra parameters are passed as arguments.
       '';
-      example = ''
+      example = literalExpression ''
         pkgs.writeScript "upscript" '''
           #!/bin/sh
-          $\{pkgs.iproute2\}/bin/ip addr add "$2"/24 dev "$1"
+          ''${pkgs.iproute2}/bin/ip addr add "$2"/24 dev "$1"
         ''';
       '';
     };
@@ -105,10 +105,10 @@ in {
         Command to run after become backup, the interface name, virtual address
         and optional extra parameters are passed as arguments.
       '';
-      example = ''
+      example = literalExpression ''
         pkgs.writeScript "downscript" '''
           #!/bin/sh
-          $\{pkgs.iproute2\}/bin/ip addr del "$2"/24 dev "$1"
+          ''${pkgs.iproute2}/bin/ip addr del "$2"/24 dev "$1"
         ''';
       '';
     };
@@ -152,7 +152,7 @@ in {
         upstream updates for a long time and can be considered as unmaintained.
       '';
       default = pkgs.ucarp;
-      defaultText = "pkgs.ucarp";
+      defaultText = literalExpression "pkgs.ucarp";
     };
   };
 
diff --git a/nixos/modules/services/networking/unbound.nix b/nixos/modules/services/networking/unbound.nix
index 6d7178047ea..f6e96349092 100644
--- a/nixos/modules/services/networking/unbound.nix
+++ b/nixos/modules/services/networking/unbound.nix
@@ -45,7 +45,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.unbound-with-systemd;
-        defaultText = "pkgs.unbound-with-systemd";
+        defaultText = literalExpression "pkgs.unbound-with-systemd";
         description = "The unbound package to use";
       };
 
@@ -128,7 +128,7 @@ in {
             };
           };
         };
-        example = literalExample ''
+        example = literalExpression ''
           {
             server = {
               interface = [ "127.0.0.1" ];
diff --git a/nixos/modules/services/networking/unifi.nix b/nixos/modules/services/networking/unifi.nix
index 73170ebfc90..708ea28a944 100644
--- a/nixos/modules/services/networking/unifi.nix
+++ b/nixos/modules/services/networking/unifi.nix
@@ -44,7 +44,7 @@ in
     services.unifi.jrePackage = mkOption {
       type = types.package;
       default = pkgs.jre8;
-      defaultText = "pkgs.jre8";
+      defaultText = literalExpression "pkgs.jre8";
       description = ''
         The JRE package to use. Check the release notes to ensure it is supported.
       '';
@@ -53,7 +53,7 @@ in
     services.unifi.unifiPackage = mkOption {
       type = types.package;
       default = pkgs.unifiLTS;
-      defaultText = "pkgs.unifiLTS";
+      defaultText = literalExpression "pkgs.unifiLTS";
       description = ''
         The unifi package to use.
       '';
@@ -62,7 +62,7 @@ in
     services.unifi.mongodbPackage = mkOption {
       type = types.package;
       default = pkgs.mongodb;
-      defaultText = "pkgs.mongodb";
+      defaultText = literalExpression "pkgs.mongodb";
       description = ''
         The mongodb package to use.
       '';
diff --git a/nixos/modules/services/networking/vsftpd.nix b/nixos/modules/services/networking/vsftpd.nix
index 5489f74bf03..710c2d9ca17 100644
--- a/nixos/modules/services/networking/vsftpd.nix
+++ b/nixos/modules/services/networking/vsftpd.nix
@@ -159,7 +159,7 @@ in
       userlistFile = mkOption {
         type = types.path;
         default = pkgs.writeText "userlist" (concatMapStrings (x: "${x}\n") cfg.userlist);
-        defaultText = "pkgs.writeText \"userlist\" (concatMapStrings (x: \"\${x}\n\") cfg.userlist)";
+        defaultText = literalExpression ''pkgs.writeText "userlist" (concatMapStrings (x: "''${x}\n") cfg.userlist)'';
         description = ''
           Newline separated list of names to be allowed/denied if <option>userlistEnable</option>
           is <literal>true</literal>. Meaning see <option>userlistDeny</option>.
diff --git a/nixos/modules/services/networking/websockify.nix b/nixos/modules/services/networking/websockify.nix
index 27cb47be12f..f7e014e03ef 100644
--- a/nixos/modules/services/networking/websockify.nix
+++ b/nixos/modules/services/networking/websockify.nix
@@ -21,7 +21,7 @@ let cfg = config.services.networking.websockify; in {
       sslKey = mkOption {
         description = "Path to the SSL key.";
         default = cfg.sslCert;
-        defaultText = "config.services.networking.websockify.sslCert";
+        defaultText = literalExpression "config.services.networking.websockify.sslCert";
         type = types.path;
       };
 
diff --git a/nixos/modules/services/networking/wg-quick.nix b/nixos/modules/services/networking/wg-quick.nix
index 3b76de58548..414775fc357 100644
--- a/nixos/modules/services/networking/wg-quick.nix
+++ b/nixos/modules/services/networking/wg-quick.nix
@@ -56,9 +56,7 @@ let
       };
 
       preUp = mkOption {
-        example = literalExample ''
-          ${pkgs.iproute2}/bin/ip netns add foo
-        '';
+        example = literalExpression ''"''${pkgs.iproute2}/bin/ip netns add foo"'';
         default = "";
         type = with types; coercedTo (listOf str) (concatStringsSep "\n") lines;
         description = ''
@@ -67,9 +65,7 @@ let
       };
 
       preDown = mkOption {
-        example = literalExample ''
-          ${pkgs.iproute2}/bin/ip netns del foo
-        '';
+        example = literalExpression ''"''${pkgs.iproute2}/bin/ip netns del foo"'';
         default = "";
         type = with types; coercedTo (listOf str) (concatStringsSep "\n") lines;
         description = ''
@@ -78,9 +74,7 @@ let
       };
 
       postUp = mkOption {
-        example = literalExample ''
-          ${pkgs.iproute2}/bin/ip netns add foo
-        '';
+        example = literalExpression ''"''${pkgs.iproute2}/bin/ip netns add foo"'';
         default = "";
         type = with types; coercedTo (listOf str) (concatStringsSep "\n") lines;
         description = ''
@@ -89,9 +83,7 @@ let
       };
 
       postDown = mkOption {
-        example = literalExample ''
-          ${pkgs.iproute2}/bin/ip netns del foo
-        '';
+        example = literalExpression ''"''${pkgs.iproute2}/bin/ip netns del foo"'';
         default = "";
         type = with types; coercedTo (listOf str) (concatStringsSep "\n") lines;
         description = ''
diff --git a/nixos/modules/services/networking/wireguard.nix b/nixos/modules/services/networking/wireguard.nix
index 2b51770a5aa..55b84935b6c 100644
--- a/nixos/modules/services/networking/wireguard.nix
+++ b/nixos/modules/services/networking/wireguard.nix
@@ -62,9 +62,7 @@ let
       };
 
       preSetup = mkOption {
-        example = literalExample ''
-          ${pkgs.iproute2}/bin/ip netns add foo
-        '';
+        example = literalExpression ''"''${pkgs.iproute2}/bin/ip netns add foo"'';
         default = "";
         type = with types; coercedTo (listOf str) (concatStringsSep "\n") lines;
         description = ''
@@ -73,8 +71,8 @@ let
       };
 
       postSetup = mkOption {
-        example = literalExample ''
-          printf "nameserver 10.200.100.1" | ${pkgs.openresolv}/bin/resolvconf -a wg0 -m 0
+        example = literalExpression ''
+          '''printf "nameserver 10.200.100.1" | ''${pkgs.openresolv}/bin/resolvconf -a wg0 -m 0'''
         '';
         default = "";
         type = with types; coercedTo (listOf str) (concatStringsSep "\n") lines;
@@ -82,7 +80,7 @@ let
       };
 
       postShutdown = mkOption {
-        example = literalExample "${pkgs.openresolv}/bin/resolvconf -d wg0";
+        example = literalExpression ''"''${pkgs.openresolv}/bin/resolvconf -d wg0"'';
         default = "";
         type = with types; coercedTo (listOf str) (concatStringsSep "\n") lines;
         description = "Commands called after shutting down the interface.";
diff --git a/nixos/modules/services/networking/wpa_supplicant.nix b/nixos/modules/services/networking/wpa_supplicant.nix
index 904a3db493b..4aa350d21a2 100644
--- a/nixos/modules/services/networking/wpa_supplicant.nix
+++ b/nixos/modules/services/networking/wpa_supplicant.nix
@@ -328,7 +328,7 @@ in {
               description = ''
                 Set this to <literal>true</literal> if the SSID of the network is hidden.
               '';
-              example = literalExample ''
+              example = literalExpression ''
                 { echelon = {
                     hidden = true;
                     psk = "abcdefgh";
@@ -377,7 +377,7 @@ in {
           /etc/wpa_supplicant.conf as the configuration file.
         '';
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           { echelon = {                   # SSID with no spaces or special characters
               psk = "abcdefgh";           # (password will be written to /nix/store!)
             };
diff --git a/nixos/modules/services/networking/x2goserver.nix b/nixos/modules/services/networking/x2goserver.nix
index 554e51f9d4f..d4adf6c5650 100644
--- a/nixos/modules/services/networking/x2goserver.nix
+++ b/nixos/modules/services/networking/x2goserver.nix
@@ -42,7 +42,6 @@ in {
     nxagentDefaultOptions = mkOption {
       type = types.listOf types.str;
       default = [ "-extension GLX" "-nolisten tcp" ];
-      example = [ "-extension GLX" "-nolisten tcp" ];
       description = ''
         List of default nx agent options.
       '';
@@ -55,12 +54,14 @@ in {
         x2goserver.conf ini configuration as nix attributes. See
         `x2goserver.conf(5)` for details
       '';
-      example = literalExample ''
-        superenicer = {
-          "enable" = "yes";
-          "idle-nice-level" = 19;
-        };
-        telekinesis = { "enable" = "no"; };
+      example = literalExpression ''
+        {
+          superenicer = {
+            "enable" = "yes";
+            "idle-nice-level" = 19;
+          };
+          telekinesis = { "enable" = "no"; };
+        }
       '';
     };
   };
diff --git a/nixos/modules/services/networking/xandikos.nix b/nixos/modules/services/networking/xandikos.nix
index 3c40bb956f5..4bd45a76e67 100644
--- a/nixos/modules/services/networking/xandikos.nix
+++ b/nixos/modules/services/networking/xandikos.nix
@@ -14,7 +14,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.xandikos;
-        defaultText = "pkgs.xandikos";
+        defaultText = literalExpression "pkgs.xandikos";
         description = "The Xandikos package to use.";
       };
 
@@ -45,7 +45,7 @@ in
       extraOptions = mkOption {
         default = [];
         type = types.listOf types.str;
-        example = literalExample ''
+        example = literalExpression ''
           [ "--autocreate"
             "--defaults"
             "--current-user-principal user"
diff --git a/nixos/modules/services/networking/xrdp.nix b/nixos/modules/services/networking/xrdp.nix
index 9be7c3233e2..c4f828f3c5a 100644
--- a/nixos/modules/services/networking/xrdp.nix
+++ b/nixos/modules/services/networking/xrdp.nix
@@ -47,7 +47,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.xrdp;
-        defaultText = "pkgs.xrdp";
+        defaultText = literalExpression "pkgs.xrdp";
         description = ''
           The package to use for the xrdp daemon's binary.
         '';
diff --git a/nixos/modules/services/networking/yggdrasil.nix b/nixos/modules/services/networking/yggdrasil.nix
index 47a7152f6fe..99c18ae6919 100644
--- a/nixos/modules/services/networking/yggdrasil.nix
+++ b/nixos/modules/services/networking/yggdrasil.nix
@@ -99,7 +99,7 @@ in {
       package = mkOption {
         type = package;
         default = pkgs.yggdrasil;
-        defaultText = "pkgs.yggdrasil";
+        defaultText = literalExpression "pkgs.yggdrasil";
         description = "Yggdrasil package to use.";
       };
 
diff --git a/nixos/modules/services/networking/zeronet.nix b/nixos/modules/services/networking/zeronet.nix
index a34b2d87154..3370390a4c6 100644
--- a/nixos/modules/services/networking/zeronet.nix
+++ b/nixos/modules/services/networking/zeronet.nix
@@ -1,7 +1,7 @@
 { config, lib, pkgs, ... }:
 
 let
-  inherit (lib) generators literalExample mkEnableOption mkIf mkOption recursiveUpdate types;
+  inherit (lib) generators literalExpression mkEnableOption mkIf mkOption recursiveUpdate types;
   cfg = config.services.zeronet;
   dataDir = "/var/lib/zeronet";
   configFile = pkgs.writeText "zeronet.conf" (generators.toINI {} (recursiveUpdate defaultSettings cfg.settings));
@@ -22,7 +22,7 @@ in with lib; {
     settings = mkOption {
       type = with types; attrsOf (oneOf [ str int bool (listOf str) ]);
       default = {};
-      example = literalExample "global.tor = enable;";
+      example = literalExpression "{ global.tor = enable; }";
 
       description = ''
         <filename>zeronet.conf</filename> configuration. Refer to
@@ -34,7 +34,6 @@ in with lib; {
     port = mkOption {
       type = types.port;
       default = 43110;
-      example = 43110;
       description = "Optional zeronet web UI port.";
     };
 
@@ -43,7 +42,6 @@ in with lib; {
       # read-only config file and crashes
       type = types.port;
       default = 12261;
-      example = 12261;
       description = "Zeronet fileserver port.";
     };
 
diff --git a/nixos/modules/services/networking/zerotierone.nix b/nixos/modules/services/networking/zerotierone.nix
index cf39ed065a7..3bc7d3ac0db 100644
--- a/nixos/modules/services/networking/zerotierone.nix
+++ b/nixos/modules/services/networking/zerotierone.nix
@@ -19,7 +19,6 @@ in
 
   options.services.zerotierone.port = mkOption {
     default = 9993;
-    example = 9993;
     type = types.int;
     description = ''
       Network port used by ZeroTier.
@@ -28,7 +27,7 @@ in
 
   options.services.zerotierone.package = mkOption {
     default = pkgs.zerotierone;
-    defaultText = "pkgs.zerotierone";
+    defaultText = literalExpression "pkgs.zerotierone";
     type = types.package;
     description = ''
       ZeroTier One package to use.
diff --git a/nixos/modules/services/networking/znc/default.nix b/nixos/modules/services/networking/znc/default.nix
index b872b99976c..a98f92d2d71 100644
--- a/nixos/modules/services/networking/znc/default.nix
+++ b/nixos/modules/services/networking/znc/default.nix
@@ -125,7 +125,7 @@ in
       config = mkOption {
         type = semanticTypes.zncConf;
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           {
             LoadModule = [ "webadmin" "adminlog" ];
             User.paul = {
@@ -180,7 +180,7 @@ in
 
       configFile = mkOption {
         type = types.path;
-        example = "~/.znc/configs/znc.conf";
+        example = literalExpression "~/.znc/configs/znc.conf";
         description = ''
           Configuration file for ZNC. It is recommended to use the
           <option>config</option> option instead.
@@ -195,7 +195,7 @@ in
       modulePackages = mkOption {
         type = types.listOf types.package;
         default = [ ];
-        example = literalExample "[ pkgs.zncModules.fish pkgs.zncModules.push ]";
+        example = literalExpression "[ pkgs.zncModules.fish pkgs.zncModules.push ]";
         description = ''
           A list of global znc module packages to add to znc.
         '';
diff --git a/nixos/modules/services/networking/znc/options.nix b/nixos/modules/services/networking/znc/options.nix
index be9dc78c86d..0db051126e8 100644
--- a/nixos/modules/services/networking/znc/options.nix
+++ b/nixos/modules/services/networking/znc/options.nix
@@ -44,7 +44,7 @@ let
       modules = mkOption {
         type = types.listOf types.str;
         default = [ "simple_away" ];
-        example = literalExample ''[ "simple_away" "sasl" ]'';
+        example = literalExpression ''[ "simple_away" "sasl" ]'';
         description = ''
           ZNC network modules to load.
         '';
@@ -148,7 +148,7 @@ in
           description = ''
             IRC networks to connect the user to.
           '';
-          example = literalExample ''
+          example = literalExpression ''
             {
               "libera" = {
                 server = "irc.libera.chat";
@@ -170,7 +170,7 @@ in
         };
 
         passBlock = mkOption {
-          example = literalExample ''
+          example = ''
             &lt;Pass password&gt;
                Method = sha256
                Hash = e2ce303c7ea75c571d80d8540a8699b46535be6a085be3414947d638e48d9e93
diff --git a/nixos/modules/services/printing/cupsd.nix b/nixos/modules/services/printing/cupsd.nix
index d2b36d9e754..53091d8e2a0 100644
--- a/nixos/modules/services/printing/cupsd.nix
+++ b/nixos/modules/services/printing/cupsd.nix
@@ -270,7 +270,7 @@ in
       drivers = mkOption {
         type = types.listOf types.path;
         default = [];
-        example = literalExample "with pkgs; [ gutenprint hplip splix ]";
+        example = literalExpression "with pkgs; [ gutenprint hplip splix ]";
         description = ''
           CUPS drivers to use. Drivers provided by CUPS, cups-filters,
           Ghostscript and Samba are added unconditionally. If this list contains
diff --git a/nixos/modules/services/scheduling/cron.nix b/nixos/modules/services/scheduling/cron.nix
index c28956b3bfe..1fac54003cb 100644
--- a/nixos/modules/services/scheduling/cron.nix
+++ b/nixos/modules/services/scheduling/cron.nix
@@ -52,7 +52,7 @@ in
       systemCronJobs = mkOption {
         type = types.listOf types.str;
         default = [];
-        example = literalExample ''
+        example = literalExpression ''
           [ "* * * * *  test   ls -l / > /tmp/cronout 2>&1"
             "* * * * *  eelco  echo Hello World > /home/eelco/cronout"
           ]
diff --git a/nixos/modules/services/search/elasticsearch.nix b/nixos/modules/services/search/elasticsearch.nix
index 40ebe29c9a6..6df147be0c4 100644
--- a/nixos/modules/services/search/elasticsearch.nix
+++ b/nixos/modules/services/search/elasticsearch.nix
@@ -53,7 +53,7 @@ in
     package = mkOption {
       description = "Elasticsearch package to use.";
       default = pkgs.elasticsearch;
-      defaultText = "pkgs.elasticsearch";
+      defaultText = literalExpression "pkgs.elasticsearch";
       type = types.package;
     };
 
@@ -140,7 +140,7 @@ in
       description = "Extra elasticsearch plugins";
       default = [ ];
       type = types.listOf types.package;
-      example = lib.literalExample "[ pkgs.elasticsearchPlugins.discovery-ec2 ]";
+      example = lib.literalExpression "[ pkgs.elasticsearchPlugins.discovery-ec2 ]";
     };
 
   };
diff --git a/nixos/modules/services/search/hound.nix b/nixos/modules/services/search/hound.nix
index 7a44489efe6..ef62175b0a3 100644
--- a/nixos/modules/services/search/hound.nix
+++ b/nixos/modules/services/search/hound.nix
@@ -50,7 +50,7 @@ in {
 
       package = mkOption {
         default = pkgs.hound;
-        defaultText = "pkgs.hound";
+        defaultText = literalExpression "pkgs.hound";
         type = types.package;
         description = ''
           Package for running hound.
@@ -63,16 +63,18 @@ in {
           The full configuration of the Hound daemon. Note the dbpath
           should be an absolute path to a writable location on disk.
         '';
-        example = ''
-          {
-             "max-concurrent-indexers" : 2,
-             "dbpath" : "''${services.hound.home}/data",
-             "repos" : {
-                "nixpkgs": {
-                   "url" : "https://www.github.com/NixOS/nixpkgs.git"
-                }
-             }
-          }
+        example = literalExpression ''
+          '''
+            {
+              "max-concurrent-indexers" : 2,
+              "dbpath" : "''${services.hound.home}/data",
+              "repos" : {
+                  "nixpkgs": {
+                    "url" : "https://www.github.com/NixOS/nixpkgs.git"
+                  }
+              }
+            }
+          '''
         '';
       };
 
diff --git a/nixos/modules/services/search/kibana.nix b/nixos/modules/services/search/kibana.nix
index b3093abfa5c..381f5156ceb 100644
--- a/nixos/modules/services/search/kibana.nix
+++ b/nixos/modules/services/search/kibana.nix
@@ -149,8 +149,7 @@ in {
     package = mkOption {
       description = "Kibana package to use";
       default = pkgs.kibana;
-      defaultText = "pkgs.kibana";
-      example = "pkgs.kibana";
+      defaultText = literalExpression "pkgs.kibana";
       type = types.package;
     };
 
diff --git a/nixos/modules/services/search/solr.nix b/nixos/modules/services/search/solr.nix
index a8615a20a1c..ea76bfc9298 100644
--- a/nixos/modules/services/search/solr.nix
+++ b/nixos/modules/services/search/solr.nix
@@ -16,7 +16,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.solr;
-        defaultText = "pkgs.solr";
+        defaultText = literalExpression "pkgs.solr";
         description = "Which Solr package to use.";
       };
 
diff --git a/nixos/modules/services/security/certmgr.nix b/nixos/modules/services/security/certmgr.nix
index 94c0ba14117..d302a4e0002 100644
--- a/nixos/modules/services/security/certmgr.nix
+++ b/nixos/modules/services/security/certmgr.nix
@@ -40,7 +40,7 @@ in
     package = mkOption {
       type = types.package;
       default = pkgs.certmgr;
-      defaultText = "pkgs.certmgr";
+      defaultText = literalExpression "pkgs.certmgr";
       description = "Which certmgr package to use in the service.";
     };
 
@@ -76,7 +76,7 @@ in
 
     specs = mkOption {
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
       {
         exampleCert =
         let
diff --git a/nixos/modules/services/security/cfssl.nix b/nixos/modules/services/security/cfssl.nix
index ee6d5d91fe1..e5bed0a9987 100644
--- a/nixos/modules/services/security/cfssl.nix
+++ b/nixos/modules/services/security/cfssl.nix
@@ -27,13 +27,13 @@ in {
     };
 
     ca = mkOption {
-      defaultText = "\${cfg.dataDir}/ca.pem";
+      defaultText = literalExpression ''"''${cfg.dataDir}/ca.pem"'';
       type = types.str;
       description = "CA used to sign the new certificate -- accepts '[file:]fname' or 'env:varname'.";
     };
 
     caKey = mkOption {
-      defaultText = "file:\${cfg.dataDir}/ca-key.pem";
+      defaultText = literalExpression ''"file:''${cfg.dataDir}/ca-key.pem"'';
       type = types.str;
       description = "CA private key -- accepts '[file:]fname' or 'env:varname'.";
     };
diff --git a/nixos/modules/services/security/fail2ban.nix b/nixos/modules/services/security/fail2ban.nix
index 499d3466750..67e1026dcef 100644
--- a/nixos/modules/services/security/fail2ban.nix
+++ b/nixos/modules/services/security/fail2ban.nix
@@ -55,22 +55,24 @@ in
 
       package = mkOption {
         default = pkgs.fail2ban;
+        defaultText = literalExpression "pkgs.fail2ban";
         type = types.package;
-        example = "pkgs.fail2ban_0_11";
+        example = literalExpression "pkgs.fail2ban_0_11";
         description = "The fail2ban package to use for running the fail2ban service.";
       };
 
       packageFirewall = mkOption {
         default = pkgs.iptables;
+        defaultText = literalExpression "pkgs.iptables";
         type = types.package;
-        example = "pkgs.nftables";
+        example = literalExpression "pkgs.nftables";
         description = "The firewall package used by fail2ban service.";
       };
 
       extraPackages = mkOption {
         default = [];
         type = types.listOf types.package;
-        example = lib.literalExample "[ pkgs.ipset ]";
+        example = lib.literalExpression "[ pkgs.ipset ]";
         description = ''
           Extra packages to be made available to the fail2ban service. The example contains
           the packages needed by the `iptables-ipset-proto6` action.
@@ -202,7 +204,7 @@ in
 
       jails = mkOption {
         default = { };
-        example = literalExample ''
+        example = literalExpression ''
           { apache-nohome-iptables = '''
               # Block an IP address if it accesses a non-existent
               # home directory more than 5 times in 10 minutes,
diff --git a/nixos/modules/services/security/fprintd.nix b/nixos/modules/services/security/fprintd.nix
index fe0fba5b45d..87c3f1f6f9e 100644
--- a/nixos/modules/services/security/fprintd.nix
+++ b/nixos/modules/services/security/fprintd.nix
@@ -23,7 +23,7 @@ in
       package = mkOption {
         type = types.package;
         default = fprintdPkg;
-        defaultText = "if cfg.tod.enable then pkgs.fprintd-tod else pkgs.fprintd";
+        defaultText = literalExpression "if config.services.fprintd.tod.enable then pkgs.fprintd-tod else pkgs.fprintd";
         description = ''
           fprintd package to use.
         '';
@@ -35,7 +35,7 @@ in
 
         driver = mkOption {
           type = types.package;
-          example = literalExample "pkgs.libfprint-2-tod1-goodix";
+          example = literalExpression "pkgs.libfprint-2-tod1-goodix";
           description = ''
             Touch OEM Drivers (TOD) package to use.
           '';
diff --git a/nixos/modules/services/security/haka.nix b/nixos/modules/services/security/haka.nix
index 618e689924f..2cfc05f3033 100644
--- a/nixos/modules/services/security/haka.nix
+++ b/nixos/modules/services/security/haka.nix
@@ -59,7 +59,7 @@ in
 
       package = mkOption {
         default = pkgs.haka;
-        defaultText = "pkgs.haka";
+        defaultText = literalExpression "pkgs.haka";
         type = types.package;
         description = "
           Which Haka derivation to use.
diff --git a/nixos/modules/services/security/hockeypuck.nix b/nixos/modules/services/security/hockeypuck.nix
index 2e98624bb2e..d0e152934f5 100644
--- a/nixos/modules/services/security/hockeypuck.nix
+++ b/nixos/modules/services/security/hockeypuck.nix
@@ -18,7 +18,7 @@ in {
     settings = lib.mkOption {
       type = settingsFormat.type;
       default = { };
-      example = lib.literalExample ''
+      example = lib.literalExpression ''
         {
           hockeypuck = {
             loglevel = "INFO";
diff --git a/nixos/modules/services/security/nginx-sso.nix b/nixos/modules/services/security/nginx-sso.nix
index 50d250fc4d7..b4de1d36edd 100644
--- a/nixos/modules/services/security/nginx-sso.nix
+++ b/nixos/modules/services/security/nginx-sso.nix
@@ -13,7 +13,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.nginx-sso;
-      defaultText = "pkgs.nginx-sso";
+      defaultText = literalExpression "pkgs.nginx-sso";
       description = ''
         The nginx-sso package that should be used.
       '';
@@ -22,7 +22,7 @@ in {
     configuration = mkOption {
       type = types.attrsOf types.unspecified;
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         {
           listen = { addr = "127.0.0.1"; port = 8080; };
 
diff --git a/nixos/modules/services/security/oauth2_proxy.nix b/nixos/modules/services/security/oauth2_proxy.nix
index e85fd4b75df..4d356242417 100644
--- a/nixos/modules/services/security/oauth2_proxy.nix
+++ b/nixos/modules/services/security/oauth2_proxy.nix
@@ -91,7 +91,7 @@ in
     package = mkOption {
       type = types.package;
       default = pkgs.oauth2-proxy;
-      defaultText = "pkgs.oauth2-proxy";
+      defaultText = literalExpression "pkgs.oauth2-proxy";
       description = ''
         The package that provides oauth2-proxy.
       '';
diff --git a/nixos/modules/services/security/privacyidea.nix b/nixos/modules/services/security/privacyidea.nix
index 5f894d0fa69..e78c4383e4b 100644
--- a/nixos/modules/services/security/privacyidea.nix
+++ b/nixos/modules/services/security/privacyidea.nix
@@ -169,7 +169,6 @@ in
 
         configFile = mkOption {
           type = types.path;
-          default = "";
           description = ''
             Path to PrivacyIDEA LDAP Proxy configuration (proxy.ini).
           '';
diff --git a/nixos/modules/services/security/shibboleth-sp.nix b/nixos/modules/services/security/shibboleth-sp.nix
index 5908f727d53..fea2a855e20 100644
--- a/nixos/modules/services/security/shibboleth-sp.nix
+++ b/nixos/modules/services/security/shibboleth-sp.nix
@@ -14,7 +14,7 @@ in {
 
       configFile = mkOption {
         type = types.path;
-        example = "${pkgs.shibboleth-sp}/etc/shibboleth/shibboleth2.xml";
+        example = literalExpression ''"''${pkgs.shibboleth-sp}/etc/shibboleth/shibboleth2.xml"'';
         description = "Path to shibboleth config file";
       };
 
diff --git a/nixos/modules/services/security/sks.nix b/nixos/modules/services/security/sks.nix
index a91060dc659..f4911597564 100644
--- a/nixos/modules/services/security/sks.nix
+++ b/nixos/modules/services/security/sks.nix
@@ -23,7 +23,7 @@ in {
 
       package = mkOption {
         default = pkgs.sks;
-        defaultText = "pkgs.sks";
+        defaultText = literalExpression "pkgs.sks";
         type = types.package;
         description = "Which SKS derivation to use.";
       };
@@ -74,7 +74,7 @@ in {
       webroot = mkOption {
         type = types.nullOr types.path;
         default = "${sksPkg.webSamples}/OpenPKG";
-        defaultText = "\${pkgs.sks.webSamples}/OpenPKG";
+        defaultText = literalExpression ''"''${package.webSamples}/OpenPKG"'';
         description = ''
           Source directory (will be symlinked, if not null) for the files the
           built-in webserver should serve. SKS (''${pkgs.sks.webSamples})
diff --git a/nixos/modules/services/security/step-ca.nix b/nixos/modules/services/security/step-ca.nix
index 64eee11f588..2eccc30e405 100644
--- a/nixos/modules/services/security/step-ca.nix
+++ b/nixos/modules/services/security/step-ca.nix
@@ -13,6 +13,7 @@ in
       package = lib.mkOption {
         type = lib.types.package;
         default = pkgs.step-ca;
+        defaultText = lib.literalExpression "pkgs.step-ca";
         description = "Which step-ca package to use.";
       };
       address = lib.mkOption {
diff --git a/nixos/modules/services/security/tor.nix b/nixos/modules/services/security/tor.nix
index 1e1f443905d..c94b248d5f1 100644
--- a/nixos/modules/services/security/tor.nix
+++ b/nixos/modules/services/security/tor.nix
@@ -232,8 +232,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.tor;
-        defaultText = "pkgs.tor";
-        example = literalExample "pkgs.tor";
+        defaultText = literalExpression "pkgs.tor";
         description = "Tor package to use.";
       };
 
diff --git a/nixos/modules/services/security/usbguard.nix b/nixos/modules/services/security/usbguard.nix
index 4cdb3a041b5..201b37f17ba 100644
--- a/nixos/modules/services/security/usbguard.nix
+++ b/nixos/modules/services/security/usbguard.nix
@@ -44,7 +44,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.usbguard;
-        defaultText = "pkgs.usbguard";
+        defaultText = literalExpression "pkgs.usbguard";
         description = ''
           The usbguard package to use. If you do not need the Qt GUI, use
           <literal>pkgs.usbguard-nox</literal> to save disk space.
diff --git a/nixos/modules/services/security/vault.nix b/nixos/modules/services/security/vault.nix
index 5a20f6413b1..b0ade62d97c 100644
--- a/nixos/modules/services/security/vault.nix
+++ b/nixos/modules/services/security/vault.nix
@@ -42,7 +42,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.vault;
-        defaultText = "pkgs.vault";
+        defaultText = literalExpression "pkgs.vault";
         description = "This option specifies the vault package to use.";
       };
 
diff --git a/nixos/modules/services/security/vaultwarden/default.nix b/nixos/modules/services/security/vaultwarden/default.nix
index d28ea61e66a..5b951bc85ec 100644
--- a/nixos/modules/services/security/vaultwarden/default.nix
+++ b/nixos/modules/services/security/vaultwarden/default.nix
@@ -60,7 +60,7 @@ in {
     config = mkOption {
       type = attrsOf (nullOr (oneOf [ bool int str ]));
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         {
           domain = "https://bw.domain.tld:8443";
           signupsAllowed = true;
@@ -106,14 +106,14 @@ in {
     package = mkOption {
       type = package;
       default = pkgs.vaultwarden;
-      defaultText = "pkgs.vaultwarden";
+      defaultText = literalExpression "pkgs.vaultwarden";
       description = "Vaultwarden package to use.";
     };
 
     webVaultPackage = mkOption {
       type = package;
       default = pkgs.vaultwarden-vault;
-      defaultText = "pkgs.vaultwarden-vault";
+      defaultText = literalExpression "pkgs.vaultwarden-vault";
       description = "Web vault package to use.";
     };
   };
diff --git a/nixos/modules/services/security/yubikey-agent.nix b/nixos/modules/services/security/yubikey-agent.nix
index 2972c64a364..8a2f98d0412 100644
--- a/nixos/modules/services/security/yubikey-agent.nix
+++ b/nixos/modules/services/security/yubikey-agent.nix
@@ -33,7 +33,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.yubikey-agent;
-        defaultText = "pkgs.yubikey-agent";
+        defaultText = literalExpression "pkgs.yubikey-agent";
         description = ''
           The package used for the yubikey-agent daemon.
         '';
diff --git a/nixos/modules/services/system/saslauthd.nix b/nixos/modules/services/system/saslauthd.nix
index 8fcf4fb91fc..466b0ca60a7 100644
--- a/nixos/modules/services/system/saslauthd.nix
+++ b/nixos/modules/services/system/saslauthd.nix
@@ -20,7 +20,7 @@ in
 
       package = mkOption {
         default = pkgs.cyrus_sasl.bin;
-        defaultText = "pkgs.cyrus_sasl.bin";
+        defaultText = literalExpression "pkgs.cyrus_sasl.bin";
         type = types.package;
         description = "Cyrus SASL package to use.";
       };
diff --git a/nixos/modules/services/torrent/deluge.nix b/nixos/modules/services/torrent/deluge.nix
index 151a1dd638d..cb0da9e83b4 100644
--- a/nixos/modules/services/torrent/deluge.nix
+++ b/nixos/modules/services/torrent/deluge.nix
@@ -50,7 +50,7 @@ in {
         config = mkOption {
           type = types.attrs;
           default = {};
-          example = literalExample ''
+          example = literalExpression ''
             {
               download_location = "/srv/torrents/";
               max_upload_speed = "1000.0";
@@ -149,7 +149,7 @@ in {
 
         package = mkOption {
           type = types.package;
-          example = literalExample "pkgs.deluge-2_x";
+          example = literalExpression "pkgs.deluge-2_x";
           description = ''
             Deluge package to use.
           '';
diff --git a/nixos/modules/services/torrent/flexget.nix b/nixos/modules/services/torrent/flexget.nix
index 6ac85f8fa17..e500e02d861 100644
--- a/nixos/modules/services/torrent/flexget.nix
+++ b/nixos/modules/services/torrent/flexget.nix
@@ -39,7 +39,7 @@ in {
 
       systemScheduler = mkOption {
         default = true;
-        example = "false";
+        example = false;
         type = types.bool;
         description = "When true, execute the runs via the flexget-runner.timer. If false, you have to specify the settings yourself in the YML file.";
       };
diff --git a/nixos/modules/services/torrent/magnetico.nix b/nixos/modules/services/torrent/magnetico.nix
index ada6f9b1e3a..3dd7b1ece76 100644
--- a/nixos/modules/services/torrent/magnetico.nix
+++ b/nixos/modules/services/torrent/magnetico.nix
@@ -111,7 +111,7 @@ in {
     web.credentials = mkOption {
       type = types.attrsOf types.str;
       default = {};
-      example = lib.literalExample ''
+      example = lib.literalExpression ''
         {
           myuser = "$2y$12$YE01LZ8jrbQbx6c0s2hdZO71dSjn2p/O9XsYJpz.5968yCysUgiaG";
         }
diff --git a/nixos/modules/services/torrent/opentracker.nix b/nixos/modules/services/torrent/opentracker.nix
index 74f443381d9..d76d61dfe85 100644
--- a/nixos/modules/services/torrent/opentracker.nix
+++ b/nixos/modules/services/torrent/opentracker.nix
@@ -13,7 +13,7 @@ in {
         opentracker package to use
       '';
       default = pkgs.opentracker;
-      defaultText = "pkgs.opentracker";
+      defaultText = literalExpression "pkgs.opentracker";
     };
 
     extraOptions = mkOption {
diff --git a/nixos/modules/services/torrent/rtorrent.nix b/nixos/modules/services/torrent/rtorrent.nix
index be57c03b172..dd7df623c73 100644
--- a/nixos/modules/services/torrent/rtorrent.nix
+++ b/nixos/modules/services/torrent/rtorrent.nix
@@ -45,7 +45,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.rtorrent;
-      defaultText = "pkgs.rtorrent";
+      defaultText = literalExpression "pkgs.rtorrent";
       description = ''
         The rtorrent package to use.
       '';
diff --git a/nixos/modules/services/ttys/getty.nix b/nixos/modules/services/ttys/getty.nix
index eb966c37ce7..8c5b6e5e0cb 100644
--- a/nixos/modules/services/ttys/getty.nix
+++ b/nixos/modules/services/ttys/getty.nix
@@ -42,6 +42,7 @@ in
       loginProgram = mkOption {
         type = types.path;
         default = "${pkgs.shadow}/bin/login";
+        defaultText = literalExpression ''"''${pkgs.shadow}/bin/login"'';
         description = ''
           Path to the login binary executed by agetty.
         '';
diff --git a/nixos/modules/services/video/epgstation/default.nix b/nixos/modules/services/video/epgstation/default.nix
index b13393c8983..e34b6e0510a 100644
--- a/nixos/modules/services/video/epgstation/default.nix
+++ b/nixos/modules/services/video/epgstation/default.nix
@@ -126,6 +126,7 @@ in
       passwordFile = mkOption {
         type = types.path;
         default = pkgs.writeText "epgstation-password" defaultPassword;
+        defaultText = literalDocBook ''a file containing <literal>${defaultPassword}</literal>'';
         example = "/run/keys/epgstation-password";
         description = ''
           A file containing the password for <option>basicAuth.user</option>.
@@ -145,6 +146,7 @@ in
       passwordFile = mkOption {
         type = types.path;
         default = pkgs.writeText "epgstation-db-password" defaultPassword;
+        defaultText = literalDocBook ''a file containing <literal>${defaultPassword}</literal>'';
         example = "/run/keys/epgstation-db-password";
         description = ''
           A file containing the password for the database named
@@ -189,14 +191,33 @@ in
           type = with types; listOf attrs;
           description = "Encoding presets for recorded videos.";
           default = [
-            { name = "H264";
+            {
+              name = "H264";
               cmd = "${pkgs.epgstation}/libexec/enc.sh main";
               suffix = ".mp4";
-              default = true; }
-            { name = "H264-sub";
+              default = true;
+            }
+            {
+              name = "H264-sub";
               cmd = "${pkgs.epgstation}/libexec/enc.sh sub";
-              suffix = "-sub.mp4"; }
+              suffix = "-sub.mp4";
+            }
           ];
+          defaultText = literalExpression ''
+            [
+              {
+                name = "H264";
+                cmd = "''${pkgs.epgstation}/libexec/enc.sh main";
+                suffix = ".mp4";
+                default = true;
+              }
+              {
+                name = "H264-sub";
+                cmd = "''${pkgs.epgstation}/libexec/enc.sh sub";
+                suffix = "-sub.mp4";
+              }
+            ]
+          '';
         };
       };
     };
diff --git a/nixos/modules/services/video/mirakurun.nix b/nixos/modules/services/video/mirakurun.nix
index 1a99d1c9769..16efb56cfd6 100644
--- a/nixos/modules/services/video/mirakurun.nix
+++ b/nixos/modules/services/video/mirakurun.nix
@@ -72,7 +72,7 @@ in
         serverSettings = mkOption {
           type = settingsFmt.type;
           default = {};
-          example = literalExample ''
+          example = literalExpression ''
             {
               highWaterMark = 25165824;
               overflowTimeLimit = 30000;
@@ -89,7 +89,7 @@ in
         tunerSettings = mkOption {
           type = with types; nullOr settingsFmt.type;
           default = null;
-          example = literalExample ''
+          example = literalExpression ''
             [
               {
                 name = "tuner-name";
@@ -110,7 +110,7 @@ in
         channelSettings = mkOption {
           type = with types; nullOr settingsFmt.type;
           default = null;
-          example = literalExample ''
+          example = literalExpression ''
             [
               {
                 name = "channel";
diff --git a/nixos/modules/services/video/replay-sorcery.nix b/nixos/modules/services/video/replay-sorcery.nix
index 7ce5be8a5a1..abe7202a4a8 100644
--- a/nixos/modules/services/video/replay-sorcery.nix
+++ b/nixos/modules/services/video/replay-sorcery.nix
@@ -26,7 +26,7 @@ in
         type = attrsOf (oneOf [ str int ]);
         default = {};
         description = "System-wide configuration for ReplaySorcery (/etc/replay-sorcery.conf).";
-        example = literalExample ''
+        example = literalExpression ''
           {
             videoInput = "hwaccel"; # requires `services.replay-sorcery.enableSysAdminCapability = true`
             videoFramerate = 60;
diff --git a/nixos/modules/services/video/unifi-video.nix b/nixos/modules/services/video/unifi-video.nix
index d4c0268ed66..17971b23db8 100644
--- a/nixos/modules/services/video/unifi-video.nix
+++ b/nixos/modules/services/video/unifi-video.nix
@@ -104,7 +104,7 @@ in
       jrePackage = mkOption {
         type = types.package;
         default = pkgs.jre8;
-        defaultText = "pkgs.jre8";
+        defaultText = literalExpression "pkgs.jre8";
         description = ''
           The JRE package to use. Check the release notes to ensure it is supported.
         '';
@@ -113,7 +113,7 @@ in
       unifiVideoPackage = mkOption {
         type = types.package;
         default = pkgs.unifi-video;
-        defaultText = "pkgs.unifi-video";
+        defaultText = literalExpression "pkgs.unifi-video";
         description = ''
           The unifi-video package to use.
         '';
@@ -122,7 +122,7 @@ in
       mongodbPackage = mkOption {
         type = types.package;
         default = pkgs.mongodb-4_0;
-        defaultText = "pkgs.mongodb";
+        defaultText = literalExpression "pkgs.mongodb";
         description = ''
           The mongodb package to use.
         '';
diff --git a/nixos/modules/services/wayland/cage.nix b/nixos/modules/services/wayland/cage.nix
index bd97a674eb8..273693a3b2f 100644
--- a/nixos/modules/services/wayland/cage.nix
+++ b/nixos/modules/services/wayland/cage.nix
@@ -18,7 +18,7 @@ in {
   options.services.cage.extraArguments = mkOption {
     type = types.listOf types.str;
     default = [];
-    defaultText = "[]";
+    defaultText = literalExpression "[]";
     description = "Additional command line arguments to pass to Cage.";
     example = ["-d"];
   };
@@ -26,6 +26,7 @@ in {
   options.services.cage.program = mkOption {
     type = types.path;
     default = "${pkgs.xterm}/bin/xterm";
+    defaultText = literalExpression ''"''${pkgs.xterm}/bin/xterm"'';
     description = ''
       Program to run in cage.
     '';
diff --git a/nixos/modules/services/web-apps/atlassian/confluence.nix b/nixos/modules/services/web-apps/atlassian/confluence.nix
index 59185fdbd36..2d809c17ff0 100644
--- a/nixos/modules/services/web-apps/atlassian/confluence.nix
+++ b/nixos/modules/services/web-apps/atlassian/confluence.nix
@@ -128,14 +128,14 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.atlassian-confluence;
-        defaultText = "pkgs.atlassian-confluence";
+        defaultText = literalExpression "pkgs.atlassian-confluence";
         description = "Atlassian Confluence package to use.";
       };
 
       jrePackage = mkOption {
         type = types.package;
         default = pkgs.oraclejre8;
-        defaultText = "pkgs.oraclejre8";
+        defaultText = literalExpression "pkgs.oraclejre8";
         description = "Note that Atlassian only support the Oracle JRE (JRASERVER-46152).";
       };
     };
diff --git a/nixos/modules/services/web-apps/atlassian/crowd.nix b/nixos/modules/services/web-apps/atlassian/crowd.nix
index ceab656b15e..a8b2482d5a9 100644
--- a/nixos/modules/services/web-apps/atlassian/crowd.nix
+++ b/nixos/modules/services/web-apps/atlassian/crowd.nix
@@ -96,14 +96,14 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.atlassian-crowd;
-        defaultText = "pkgs.atlassian-crowd";
+        defaultText = literalExpression "pkgs.atlassian-crowd";
         description = "Atlassian Crowd package to use.";
       };
 
       jrePackage = mkOption {
         type = types.package;
         default = pkgs.oraclejre8;
-        defaultText = "pkgs.oraclejre8";
+        defaultText = literalExpression "pkgs.oraclejre8";
         description = "Note that Atlassian only support the Oracle JRE (JRASERVER-46152).";
       };
     };
diff --git a/nixos/modules/services/web-apps/atlassian/jira.nix b/nixos/modules/services/web-apps/atlassian/jira.nix
index ce04982e8a9..d7a26838d6f 100644
--- a/nixos/modules/services/web-apps/atlassian/jira.nix
+++ b/nixos/modules/services/web-apps/atlassian/jira.nix
@@ -134,14 +134,14 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.atlassian-jira;
-        defaultText = "pkgs.atlassian-jira";
+        defaultText = literalExpression "pkgs.atlassian-jira";
         description = "Atlassian JIRA package to use.";
       };
 
       jrePackage = mkOption {
         type = types.package;
         default = pkgs.oraclejre8;
-        defaultText = "pkgs.oraclejre8";
+        defaultText = literalExpression "pkgs.oraclejre8";
         description = "Note that Atlassian only support the Oracle JRE (JRASERVER-46152).";
       };
     };
diff --git a/nixos/modules/services/web-apps/bookstack.nix b/nixos/modules/services/web-apps/bookstack.nix
index 34a31af9c9d..74eeb2faa4a 100644
--- a/nixos/modules/services/web-apps/bookstack.nix
+++ b/nixos/modules/services/web-apps/bookstack.nix
@@ -91,7 +91,7 @@ in {
       user = mkOption {
         type = types.str;
         default = user;
-        defaultText = "\${user}";
+        defaultText = literalExpression "user";
         description = "Database username.";
       };
       passwordFile = mkOption {
@@ -187,14 +187,16 @@ in {
           (import ../web-servers/nginx/vhost-options.nix { inherit config lib; }) {}
       );
       default = {};
-      example = {
-        serverAliases = [
-          "bookstack.\${config.networking.domain}"
-        ];
-        # To enable encryption and let let's encrypt take care of certificate
-        forceSSL = true;
-        enableACME = true;
-      };
+      example = literalExpression ''
+        {
+          serverAliases = [
+            "bookstack.''${config.networking.domain}"
+          ];
+          # To enable encryption and let let's encrypt take care of certificate
+          forceSSL = true;
+          enableACME = true;
+        }
+      '';
       description = ''
         With this option, you can customize the nginx virtualHost settings.
       '';
diff --git a/nixos/modules/services/web-apps/cryptpad.nix b/nixos/modules/services/web-apps/cryptpad.nix
index 69a89107d31..e6772de768e 100644
--- a/nixos/modules/services/web-apps/cryptpad.nix
+++ b/nixos/modules/services/web-apps/cryptpad.nix
@@ -11,7 +11,7 @@ in
 
     package = mkOption {
       default = pkgs.cryptpad;
-      defaultText = "pkgs.cryptpad";
+      defaultText = literalExpression "pkgs.cryptpad";
       type = types.package;
       description = "
         Cryptpad package to use.
@@ -21,7 +21,7 @@ in
     configFile = mkOption {
       type = types.path;
       default = "${cfg.package}/lib/node_modules/cryptpad/config/config.example.js";
-      defaultText = "\${cfg.package}/lib/node_modules/cryptpad/config/config.example.js";
+      defaultText = literalExpression ''"''${package}/lib/node_modules/cryptpad/config/config.example.js"'';
       description = ''
         Path to the JavaScript configuration file.
 
diff --git a/nixos/modules/services/web-apps/dex.nix b/nixos/modules/services/web-apps/dex.nix
index 2b5999706d7..f08dd65bdb0 100644
--- a/nixos/modules/services/web-apps/dex.nix
+++ b/nixos/modules/services/web-apps/dex.nix
@@ -23,7 +23,7 @@ in
     settings = mkOption {
       type = settingsFormat.type;
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         {
           # External url
           issuer = "http://127.0.0.1:5556/dex";
diff --git a/nixos/modules/services/web-apps/discourse.nix b/nixos/modules/services/web-apps/discourse.nix
index b28e3cf0deb..c4fb7e2b316 100644
--- a/nixos/modules/services/web-apps/discourse.nix
+++ b/nixos/modules/services/web-apps/discourse.nix
@@ -33,7 +33,7 @@ in
         apply = p: p.override {
           plugins = lib.unique (p.enabledPlugins ++ cfg.plugins);
         };
-        defaultText = "pkgs.discourse";
+        defaultText = lib.literalExpression "pkgs.discourse";
         description = ''
           The discourse package to use.
         '';
@@ -45,7 +45,7 @@ in
                     config.networking.fqdn
                   else
                     config.networking.hostName;
-        defaultText = "config.networking.fqdn";
+        defaultText = lib.literalExpression "config.networking.fqdn";
         example = "discourse.example.com";
         description = ''
           The hostname to serve Discourse on.
@@ -99,7 +99,10 @@ in
       enableACME = lib.mkOption {
         type = lib.types.bool;
         default = cfg.sslCertificate == null && cfg.sslCertificateKey == null;
-        defaultText = "true, unless services.discourse.sslCertificate and services.discourse.sslCertificateKey are set.";
+        defaultText = lib.literalDocBook ''
+          <literal>true</literal>, unless <option>services.discourse.sslCertificate</option>
+          and <option>services.discourse.sslCertificateKey</option> are set.
+        '';
         description = ''
           Whether an ACME certificate should be used to secure
           connections to the server.
@@ -109,7 +112,7 @@ in
       backendSettings = lib.mkOption {
         type = with lib.types; attrsOf (nullOr (oneOf [ str int bool float ]));
         default = {};
-        example = lib.literalExample ''
+        example = lib.literalExpression ''
           {
             max_reqs_per_ip_per_minute = 300;
             max_reqs_per_ip_per_10_seconds = 60;
@@ -134,7 +137,7 @@ in
       siteSettings = lib.mkOption {
         type = json.type;
         default = {};
-        example = lib.literalExample ''
+        example = lib.literalExpression ''
           {
             required = {
               title = "My Cats";
@@ -334,10 +337,8 @@ in
         notificationEmailAddress = lib.mkOption {
           type = lib.types.str;
           default = "${if cfg.mail.incoming.enable then "notifications" else "noreply"}@${cfg.hostname}";
-          defaultText = ''
-            "notifications@`config.services.discourse.hostname`" if
-            config.services.discourse.mail.incoming.enable is "true",
-            otherwise "noreply`config.services.discourse.hostname`"
+          defaultText = lib.literalExpression ''
+            "''${if config.services.discourse.mail.incoming.enable then "notifications" else "noreply"}@''${config.services.discourse.hostname}"
           '';
           description = ''
             The <literal>from:</literal> email address used when
@@ -448,7 +449,7 @@ in
           replyEmailAddress = lib.mkOption {
             type = lib.types.str;
             default = "%{reply_key}@${cfg.hostname}";
-            defaultText = "%{reply_key}@`config.services.discourse.hostname`";
+            defaultText = lib.literalExpression ''"%{reply_key}@''${config.services.discourse.hostname}"'';
             description = ''
               Template for reply by email incoming email address, for
               example: %{reply_key}@reply.example.com or
@@ -459,7 +460,7 @@ in
           mailReceiverPackage = lib.mkOption {
             type = lib.types.package;
             default = pkgs.discourse-mail-receiver;
-            defaultText = "pkgs.discourse-mail-receiver";
+            defaultText = lib.literalExpression "pkgs.discourse-mail-receiver";
             description = ''
               The discourse-mail-receiver package to use.
             '';
@@ -484,7 +485,7 @@ in
       plugins = lib.mkOption {
         type = lib.types.listOf lib.types.package;
         default = [];
-        example = lib.literalExample ''
+        example = lib.literalExpression ''
           with config.services.discourse.package.plugins; [
             discourse-canned-replies
             discourse-github
diff --git a/nixos/modules/services/web-apps/documize.nix b/nixos/modules/services/web-apps/documize.nix
index a5f48e744fd..7f2ed82ee33 100644
--- a/nixos/modules/services/web-apps/documize.nix
+++ b/nixos/modules/services/web-apps/documize.nix
@@ -26,6 +26,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.documize-community;
+      defaultText = literalExpression "pkgs.documize-community";
       description = ''
         Which package to use for documize.
       '';
diff --git a/nixos/modules/services/web-apps/dokuwiki.nix b/nixos/modules/services/web-apps/dokuwiki.nix
index 964fef23add..bc5b1a8be54 100644
--- a/nixos/modules/services/web-apps/dokuwiki.nix
+++ b/nixos/modules/services/web-apps/dokuwiki.nix
@@ -2,7 +2,7 @@
 
 let
   inherit (lib) mkDefault mkEnableOption mkForce mkIf mkMerge mkOption types maintainers recursiveUpdate;
-  inherit (lib) any attrValues concatMapStrings concatMapStringsSep flatten literalExample;
+  inherit (lib) any attrValues concatMapStrings concatMapStringsSep flatten literalExpression;
   inherit (lib) filterAttrs mapAttrs mapAttrs' mapAttrsToList nameValuePair optional optionalAttrs optionalString;
 
   cfg = migrateOldAttrs config.services.dokuwiki;
@@ -69,6 +69,7 @@ let
         package = mkOption {
           type = types.package;
           default = pkgs.dokuwiki;
+          defaultText = literalExpression "pkgs.dokuwiki";
           description = "Which DokuWiki package to use.";
         };
 
@@ -167,24 +168,24 @@ let
                 List of path(s) to respective plugin(s) which are copied from the 'plugin' directory.
                 <note><para>These plugins need to be packaged before use, see example.</para></note>
           '';
-          example = ''
-                # Let's package the icalevents plugin
-                plugin-icalevents = pkgs.stdenv.mkDerivation {
-                  name = "icalevents";
-                  # Download the plugin from the dokuwiki site
-                  src = pkgs.fetchurl {
-                    url = "https://github.com/real-or-random/dokuwiki-plugin-icalevents/releases/download/2017-06-16/dokuwiki-plugin-icalevents-2017-06-16.zip";
-                    sha256 = "e40ed7dd6bbe7fe3363bbbecb4de481d5e42385b5a0f62f6a6ce6bf3a1f9dfa8";
+          example = literalExpression ''
+                let
+                  # Let's package the icalevents plugin
+                  plugin-icalevents = pkgs.stdenv.mkDerivation {
+                    name = "icalevents";
+                    # Download the plugin from the dokuwiki site
+                    src = pkgs.fetchurl {
+                      url = "https://github.com/real-or-random/dokuwiki-plugin-icalevents/releases/download/2017-06-16/dokuwiki-plugin-icalevents-2017-06-16.zip";
+                      sha256 = "e40ed7dd6bbe7fe3363bbbecb4de481d5e42385b5a0f62f6a6ce6bf3a1f9dfa8";
+                    };
+                    sourceRoot = ".";
+                    # We need unzip to build this package
+                    buildInputs = [ pkgs.unzip ];
+                    # Installing simply means copying all files to the output directory
+                    installPhase = "mkdir -p $out; cp -R * $out/";
                   };
-                  sourceRoot = ".";
-                  # We need unzip to build this package
-                  buildInputs = [ pkgs.unzip ];
-                  # Installing simply means copying all files to the output directory
-                  installPhase = "mkdir -p $out; cp -R * $out/";
-                };
-
                 # And then pass this theme to the plugin list like this:
-                plugins = [ plugin-icalevents ];
+                in [ plugin-icalevents ]
           '';
         };
 
@@ -195,23 +196,23 @@ let
                 List of path(s) to respective template(s) which are copied from the 'tpl' directory.
                 <note><para>These templates need to be packaged before use, see example.</para></note>
           '';
-          example = ''
-                # Let's package the bootstrap3 theme
-                template-bootstrap3 = pkgs.stdenv.mkDerivation {
-                  name = "bootstrap3";
-                  # Download the theme from the dokuwiki site
-                  src = pkgs.fetchurl {
-                    url = "https://github.com/giterlizzi/dokuwiki-template-bootstrap3/archive/v2019-05-22.zip";
-                    sha256 = "4de5ff31d54dd61bbccaf092c9e74c1af3a4c53e07aa59f60457a8f00cfb23a6";
+          example = literalExpression ''
+                let
+                  # Let's package the bootstrap3 theme
+                  template-bootstrap3 = pkgs.stdenv.mkDerivation {
+                    name = "bootstrap3";
+                    # Download the theme from the dokuwiki site
+                    src = pkgs.fetchurl {
+                      url = "https://github.com/giterlizzi/dokuwiki-template-bootstrap3/archive/v2019-05-22.zip";
+                      sha256 = "4de5ff31d54dd61bbccaf092c9e74c1af3a4c53e07aa59f60457a8f00cfb23a6";
+                    };
+                    # We need unzip to build this package
+                    buildInputs = [ pkgs.unzip ];
+                    # Installing simply means copying all files to the output directory
+                    installPhase = "mkdir -p $out; cp -R * $out/";
                   };
-                  # We need unzip to build this package
-                  buildInputs = [ pkgs.unzip ];
-                  # Installing simply means copying all files to the output directory
-                  installPhase = "mkdir -p $out; cp -R * $out/";
-                };
-
                 # And then pass this theme to the template list like this:
-                templates = [ template-bootstrap3 ];
+                in [ template-bootstrap3 ]
           '';
         };
 
diff --git a/nixos/modules/services/web-apps/engelsystem.nix b/nixos/modules/services/web-apps/engelsystem.nix
index b87fecae65f..06c3c6dfc3d 100644
--- a/nixos/modules/services/web-apps/engelsystem.nix
+++ b/nixos/modules/services/web-apps/engelsystem.nix
@@ -1,7 +1,7 @@
 { config, lib, pkgs, utils, ... }:
 
 let
-  inherit (lib) mkDefault mkEnableOption mkIf mkOption types literalExample;
+  inherit (lib) mkDefault mkEnableOption mkIf mkOption types literalExpression;
   cfg = config.services.engelsystem;
 in {
   options = {
@@ -24,9 +24,9 @@ in {
 
       package = mkOption {
         type = types.package;
-        example = literalExample "pkgs.engelsystem";
         description = "Engelsystem package used for the service.";
         default = pkgs.engelsystem;
+        defaultText = literalExpression "pkgs.engelsystem";
       };
 
       createDatabase = mkOption {
diff --git a/nixos/modules/services/web-apps/fluidd.nix b/nixos/modules/services/web-apps/fluidd.nix
index c632b8ff719..6ac1acc9d03 100644
--- a/nixos/modules/services/web-apps/fluidd.nix
+++ b/nixos/modules/services/web-apps/fluidd.nix
@@ -12,7 +12,7 @@ in
       type = types.package;
       description = "Fluidd package to be used in the module";
       default = pkgs.fluidd;
-      defaultText = "pkgs.fluidd";
+      defaultText = literalExpression "pkgs.fluidd";
     };
 
     hostName = mkOption {
@@ -25,9 +25,11 @@ in
       type = types.submodule
         (import ../web-servers/nginx/vhost-options.nix { inherit config lib; });
       default = { };
-      example = {
-        serverAliases = [ "fluidd.\${config.networking.domain}" ];
-      };
+      example = literalExpression ''
+        {
+          serverAliases = [ "fluidd.''${config.networking.domain}" ];
+        }
+      '';
       description = "Extra configuration for the nginx virtual host of fluidd.";
     };
   };
diff --git a/nixos/modules/services/web-apps/galene.nix b/nixos/modules/services/web-apps/galene.nix
index dd63857a55c..db9dfeb4749 100644
--- a/nixos/modules/services/web-apps/galene.nix
+++ b/nixos/modules/services/web-apps/galene.nix
@@ -80,6 +80,7 @@ in
       staticDir = mkOption {
         type = types.str;
         default = "${cfg.package.static}/static";
+        defaultText = literalExpression ''"''${package.static}/static"'';
         example = "/var/lib/galene/static";
         description = "Web server directory.";
       };
@@ -107,7 +108,7 @@ in
 
       package = mkOption {
         default = pkgs.galene;
-        defaultText = "pkgs.galene";
+        defaultText = literalExpression "pkgs.galene";
         type = types.package;
         description = ''
           Package for running Galene.
diff --git a/nixos/modules/services/web-apps/gerrit.nix b/nixos/modules/services/web-apps/gerrit.nix
index 864587aea56..9ee9dbf1aa4 100644
--- a/nixos/modules/services/web-apps/gerrit.nix
+++ b/nixos/modules/services/web-apps/gerrit.nix
@@ -64,13 +64,14 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.gerrit;
+        defaultText = literalExpression "pkgs.gerrit";
         description = "Gerrit package to use";
       };
 
       jvmPackage = mkOption {
         type = types.package;
         default = pkgs.jre_headless;
-        defaultText = "pkgs.jre_headless";
+        defaultText = literalExpression "pkgs.jre_headless";
         description = "Java Runtime Environment package to use";
       };
 
diff --git a/nixos/modules/services/web-apps/hedgedoc.nix b/nixos/modules/services/web-apps/hedgedoc.nix
index d940f3d3dae..b434f16e9bd 100644
--- a/nixos/modules/services/web-apps/hedgedoc.nix
+++ b/nixos/modules/services/web-apps/hedgedoc.nix
@@ -73,7 +73,7 @@ in
       port = mkOption {
         type = types.int;
         default = 3000;
-        example = "80";
+        example = 80;
         description = ''
           Port to listen on.
         '';
@@ -135,7 +135,7 @@ in
       csp = mkOption {
         type = types.nullOr types.attrs;
         default = null;
-        example = literalExample ''
+        example = literalExpression ''
           {
             enable = true;
             directives = {
@@ -222,7 +222,7 @@ in
       db = mkOption {
         type = types.attrs;
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           {
             dialect = "sqlite";
             storage = "/var/lib/${name}/db.${name}.sqlite";
@@ -313,7 +313,7 @@ in
       errorPath = mkOption {
         type = types.nullOr types.str;
         default = null;
-        defaultText = "./public/views/error.ejs";
+        defaultText = literalExpression "./public/views/error.ejs";
         description = ''
           Path to the error template file.
           (Non-canonical paths are relative to HedgeDoc's base directory)
@@ -322,7 +322,7 @@ in
       prettyPath = mkOption {
         type = types.nullOr types.str;
         default = null;
-        defaultText = "./public/views/pretty.ejs";
+        defaultText = literalExpression "./public/views/pretty.ejs";
         description = ''
           Path to the pretty template file.
           (Non-canonical paths are relative to HedgeDoc's base directory)
@@ -331,7 +331,7 @@ in
       slidePath = mkOption {
         type = types.nullOr types.str;
         default = null;
-        defaultText = "./public/views/slide.hbs";
+        defaultText = literalExpression "./public/views/slide.hbs";
         description = ''
           Path to the slide template file.
           (Non-canonical paths are relative to HedgeDoc's base directory)
@@ -340,7 +340,7 @@ in
       uploadsPath = mkOption {
         type = types.str;
         default = "${cfg.workDir}/uploads";
-        defaultText = "/var/lib/${name}/uploads";
+        defaultText = literalExpression "/var/lib/${name}/uploads";
         description = ''
           Path under which uploaded files are saved.
         '';
@@ -925,6 +925,7 @@ in
     package = mkOption {
       type = types.package;
       default = pkgs.hedgedoc;
+      defaultText = literalExpression "pkgs.hedgedoc";
       description = ''
         Package that provides HedgeDoc.
       '';
diff --git a/nixos/modules/services/web-apps/hledger-web.nix b/nixos/modules/services/web-apps/hledger-web.nix
index a69767194c3..9c66589dffd 100644
--- a/nixos/modules/services/web-apps/hledger-web.nix
+++ b/nixos/modules/services/web-apps/hledger-web.nix
@@ -20,7 +20,7 @@ in {
     port = mkOption {
       type = types.port;
       default = 5000;
-      example = "80";
+      example = 80;
       description = ''
         Port to listen on.
       '';
diff --git a/nixos/modules/services/web-apps/icingaweb2/icingaweb2.nix b/nixos/modules/services/web-apps/icingaweb2/icingaweb2.nix
index f8f0854f1bc..b9761061aaa 100644
--- a/nixos/modules/services/web-apps/icingaweb2/icingaweb2.nix
+++ b/nixos/modules/services/web-apps/icingaweb2/icingaweb2.nix
@@ -59,7 +59,7 @@ in {
     modulePackages = mkOption {
       type = attrsOf package;
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         {
           "snow" = icingaweb2Modules.theme-snow;
         }
diff --git a/nixos/modules/services/web-apps/isso.nix b/nixos/modules/services/web-apps/isso.nix
index d05a99a3eed..4c01781a6a2 100644
--- a/nixos/modules/services/web-apps/isso.nix
+++ b/nixos/modules/services/web-apps/isso.nix
@@ -1,7 +1,7 @@
 { config, lib, pkgs, ... }:
 
 let
-  inherit (lib) mkEnableOption mkIf mkOption types literalExample;
+  inherit (lib) mkEnableOption mkIf mkOption types literalExpression;
 
   cfg = config.services.isso;
 
@@ -31,7 +31,7 @@ in {
           freeformType = settingsFormat.type;
         };
 
-        example = literalExample ''
+        example = literalExpression ''
           {
             general = {
               host = "http://localhost";
diff --git a/nixos/modules/services/web-apps/jirafeau.nix b/nixos/modules/services/web-apps/jirafeau.nix
index 4f181257ef7..83cf224f7d2 100644
--- a/nixos/modules/services/web-apps/jirafeau.nix
+++ b/nixos/modules/services/web-apps/jirafeau.nix
@@ -84,18 +84,19 @@ in
       type = types.submodule
         (import ../web-servers/nginx/vhost-options.nix { inherit config lib; });
       default = {};
-      example = {
-        serverAliases = [ "wiki.\${config.networking.domain}" ];
-      };
+      example = literalExpression ''
+        {
+          serverAliases = [ "wiki.''${config.networking.domain}" ];
+        }
+      '';
       description = "Extra configuration for the nginx virtual host of Jirafeau.";
     };
 
     package = mkOption {
       type = types.package;
       default = pkgs.jirafeau;
-      defaultText = "pkgs.jirafeau";
+      defaultText = literalExpression "pkgs.jirafeau";
       description = "Jirafeau package to use";
-      example = "pkgs.jirafeau";
     };
 
     poolConfig = mkOption {
diff --git a/nixos/modules/services/web-apps/jitsi-meet.nix b/nixos/modules/services/web-apps/jitsi-meet.nix
index 997604754e4..a32e1e90119 100644
--- a/nixos/modules/services/web-apps/jitsi-meet.nix
+++ b/nixos/modules/services/web-apps/jitsi-meet.nix
@@ -54,7 +54,7 @@ in
     config = mkOption {
       type = attrs;
       default = { };
-      example = literalExample ''
+      example = literalExpression ''
         {
           enableWelcomePage = false;
           defaultLang = "fi";
@@ -81,7 +81,7 @@ in
     interfaceConfig = mkOption {
       type = attrs;
       default = { };
-      example = literalExample ''
+      example = literalExpression ''
         {
           SHOW_JITSI_WATERMARK = false;
           SHOW_WATERMARK_FOR_GUESTS = false;
diff --git a/nixos/modules/services/web-apps/keycloak.nix b/nixos/modules/services/web-apps/keycloak.nix
index b1bea222c7f..df8c7114102 100644
--- a/nixos/modules/services/web-apps/keycloak.nix
+++ b/nixos/modules/services/web-apps/keycloak.nix
@@ -210,6 +210,7 @@ in
     package = lib.mkOption {
       type = lib.types.package;
       default = pkgs.keycloak;
+      defaultText = lib.literalExpression "pkgs.keycloak";
       description = ''
         Keycloak package to use.
       '';
@@ -228,7 +229,7 @@ in
     extraConfig = lib.mkOption {
       type = lib.types.attrs;
       default = { };
-      example = lib.literalExample ''
+      example = lib.literalExpression ''
         {
           "subsystem=keycloak-server" = {
             "spi=hostname" = {
diff --git a/nixos/modules/services/web-apps/limesurvey.nix b/nixos/modules/services/web-apps/limesurvey.nix
index 56265e80957..5ccd742a303 100644
--- a/nixos/modules/services/web-apps/limesurvey.nix
+++ b/nixos/modules/services/web-apps/limesurvey.nix
@@ -3,7 +3,7 @@
 let
 
   inherit (lib) mkDefault mkEnableOption mkForce mkIf mkMerge mkOption;
-  inherit (lib) literalExample mapAttrs optional optionalString types;
+  inherit (lib) literalExpression mapAttrs optional optionalString types;
 
   cfg = config.services.limesurvey;
   fpm = config.services.phpfpm.pools.limesurvey;
@@ -51,7 +51,7 @@ in
       port = mkOption {
         type = types.int;
         default = if cfg.database.type == "pgsql" then 5442 else 3306;
-        defaultText = "3306";
+        defaultText = literalExpression "3306";
         description = "Database host port.";
       };
 
@@ -84,14 +84,14 @@ in
           else if pgsqlLocal then "/run/postgresql"
           else null
         ;
-        defaultText = "/run/mysqld/mysqld.sock";
+        defaultText = literalExpression "/run/mysqld/mysqld.sock";
         description = "Path to the unix socket file to use for authentication.";
       };
 
       createLocally = mkOption {
         type = types.bool;
         default = cfg.database.type == "mysql";
-        defaultText = "true";
+        defaultText = literalExpression "true";
         description = ''
           Create the database and database user locally.
           This currently only applies if database type "mysql" is selected.
@@ -101,7 +101,7 @@ in
 
     virtualHost = mkOption {
       type = types.submodule (import ../web-servers/apache-httpd/vhost-options.nix);
-      example = literalExample ''
+      example = literalExpression ''
         {
           hostName = "survey.example.org";
           adminAddr = "webmaster@example.org";
diff --git a/nixos/modules/services/web-apps/mastodon.nix b/nixos/modules/services/web-apps/mastodon.nix
index 5bda7d5a5dd..d3790d8b176 100644
--- a/nixos/modules/services/web-apps/mastodon.nix
+++ b/nixos/modules/services/web-apps/mastodon.nix
@@ -399,7 +399,7 @@ in {
       package = lib.mkOption {
         type = lib.types.package;
         default = pkgs.mastodon;
-        defaultText = "pkgs.mastodon";
+        defaultText = lib.literalExpression "pkgs.mastodon";
         description = "Mastodon package to use.";
       };
 
diff --git a/nixos/modules/services/web-apps/matomo.nix b/nixos/modules/services/web-apps/matomo.nix
index 79a0354e22b..b0d281cfb6e 100644
--- a/nixos/modules/services/web-apps/matomo.nix
+++ b/nixos/modules/services/web-apps/matomo.nix
@@ -48,7 +48,7 @@ in {
           as they don't get backported if they are not security-relevant.
         '';
         default = pkgs.matomo;
-        defaultText = "pkgs.matomo";
+        defaultText = literalExpression "pkgs.matomo";
       };
 
       webServerUser = mkOption {
@@ -100,13 +100,15 @@ in {
         )
         );
         default = null;
-        example = {
-          serverAliases = [
-            "matomo.\${config.networking.domain}"
-            "stats.\${config.networking.domain}"
-          ];
-          enableACME = false;
-        };
+        example = literalExpression ''
+          {
+            serverAliases = [
+              "matomo.''${config.networking.domain}"
+              "stats.''${config.networking.domain}"
+            ];
+            enableACME = false;
+          }
+        '';
         description = ''
             With this option, you can customize an nginx virtualHost which already has sensible defaults for Matomo.
             Either this option or the webServerUser option is mandatory.
diff --git a/nixos/modules/services/web-apps/mediawiki.nix b/nixos/modules/services/web-apps/mediawiki.nix
index 1db1652022a..977b6f60b23 100644
--- a/nixos/modules/services/web-apps/mediawiki.nix
+++ b/nixos/modules/services/web-apps/mediawiki.nix
@@ -3,7 +3,7 @@
 let
 
   inherit (lib) mkDefault mkEnableOption mkForce mkIf mkMerge mkOption;
-  inherit (lib) concatStringsSep literalExample mapAttrsToList optional optionals optionalString types;
+  inherit (lib) concatStringsSep literalExpression mapAttrsToList optional optionals optionalString types;
 
   cfg = config.services.mediawiki;
   fpm = config.services.phpfpm.pools.mediawiki;
@@ -176,6 +176,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.mediawiki;
+        defaultText = literalExpression "pkgs.mediawiki";
         description = "Which MediaWiki package to use.";
       };
 
@@ -219,7 +220,7 @@ in
 
           Use <literal>null</literal> instead of path to enable extensions that are part of MediaWiki.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           {
             Matomo = pkgs.fetchzip {
               url = "https://github.com/DaSchTour/matomo-mediawiki-extension/archive/v4.0.1.tar.gz";
@@ -286,14 +287,14 @@ in
         socket = mkOption {
           type = types.nullOr types.path;
           default = if cfg.database.createLocally then "/run/mysqld/mysqld.sock" else null;
-          defaultText = "/run/mysqld/mysqld.sock";
+          defaultText = literalExpression "/run/mysqld/mysqld.sock";
           description = "Path to the unix socket file to use for authentication.";
         };
 
         createLocally = mkOption {
           type = types.bool;
           default = cfg.database.type == "mysql";
-          defaultText = "true";
+          defaultText = literalExpression "true";
           description = ''
             Create the database and database user locally.
             This currently only applies if database type "mysql" is selected.
@@ -303,7 +304,7 @@ in
 
       virtualHost = mkOption {
         type = types.submodule (import ../web-servers/apache-httpd/vhost-options.nix);
-        example = literalExample ''
+        example = literalExpression ''
           {
             hostName = "mediawiki.example.org";
             adminAddr = "webmaster@example.org";
diff --git a/nixos/modules/services/web-apps/miniflux.nix b/nixos/modules/services/web-apps/miniflux.nix
index 1bbadafa207..026bde2a92d 100644
--- a/nixos/modules/services/web-apps/miniflux.nix
+++ b/nixos/modules/services/web-apps/miniflux.nix
@@ -35,7 +35,7 @@ in
 
       config = mkOption {
         type = types.attrsOf types.str;
-        example = literalExample ''
+        example = literalExpression ''
           {
             CLEANUP_FREQUENCY = "48";
             LISTEN_ADDR = "localhost:8080";
diff --git a/nixos/modules/services/web-apps/moinmoin.nix b/nixos/modules/services/web-apps/moinmoin.nix
index 7a54255a46e..efb73124a23 100644
--- a/nixos/modules/services/web-apps/moinmoin.nix
+++ b/nixos/modules/services/web-apps/moinmoin.nix
@@ -151,7 +151,7 @@ in
           webHost = mkDefault name;
         };
       }));
-      example = literalExample ''
+      example = literalExpression ''
         {
           "mywiki" = {
             siteName = "Example Wiki";
diff --git a/nixos/modules/services/web-apps/moodle.nix b/nixos/modules/services/web-apps/moodle.nix
index c854e084e14..6f5cfa2e348 100644
--- a/nixos/modules/services/web-apps/moodle.nix
+++ b/nixos/modules/services/web-apps/moodle.nix
@@ -2,7 +2,7 @@
 
 let
   inherit (lib) mkDefault mkEnableOption mkForce mkIf mkMerge mkOption types;
-  inherit (lib) concatStringsSep literalExample mapAttrsToList optional optionalString;
+  inherit (lib) concatStringsSep literalExpression mapAttrsToList optional optionalString;
 
   cfg = config.services.moodle;
   fpm = config.services.phpfpm.pools.moodle;
@@ -67,7 +67,7 @@ in
     package = mkOption {
       type = types.package;
       default = pkgs.moodle;
-      defaultText = "pkgs.moodle";
+      defaultText = literalExpression "pkgs.moodle";
       description = "The Moodle package to use.";
     };
 
@@ -100,7 +100,7 @@ in
           mysql = 3306;
           pgsql = 5432;
         }.${cfg.database.type};
-        defaultText = "3306";
+        defaultText = literalExpression "3306";
       };
 
       name = mkOption {
@@ -131,7 +131,7 @@ in
           if mysqlLocal then "/run/mysqld/mysqld.sock"
           else if pgsqlLocal then "/run/postgresql"
           else null;
-        defaultText = "/run/mysqld/mysqld.sock";
+        defaultText = literalExpression "/run/mysqld/mysqld.sock";
         description = "Path to the unix socket file to use for authentication.";
       };
 
@@ -144,7 +144,7 @@ in
 
     virtualHost = mkOption {
       type = types.submodule (import ../web-servers/apache-httpd/vhost-options.nix);
-      example = literalExample ''
+      example = literalExpression ''
         {
           hostName = "moodle.example.org";
           adminAddr = "webmaster@example.org";
diff --git a/nixos/modules/services/web-apps/nextcloud.nix b/nixos/modules/services/web-apps/nextcloud.nix
index 3c952fd883a..8d3741cf89d 100644
--- a/nixos/modules/services/web-apps/nextcloud.nix
+++ b/nixos/modules/services/web-apps/nextcloud.nix
@@ -134,14 +134,14 @@ in {
     phpExtraExtensions = mkOption {
       type = with types; functionTo (listOf package);
       default = all: [];
-      defaultText = "all: []";
+      defaultText = literalExpression "all: []";
       description = ''
         Additional PHP extensions to use for nextcloud.
         By default, only extensions necessary for a vanilla nextcloud installation are enabled,
         but you may choose from the list of available extensions and add further ones.
         This is sometimes necessary to be able to install a certain nextcloud app that has additional requirements.
       '';
-      example = literalExample ''
+      example = literalExpression ''
         all: [ all.pdlib all.bz2 ]
       '';
     };
diff --git a/nixos/modules/services/web-apps/nexus.nix b/nixos/modules/services/web-apps/nexus.nix
index d4d507362c9..dc50a06705f 100644
--- a/nixos/modules/services/web-apps/nexus.nix
+++ b/nixos/modules/services/web-apps/nexus.nix
@@ -16,6 +16,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.nexus;
+        defaultText = literalExpression "pkgs.nexus";
         description = "Package which runs Nexus3";
       };
 
@@ -70,6 +71,27 @@ in
           -Dkaraf.startLocalConsole=false
           -Djava.endorsed.dirs=${cfg.package}/lib/endorsed
         '';
+        defaultText = literalExpression ''
+          '''
+            -Xms1200M
+            -Xmx1200M
+            -XX:MaxDirectMemorySize=2G
+            -XX:+UnlockDiagnosticVMOptions
+            -XX:+UnsyncloadClass
+            -XX:+LogVMOutput
+            -XX:LogFile=''${home}/nexus3/log/jvm.log
+            -XX:-OmitStackTraceInFastThrow
+            -Djava.net.preferIPv4Stack=true
+            -Dkaraf.home=''${package}
+            -Dkaraf.base=''${package}
+            -Dkaraf.etc=''${package}/etc/karaf
+            -Djava.util.logging.config.file=''${package}/etc/karaf/java.util.logging.properties
+            -Dkaraf.data=''${home}/nexus3
+            -Djava.io.tmpdir=''${home}/nexus3/tmp
+            -Dkaraf.startLocalConsole=false
+            -Djava.endorsed.dirs=''${package}/lib/endorsed
+          '''
+        '';
 
         description = ''
           Options for the JVM written to `nexus.jvmopts`.
diff --git a/nixos/modules/services/web-apps/node-red.nix b/nixos/modules/services/web-apps/node-red.nix
index 400790576d6..4512907f027 100644
--- a/nixos/modules/services/web-apps/node-red.nix
+++ b/nixos/modules/services/web-apps/node-red.nix
@@ -21,7 +21,7 @@ in
 
     package = mkOption {
       default = pkgs.nodePackages.node-red;
-      defaultText = "pkgs.nodePackages.node-red";
+      defaultText = literalExpression "pkgs.nodePackages.node-red";
       type = types.package;
       description = "Node-RED package to use.";
     };
@@ -46,7 +46,7 @@ in
     configFile = mkOption {
       type = types.path;
       default = "${cfg.package}/lib/node_modules/node-red/settings.js";
-      defaultText = "\${cfg.package}/lib/node_modules/node-red/settings.js";
+      defaultText = literalExpression ''"''${package}/lib/node_modules/node-red/settings.js"'';
       description = ''
         Path to the JavaScript configuration file.
         See <link
@@ -102,7 +102,7 @@ in
       type = types.attrs;
       default = {};
       description = "List of settings.js overrides to pass via -D to Node-RED.";
-      example = literalExample ''
+      example = literalExpression ''
         {
           "logging.console.level" = "trace";
         }
diff --git a/nixos/modules/services/web-apps/pgpkeyserver-lite.nix b/nixos/modules/services/web-apps/pgpkeyserver-lite.nix
index 838fd19ad29..5642627d397 100644
--- a/nixos/modules/services/web-apps/pgpkeyserver-lite.nix
+++ b/nixos/modules/services/web-apps/pgpkeyserver-lite.nix
@@ -21,7 +21,7 @@ in
 
       package = mkOption {
         default = pkgs.pgpkeyserver-lite;
-        defaultText = "pkgs.pgpkeyserver-lite";
+        defaultText = literalExpression "pkgs.pgpkeyserver-lite";
         type = types.package;
         description = "
           Which webgui derivation to use.
diff --git a/nixos/modules/services/web-apps/plantuml-server.nix b/nixos/modules/services/web-apps/plantuml-server.nix
index a39f594c274..5ac3bc5226b 100644
--- a/nixos/modules/services/web-apps/plantuml-server.nix
+++ b/nixos/modules/services/web-apps/plantuml-server.nix
@@ -16,6 +16,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.plantuml-server;
+        defaultText = literalExpression "pkgs.plantuml-server";
         description = "PlantUML server package to use";
       };
 
@@ -58,6 +59,7 @@ in
       graphvizPackage = mkOption {
         type = types.package;
         default = pkgs.graphviz_2_32;
+        defaultText = literalExpression "pkgs.graphviz_2_32";
         description = "Package containing the dot executable.";
       };
 
diff --git a/nixos/modules/services/web-apps/restya-board.nix b/nixos/modules/services/web-apps/restya-board.nix
index 9d0a3f65253..fd97ab76a5f 100644
--- a/nixos/modules/services/web-apps/restya-board.nix
+++ b/nixos/modules/services/web-apps/restya-board.nix
@@ -30,7 +30,6 @@ in
       dataDir = mkOption {
         type = types.path;
         default = "/var/lib/restya-board";
-        example = "/var/lib/restya-board";
         description = ''
           Data of the application.
         '';
@@ -39,7 +38,6 @@ in
       user = mkOption {
         type = types.str;
         default = "restya-board";
-        example = "restya-board";
         description = ''
           User account under which the web-application runs.
         '';
@@ -48,7 +46,6 @@ in
       group = mkOption {
         type = types.str;
         default = "nginx";
-        example = "nginx";
         description = ''
           Group account under which the web-application runs.
         '';
diff --git a/nixos/modules/services/web-apps/rss-bridge.nix b/nixos/modules/services/web-apps/rss-bridge.nix
index f1d5b7660f3..456ca00416f 100644
--- a/nixos/modules/services/web-apps/rss-bridge.nix
+++ b/nixos/modules/services/web-apps/rss-bridge.nix
@@ -16,7 +16,6 @@ in
       user = mkOption {
         type = types.str;
         default = "nginx";
-        example = "nginx";
         description = ''
           User account under which both the service and the web-application run.
         '';
@@ -25,7 +24,6 @@ in
       group = mkOption {
         type = types.str;
         default = "nginx";
-        example = "nginx";
         description = ''
           Group under which the web-application run.
         '';
@@ -61,7 +59,7 @@ in
       whitelist = mkOption {
         type = types.listOf types.str;
         default = [];
-        example = options.literalExample ''
+        example = options.literalExpression ''
           [
             "Facebook"
             "Instagram"
diff --git a/nixos/modules/services/web-apps/selfoss.nix b/nixos/modules/services/web-apps/selfoss.nix
index d5a660ebf28..899976ac696 100644
--- a/nixos/modules/services/web-apps/selfoss.nix
+++ b/nixos/modules/services/web-apps/selfoss.nix
@@ -35,7 +35,6 @@ in
         user = mkOption {
           type = types.str;
           default = "nginx";
-          example = "nginx";
           description = ''
             User account under which both the service and the web-application run.
           '';
diff --git a/nixos/modules/services/web-apps/shiori.nix b/nixos/modules/services/web-apps/shiori.nix
index a15bb9744a9..bb2fc684e83 100644
--- a/nixos/modules/services/web-apps/shiori.nix
+++ b/nixos/modules/services/web-apps/shiori.nix
@@ -11,7 +11,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.shiori;
-        defaultText = "pkgs.shiori";
+        defaultText = literalExpression "pkgs.shiori";
         description = "The Shiori package to use.";
       };
 
diff --git a/nixos/modules/services/web-apps/tt-rss.nix b/nixos/modules/services/web-apps/tt-rss.nix
index bc18c824f39..08356cee1df 100644
--- a/nixos/modules/services/web-apps/tt-rss.nix
+++ b/nixos/modules/services/web-apps/tt-rss.nix
@@ -126,7 +126,6 @@ let
       root = mkOption {
         type = types.path;
         default = "/var/lib/tt-rss";
-        example = "/var/lib/tt-rss";
         description = ''
           Root of the application.
         '';
@@ -135,7 +134,6 @@ let
       user = mkOption {
         type = types.str;
         default = "tt_rss";
-        example = "tt_rss";
         description = ''
           User account under which both the update daemon and the web-application run.
         '';
diff --git a/nixos/modules/services/web-apps/vikunja.nix b/nixos/modules/services/web-apps/vikunja.nix
index b0b6eb6df17..7575e96ca81 100644
--- a/nixos/modules/services/web-apps/vikunja.nix
+++ b/nixos/modules/services/web-apps/vikunja.nix
@@ -14,13 +14,13 @@ in {
     package-api = mkOption {
       default = pkgs.vikunja-api;
       type = types.package;
-      defaultText = "pkgs.vikunja-api";
+      defaultText = literalExpression "pkgs.vikunja-api";
       description = "vikunja-api derivation to use.";
     };
     package-frontend = mkOption {
       default = pkgs.vikunja-frontend;
       type = types.package;
-      defaultText = "pkgs.vikunja-frontend";
+      defaultText = literalExpression "pkgs.vikunja-frontend";
       description = "vikunja-frontend derivation to use.";
     };
     environmentFiles = mkOption {
@@ -34,7 +34,7 @@ in {
     setupNginx = mkOption {
       type = types.bool;
       default = config.services.nginx.enable;
-      defaultText = "config.services.nginx.enable";
+      defaultText = literalExpression "config.services.nginx.enable";
       description = ''
         Whether to setup NGINX.
         Further nginx configuration can be done by changing
diff --git a/nixos/modules/services/web-apps/whitebophir.nix b/nixos/modules/services/web-apps/whitebophir.nix
index b265296d5c1..f9db6fe379b 100644
--- a/nixos/modules/services/web-apps/whitebophir.nix
+++ b/nixos/modules/services/web-apps/whitebophir.nix
@@ -11,7 +11,7 @@ in {
 
       package = mkOption {
         default = pkgs.whitebophir;
-        defaultText = "pkgs.whitebophir";
+        defaultText = literalExpression "pkgs.whitebophir";
         type = types.package;
         description = "Whitebophir package to use.";
       };
diff --git a/nixos/modules/services/web-apps/wordpress.nix b/nixos/modules/services/web-apps/wordpress.nix
index eb91256045c..8ebb7229662 100644
--- a/nixos/modules/services/web-apps/wordpress.nix
+++ b/nixos/modules/services/web-apps/wordpress.nix
@@ -2,7 +2,7 @@
 
 let
   inherit (lib) mkDefault mkEnableOption mkForce mkIf mkMerge mkOption types;
-  inherit (lib) any attrValues concatMapStringsSep flatten literalExample;
+  inherit (lib) any attrValues concatMapStringsSep flatten literalExpression;
   inherit (lib) filterAttrs mapAttrs mapAttrs' mapAttrsToList nameValuePair optional optionalAttrs optionalString;
 
   cfg = migrateOldAttrs config.services.wordpress;
@@ -87,6 +87,7 @@ let
         package = mkOption {
           type = types.package;
           default = pkgs.wordpress;
+          defaultText = literalExpression "pkgs.wordpress";
           description = "Which WordPress package to use.";
         };
 
@@ -106,23 +107,23 @@ let
             List of path(s) to respective plugin(s) which are copied from the 'plugins' directory.
             <note><para>These plugins need to be packaged before use, see example.</para></note>
           '';
-          example = ''
-            # Wordpress plugin 'embed-pdf-viewer' installation example
-            embedPdfViewerPlugin = pkgs.stdenv.mkDerivation {
-              name = "embed-pdf-viewer-plugin";
-              # Download the theme from the wordpress site
-              src = pkgs.fetchurl {
-                url = "https://downloads.wordpress.org/plugin/embed-pdf-viewer.2.0.3.zip";
-                sha256 = "1rhba5h5fjlhy8p05zf0p14c9iagfh96y91r36ni0rmk6y891lyd";
+          example = literalExpression ''
+            let
+              # Wordpress plugin 'embed-pdf-viewer' installation example
+              embedPdfViewerPlugin = pkgs.stdenv.mkDerivation {
+                name = "embed-pdf-viewer-plugin";
+                # Download the theme from the wordpress site
+                src = pkgs.fetchurl {
+                  url = "https://downloads.wordpress.org/plugin/embed-pdf-viewer.2.0.3.zip";
+                  sha256 = "1rhba5h5fjlhy8p05zf0p14c9iagfh96y91r36ni0rmk6y891lyd";
+                };
+                # We need unzip to build this package
+                nativeBuildInputs = [ pkgs.unzip ];
+                # Installing simply means copying all files to the output directory
+                installPhase = "mkdir -p $out; cp -R * $out/";
               };
-              # We need unzip to build this package
-              nativeBuildInputs = [ pkgs.unzip ];
-              # Installing simply means copying all files to the output directory
-              installPhase = "mkdir -p $out; cp -R * $out/";
-            };
-
-            And then pass this theme to the themes list like this:
-              plugins = [ embedPdfViewerPlugin ];
+            # And then pass this theme to the themes list like this:
+            in [ embedPdfViewerPlugin ]
           '';
         };
 
@@ -133,23 +134,23 @@ let
             List of path(s) to respective theme(s) which are copied from the 'theme' directory.
             <note><para>These themes need to be packaged before use, see example.</para></note>
           '';
-          example = ''
-            # Let's package the responsive theme
-            responsiveTheme = pkgs.stdenv.mkDerivation {
-              name = "responsive-theme";
-              # Download the theme from the wordpress site
-              src = pkgs.fetchurl {
-                url = "https://downloads.wordpress.org/theme/responsive.3.14.zip";
-                sha256 = "0rjwm811f4aa4q43r77zxlpklyb85q08f9c8ns2akcarrvj5ydx3";
+          example = literalExpression ''
+            let
+              # Let's package the responsive theme
+              responsiveTheme = pkgs.stdenv.mkDerivation {
+                name = "responsive-theme";
+                # Download the theme from the wordpress site
+                src = pkgs.fetchurl {
+                  url = "https://downloads.wordpress.org/theme/responsive.3.14.zip";
+                  sha256 = "0rjwm811f4aa4q43r77zxlpklyb85q08f9c8ns2akcarrvj5ydx3";
+                };
+                # We need unzip to build this package
+                nativeBuildInputs = [ pkgs.unzip ];
+                # Installing simply means copying all files to the output directory
+                installPhase = "mkdir -p $out; cp -R * $out/";
               };
-              # We need unzip to build this package
-              nativeBuildInputs = [ pkgs.unzip ];
-              # Installing simply means copying all files to the output directory
-              installPhase = "mkdir -p $out; cp -R * $out/";
-            };
-
-            And then pass this theme to the themes list like this:
-              themes = [ responsiveTheme ];
+            # And then pass this theme to the themes list like this:
+            in [ responsiveTheme ]
           '';
         };
 
@@ -204,7 +205,7 @@ let
           socket = mkOption {
             type = types.nullOr types.path;
             default = null;
-            defaultText = "/run/mysqld/mysqld.sock";
+            defaultText = literalExpression "/run/mysqld/mysqld.sock";
             description = "Path to the unix socket file to use for authentication.";
           };
 
@@ -217,7 +218,7 @@ let
 
         virtualHost = mkOption {
           type = types.submodule (import ../web-servers/apache-httpd/vhost-options.nix);
-          example = literalExample ''
+          example = literalExpression ''
             {
               adminAddr = "webmaster@example.org";
               forceSSL = true;
diff --git a/nixos/modules/services/web-apps/youtrack.nix b/nixos/modules/services/web-apps/youtrack.nix
index b4d653d2d77..7a70ae6cd52 100644
--- a/nixos/modules/services/web-apps/youtrack.nix
+++ b/nixos/modules/services/web-apps/youtrack.nix
@@ -46,7 +46,7 @@ in
         https://www.jetbrains.com/help/youtrack/standalone/YouTrack-Java-Start-Parameters.html
         for more information.
       '';
-      example = literalExample ''
+      example = literalExpression ''
         {
           "jetbrains.youtrack.overrideRootPassword" = "tortuga";
         }
@@ -60,7 +60,7 @@ in
       '';
       type = types.package;
       default = pkgs.youtrack;
-      defaultText = "pkgs.youtrack";
+      defaultText = literalExpression "pkgs.youtrack";
     };
 
     port = mkOption {
diff --git a/nixos/modules/services/web-apps/zabbix.nix b/nixos/modules/services/web-apps/zabbix.nix
index e94861a90b5..21567896a89 100644
--- a/nixos/modules/services/web-apps/zabbix.nix
+++ b/nixos/modules/services/web-apps/zabbix.nix
@@ -3,7 +3,7 @@
 let
 
   inherit (lib) mkDefault mkEnableOption mkForce mkIf mkMerge mkOption types;
-  inherit (lib) literalExample mapAttrs optionalString versionAtLeast;
+  inherit (lib) literalExpression mapAttrs optionalString versionAtLeast;
 
   cfg = config.services.zabbixWeb;
   fpm = config.services.phpfpm.pools.zabbix;
@@ -43,7 +43,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.zabbix.web;
-        defaultText = "zabbix.web";
+        defaultText = literalExpression "zabbix.web";
         description = "Which Zabbix package to use.";
       };
 
@@ -116,7 +116,7 @@ in
 
       virtualHost = mkOption {
         type = types.submodule (import ../web-servers/apache-httpd/vhost-options.nix);
-        example = literalExample ''
+        example = literalExpression ''
           {
             hostName = "zabbix.example.org";
             adminAddr = "webmaster@example.org";
diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix
index ceb19987097..992a58875e4 100644
--- a/nixos/modules/services/web-servers/apache-httpd/default.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/default.nix
@@ -407,7 +407,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.apacheHttpd;
-        defaultText = "pkgs.apacheHttpd";
+        defaultText = literalExpression "pkgs.apacheHttpd";
         description = ''
           Overridable attribute of the Apache HTTP Server package to use.
         '';
@@ -416,8 +416,8 @@ in
       configFile = mkOption {
         type = types.path;
         default = confFile;
-        defaultText = "confFile";
-        example = literalExample ''pkgs.writeText "httpd.conf" "# my custom config file ..."'';
+        defaultText = literalExpression "confFile";
+        example = literalExpression ''pkgs.writeText "httpd.conf" "# my custom config file ..."'';
         description = ''
           Override the configuration file used by Apache. By default,
           NixOS generates one automatically.
@@ -437,7 +437,7 @@ in
       extraModules = mkOption {
         type = types.listOf types.unspecified;
         default = [];
-        example = literalExample ''
+        example = literalExpression ''
           [
             "proxy_connect"
             { name = "jk"; path = "''${pkgs.tomcat_connectors}/modules/mod_jk.so"; }
@@ -516,7 +516,14 @@ in
             documentRoot = "${pkg}/htdocs";
           };
         };
-        example = literalExample ''
+        defaultText = literalExpression ''
+          {
+            localhost = {
+              documentRoot = "''${package.out}/htdocs";
+            };
+          }
+        '';
+        example = literalExpression ''
           {
             "foo.example.com" = {
               forceSSL = true;
@@ -550,7 +557,7 @@ in
       phpPackage = mkOption {
         type = types.package;
         default = pkgs.php;
-        defaultText = "pkgs.php";
+        defaultText = literalExpression "pkgs.php";
         description = ''
           Overridable attribute of the PHP package to use.
         '';
diff --git a/nixos/modules/services/web-servers/apache-httpd/vhost-options.nix b/nixos/modules/services/web-servers/apache-httpd/vhost-options.nix
index 3f732a5c9f3..8bb7e91ec9c 100644
--- a/nixos/modules/services/web-servers/apache-httpd/vhost-options.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/vhost-options.nix
@@ -1,6 +1,6 @@
 { config, lib, name, ... }:
 let
-  inherit (lib) literalExample mkOption nameValuePair types;
+  inherit (lib) literalExpression mkOption nameValuePair types;
 in
 {
   options = {
@@ -266,7 +266,7 @@ in
     locations = mkOption {
       type = with types; attrsOf (submodule (import ./location-options.nix));
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         {
           "/" = {
             proxyPass = "http://localhost:3000";
diff --git a/nixos/modules/services/web-servers/caddy/default.nix b/nixos/modules/services/web-servers/caddy/default.nix
index fd710209634..cef27e2e59f 100644
--- a/nixos/modules/services/web-servers/caddy/default.nix
+++ b/nixos/modules/services/web-servers/caddy/default.nix
@@ -83,7 +83,7 @@ in
         inherit config lib;
       }));
       default = { };
-      example = literalExample ''
+      example = literalExpression ''
         {
           "hydra.example.com" = {
             serverAliases = [ "www.hydra.example.com" ];
@@ -162,8 +162,7 @@ in
 
     package = mkOption {
       default = pkgs.caddy;
-      defaultText = "pkgs.caddy";
-      example = "pkgs.caddy";
+      defaultText = literalExpression "pkgs.caddy";
       type = types.package;
       description = ''
         Caddy package to use.
diff --git a/nixos/modules/services/web-servers/lighttpd/cgit.nix b/nixos/modules/services/web-servers/lighttpd/cgit.nix
index 9f25dc34f3f..8cd6d020940 100644
--- a/nixos/modules/services/web-servers/lighttpd/cgit.nix
+++ b/nixos/modules/services/web-servers/lighttpd/cgit.nix
@@ -41,11 +41,13 @@ in
 
     configText = mkOption {
       default = "";
-      example = ''
-        source-filter=''${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py
-        about-filter=''${pkgs.cgit}/lib/cgit/filters/about-formatting.sh
-        cache-size=1000
-        scan-path=/srv/git
+      example = literalExpression ''
+        '''
+          source-filter=''${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py
+          about-filter=''${pkgs.cgit}/lib/cgit/filters/about-formatting.sh
+          cache-size=1000
+          scan-path=/srv/git
+        '''
       '';
       type = types.lines;
       description = ''
diff --git a/nixos/modules/services/web-servers/minio.nix b/nixos/modules/services/web-servers/minio.nix
index 6b10afad499..c345e3f2467 100644
--- a/nixos/modules/services/web-servers/minio.nix
+++ b/nixos/modules/services/web-servers/minio.nix
@@ -87,7 +87,7 @@ in
 
     package = mkOption {
       default = pkgs.minio;
-      defaultText = "pkgs.minio";
+      defaultText = literalExpression "pkgs.minio";
       type = types.package;
       description = "Minio package to use.";
     };
diff --git a/nixos/modules/services/web-servers/molly-brown.nix b/nixos/modules/services/web-servers/molly-brown.nix
index 58db9b9beda..0bd8b3316cb 100644
--- a/nixos/modules/services/web-servers/molly-brown.nix
+++ b/nixos/modules/services/web-servers/molly-brown.nix
@@ -22,8 +22,8 @@ in {
 
     hostName = mkOption {
       type = types.str;
-      example = literalExample "config.networking.hostName";
       default = config.networking.hostName;
+      defaultText = literalExpression "config.networking.hostName";
       description = ''
         The hostname to respond to requests for. Requests for URLs with
         other hosts will result in a status 53 (PROXY REQUEST REFUSED)
diff --git a/nixos/modules/services/web-servers/nginx/default.nix b/nixos/modules/services/web-servers/nginx/default.nix
index 6682472fdb8..d5486be65ee 100644
--- a/nixos/modules/services/web-servers/nginx/default.nix
+++ b/nixos/modules/services/web-servers/nginx/default.nix
@@ -425,7 +425,7 @@ in
 
       package = mkOption {
         default = pkgs.nginxStable;
-        defaultText = "pkgs.nginxStable";
+        defaultText = literalExpression "pkgs.nginxStable";
         type = types.package;
         apply = p: p.override {
           modules = p.modules ++ cfg.additionalModules;
@@ -440,7 +440,7 @@ in
       additionalModules = mkOption {
         default = [];
         type = types.listOf (types.attrsOf types.anything);
-        example = literalExample "[ pkgs.nginxModules.brotli ]";
+        example = literalExpression "[ pkgs.nginxModules.brotli ]";
         description = ''
           Additional <link xlink:href="https://www.nginx.com/resources/wiki/modules/">third-party nginx modules</link>
           to install. Packaged modules are available in
@@ -674,7 +674,7 @@ in
             addresses = mkOption {
               type = types.listOf types.str;
               default = [];
-              example = literalExample ''[ "[::1]" "127.0.0.1:5353" ]'';
+              example = literalExpression ''[ "[::1]" "127.0.0.1:5353" ]'';
               description = "List of resolvers to use";
             };
             valid = mkOption {
@@ -738,7 +738,7 @@ in
           Defines a group of servers to use as proxy target.
         '';
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           "backend_server" = {
             servers = { "127.0.0.1:8000" = {}; };
             extraConfig = ''''
@@ -755,7 +755,7 @@ in
         default = {
           localhost = {};
         };
-        example = literalExample ''
+        example = literalExpression ''
           {
             "hydra.example.com" = {
               forceSSL = true;
diff --git a/nixos/modules/services/web-servers/nginx/location-options.nix b/nixos/modules/services/web-servers/nginx/location-options.nix
index d8c976f202f..56a5381e05c 100644
--- a/nixos/modules/services/web-servers/nginx/location-options.nix
+++ b/nixos/modules/services/web-servers/nginx/location-options.nix
@@ -12,7 +12,7 @@ with lib;
     basicAuth = mkOption {
       type = types.attrsOf types.str;
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         {
           user = "password";
         };
diff --git a/nixos/modules/services/web-servers/nginx/vhost-options.nix b/nixos/modules/services/web-servers/nginx/vhost-options.nix
index 94645e927f8..7ee041d3721 100644
--- a/nixos/modules/services/web-servers/nginx/vhost-options.nix
+++ b/nixos/modules/services/web-servers/nginx/vhost-options.nix
@@ -162,7 +162,7 @@ with lib;
     sslTrustedCertificate = mkOption {
       type = types.nullOr types.path;
       default = null;
-      example = "\${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
+      example = literalExpression ''"''${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"'';
       description = "Path to root SSL certificate for stapling and client certificates.";
     };
 
@@ -231,7 +231,7 @@ with lib;
     basicAuth = mkOption {
       type = types.attrsOf types.str;
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         {
           user = "password";
         };
@@ -261,7 +261,7 @@ with lib;
         inherit lib;
       }));
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         {
           "/" = {
             proxyPass = "http://localhost:3000";
diff --git a/nixos/modules/services/web-servers/phpfpm/default.nix b/nixos/modules/services/web-servers/phpfpm/default.nix
index 4d302299f5f..87c68fa074a 100644
--- a/nixos/modules/services/web-servers/phpfpm/default.nix
+++ b/nixos/modules/services/web-servers/phpfpm/default.nix
@@ -59,7 +59,7 @@ let
         phpPackage = mkOption {
           type = types.package;
           default = cfg.phpPackage;
-          defaultText = "config.services.phpfpm.phpPackage";
+          defaultText = literalExpression "config.services.phpfpm.phpPackage";
           description = ''
             The PHP package to use for running this PHP-FPM pool.
           '';
@@ -78,7 +78,7 @@ let
           description = ''
             Environment variables used for this PHP-FPM pool.
           '';
-          example = literalExample ''
+          example = literalExpression ''
             {
               HOSTNAME = "$HOSTNAME";
               TMP = "/tmp";
@@ -107,7 +107,7 @@ let
             for details. Note that settings names must be enclosed in quotes (e.g.
             <literal>"pm.max_children"</literal> instead of <literal>pm.max_children</literal>).
           '';
-          example = literalExample ''
+          example = literalExpression ''
             {
               "pm" = "dynamic";
               "pm.max_children" = 75;
@@ -179,7 +179,7 @@ in {
       phpPackage = mkOption {
         type = types.package;
         default = pkgs.php;
-        defaultText = "pkgs.php";
+        defaultText = literalExpression "pkgs.php";
         description = ''
           The PHP package to use for running the PHP-FPM service.
         '';
@@ -200,7 +200,7 @@ in {
       pools = mkOption {
         type = types.attrsOf (types.submodule poolOpts);
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
          {
            mypool = {
              user = "php";
diff --git a/nixos/modules/services/web-servers/tomcat.nix b/nixos/modules/services/web-servers/tomcat.nix
index 13fe98402c6..f9446fe125a 100644
--- a/nixos/modules/services/web-servers/tomcat.nix
+++ b/nixos/modules/services/web-servers/tomcat.nix
@@ -24,8 +24,8 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.tomcat85;
-        defaultText = "pkgs.tomcat85";
-        example = lib.literalExample "pkgs.tomcat9";
+        defaultText = literalExpression "pkgs.tomcat85";
+        example = lib.literalExpression "pkgs.tomcat9";
         description = ''
           Which tomcat package to use.
         '';
@@ -127,7 +127,7 @@ in
       webapps = mkOption {
         type = types.listOf types.path;
         default = [ tomcat.webapps ];
-        defaultText = "[ pkgs.tomcat85.webapps ]";
+        defaultText = literalExpression "[ pkgs.tomcat85.webapps ]";
         description = "List containing WAR files or directories with WAR files which are web applications to be deployed on Tomcat";
       };
 
@@ -166,7 +166,7 @@ in
       jdk = mkOption {
         type = types.package;
         default = pkgs.jdk;
-        defaultText = "pkgs.jdk";
+        defaultText = literalExpression "pkgs.jdk";
         description = "Which JDK to use.";
       };
 
diff --git a/nixos/modules/services/web-servers/traefik.nix b/nixos/modules/services/web-servers/traefik.nix
index 3d29199dd45..eb7fd0995de 100644
--- a/nixos/modules/services/web-servers/traefik.nix
+++ b/nixos/modules/services/web-servers/traefik.nix
@@ -54,7 +54,7 @@ in {
 
     staticConfigFile = mkOption {
       default = null;
-      example = literalExample "/path/to/static_config.toml";
+      example = literalExpression "/path/to/static_config.toml";
       type = types.nullOr types.path;
       description = ''
         Path to traefik's static configuration to use.
@@ -78,7 +78,7 @@ in {
 
     dynamicConfigFile = mkOption {
       default = null;
-      example = literalExample "/path/to/dynamic_config.toml";
+      example = literalExpression "/path/to/dynamic_config.toml";
       type = types.nullOr types.path;
       description = ''
         Path to traefik's dynamic configuration to use.
@@ -123,7 +123,7 @@ in {
 
     package = mkOption {
       default = pkgs.traefik;
-      defaultText = "pkgs.traefik";
+      defaultText = literalExpression "pkgs.traefik";
       type = types.package;
       description = "Traefik package to use.";
     };
diff --git a/nixos/modules/services/web-servers/trafficserver/default.nix b/nixos/modules/services/web-servers/trafficserver/default.nix
index 341e8b13976..706ea5bfefb 100644
--- a/nixos/modules/services/web-servers/trafficserver/default.nix
+++ b/nixos/modules/services/web-servers/trafficserver/default.nix
@@ -62,15 +62,17 @@ in
     ipAllow = mkOption {
       type = types.nullOr yaml.type;
       default = builtins.fromJSON (builtins.readFile ./ip_allow.json);
-      defaultText = "upstream defaults";
-      example = literalExample {
-        ip_allow = [{
-          apply = "in";
-          ip_addrs = "127.0.0.1";
-          action = "allow";
-          methods = "ALL";
-        }];
-      };
+      defaultText = literalDocBook "upstream defaults";
+      example = literalExpression ''
+        {
+          ip_allow = [{
+            apply = "in";
+            ip_addrs = "127.0.0.1";
+            action = "allow";
+            methods = "ALL";
+          }];
+        }
+      '';
       description = ''
         Control client access to Traffic Server and Traffic Server connections
         to upstream servers.
@@ -83,8 +85,8 @@ in
     logging = mkOption {
       type = types.nullOr yaml.type;
       default = builtins.fromJSON (builtins.readFile ./logging.json);
-      defaultText = "upstream defaults";
-      example = literalExample { };
+      defaultText = literalDocBook "upstream defaults";
+      example = { };
       description = ''
         Configure logs.
 
@@ -145,7 +147,7 @@ in
         in
         valueType;
       default = { };
-      example = literalExample { proxy.config.proxy_name = "my_server"; };
+      example = { proxy.config.proxy_name = "my_server"; };
       description = ''
         List of configurable variables used by Traffic Server.
 
@@ -197,12 +199,14 @@ in
     sni = mkOption {
       type = types.nullOr yaml.type;
       default = null;
-      example = literalExample {
-        sni = [{
-          fqdn = "no-http2.example.com";
-          https = "off";
-        }];
-      };
+      example = literalExpression ''
+        {
+          sni = [{
+            fqdn = "no-http2.example.com";
+            https = "off";
+          }];
+        }
+      '';
       description = ''
         Configure aspects of TLS connection handling for both inbound and
         outbound connections.
diff --git a/nixos/modules/services/web-servers/ttyd.nix b/nixos/modules/services/web-servers/ttyd.nix
index 68d55ee6ffd..431509f7fd5 100644
--- a/nixos/modules/services/web-servers/ttyd.nix
+++ b/nixos/modules/services/web-servers/ttyd.nix
@@ -78,7 +78,7 @@ in
       clientOptions = mkOption {
         type = types.attrsOf types.str;
         default = {};
-        example = literalExample ''{
+        example = literalExpression ''{
           fontSize = "16";
           fontFamily = "Fira Code";
 
diff --git a/nixos/modules/services/web-servers/unit/default.nix b/nixos/modules/services/web-servers/unit/default.nix
index 2a264bf2e9a..b2eecdbb53e 100644
--- a/nixos/modules/services/web-servers/unit/default.nix
+++ b/nixos/modules/services/web-servers/unit/default.nix
@@ -14,7 +14,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.unit;
-        defaultText = "pkgs.unit";
+        defaultText = literalExpression "pkgs.unit";
         description = "Unit package to use.";
       };
       user = mkOption {
@@ -45,7 +45,7 @@ in {
             "applications": {}
           }
         '';
-        example = literalExample ''
+        example = ''
           {
             "listeners": {
               "*:8300": {
diff --git a/nixos/modules/services/web-servers/uwsgi.nix b/nixos/modules/services/web-servers/uwsgi.nix
index 2dfc39c847a..ac435951310 100644
--- a/nixos/modules/services/web-servers/uwsgi.nix
+++ b/nixos/modules/services/web-servers/uwsgi.nix
@@ -114,7 +114,7 @@ in {
         default = {
           type = "normal";
         };
-        example = literalExample ''
+        example = literalExpression ''
           {
             type = "emperor";
             vassals = {
@@ -163,7 +163,7 @@ in {
         type = types.listOf types.str;
         apply = caps: caps ++ optionals isEmperor imperialPowers;
         default = [ ];
-        example = literalExample ''
+        example = literalExpression ''
           [
             "CAP_NET_BIND_SERVICE" # bind on ports <1024
             "CAP_NET_RAW"          # open raw sockets
diff --git a/nixos/modules/services/web-servers/varnish/default.nix b/nixos/modules/services/web-servers/varnish/default.nix
index 01fe3d12917..7597b80baf6 100644
--- a/nixos/modules/services/web-servers/varnish/default.nix
+++ b/nixos/modules/services/web-servers/varnish/default.nix
@@ -16,7 +16,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.varnish;
-        defaultText = "pkgs.varnish";
+        defaultText = literalExpression "pkgs.varnish";
         description = ''
           The package to use
         '';
@@ -48,7 +48,7 @@ in
       extraModules = mkOption {
         type = types.listOf types.package;
         default = [];
-        example = literalExample "[ pkgs.varnishPackages.geoip ]";
+        example = literalExpression "[ pkgs.varnishPackages.geoip ]";
         description = "
           Varnish modules (except 'std').
         ";
diff --git a/nixos/modules/services/web-servers/zope2.nix b/nixos/modules/services/web-servers/zope2.nix
index ab12e87502e..92210916022 100644
--- a/nixos/modules/services/web-servers/zope2.nix
+++ b/nixos/modules/services/web-servers/zope2.nix
@@ -75,7 +75,7 @@ in
     services.zope2.instances = mkOption {
       default = {};
       type = with types; attrsOf (submodule zope2Opts);
-      example = literalExample ''
+      example = literalExpression ''
         {
           plone01 = {
             http_address = "127.0.0.1:8080";
diff --git a/nixos/modules/services/x11/desktop-managers/cde.nix b/nixos/modules/services/x11/desktop-managers/cde.nix
index 24ca82fca79..7eb4d1bf729 100644
--- a/nixos/modules/services/x11/desktop-managers/cde.nix
+++ b/nixos/modules/services/x11/desktop-managers/cde.nix
@@ -14,7 +14,7 @@ in {
       default = with pkgs.xorg; [
         xclock bitmap xlsfonts xfd xrefresh xload xwininfo xdpyinfo xwd xwud
       ];
-      example = literalExample ''
+      defaultText = literalExpression ''
         with pkgs.xorg; [
           xclock bitmap xlsfonts xfd xrefresh xload xwininfo xdpyinfo xwd xwud
         ]
diff --git a/nixos/modules/services/x11/desktop-managers/cinnamon.nix b/nixos/modules/services/x11/desktop-managers/cinnamon.nix
index d201c1a5334..a0a5873f72f 100644
--- a/nixos/modules/services/x11/desktop-managers/cinnamon.nix
+++ b/nixos/modules/services/x11/desktop-managers/cinnamon.nix
@@ -26,7 +26,7 @@ in
       sessionPath = mkOption {
         default = [];
         type = types.listOf types.package;
-        example = literalExample "[ pkgs.gnome.gpaste ]";
+        example = literalExpression "[ pkgs.gnome.gpaste ]";
         description = ''
           Additional list of packages to be added to the session search path.
           Useful for GSettings-conditional autostart.
@@ -50,7 +50,7 @@ in
 
     environment.cinnamon.excludePackages = mkOption {
       default = [];
-      example = literalExample "[ pkgs.cinnamon.blueberry ]";
+      example = literalExpression "[ pkgs.cinnamon.blueberry ]";
       type = types.listOf types.package;
       description = "Which packages cinnamon should exclude from the default environment";
     };
diff --git a/nixos/modules/services/x11/desktop-managers/gnome.nix b/nixos/modules/services/x11/desktop-managers/gnome.nix
index 9bb671adbec..e65e0164667 100644
--- a/nixos/modules/services/x11/desktop-managers/gnome.nix
+++ b/nixos/modules/services/x11/desktop-managers/gnome.nix
@@ -186,7 +186,7 @@ in
       sessionPath = mkOption {
         default = [];
         type = types.listOf types.package;
-        example = literalExample "[ pkgs.gnome.gpaste ]";
+        example = literalExpression "[ pkgs.gnome.gpaste ]";
         description = ''
           Additional list of packages to be added to the session search path.
           Useful for GNOME Shell extensions or GSettings-conditional autostart.
@@ -200,9 +200,11 @@ in
         internal = true; # this is messy
         default = defaultFavoriteAppsOverride;
         type = types.lines;
-        example = literalExample ''
-          [org.gnome.shell]
-          favorite-apps=[ 'firefox.desktop', 'org.gnome.Calendar.desktop' ]
+        example = literalExpression ''
+          '''
+            [org.gnome.shell]
+            favorite-apps=[ 'firefox.desktop', 'org.gnome.Calendar.desktop' ]
+          '''
         '';
         description = "List of desktop files to put as favorite apps into gnome-shell. These need to be installed somehow globally.";
       };
@@ -242,13 +244,13 @@ in
               wmCommand = mkOption {
                 type = types.str;
                 description = "The executable of the window manager to use.";
-                example = "\${pkgs.haskellPackages.xmonad}/bin/xmonad";
+                example = literalExpression ''"''${pkgs.haskellPackages.xmonad}/bin/xmonad"'';
               };
 
               enableGnomePanel = mkOption {
                 type = types.bool;
                 default = true;
-                example = "false";
+                example = false;
                 description = "Whether to enable the GNOME panel in this session.";
               };
             };
@@ -259,20 +261,20 @@ in
 
         panelModulePackages = mkOption {
           default = [ pkgs.gnome.gnome-applets ];
+          defaultText = literalExpression "[ pkgs.gnome.gnome-applets ]";
           type = types.listOf types.path;
           description = ''
             Packages containing modules that should be made available to <literal>gnome-panel</literal> (usually for applets).
 
             If you're packaging something to use here, please install the modules in <literal>$out/lib/gnome-panel/modules</literal>.
           '';
-          example = literalExample "[ pkgs.gnome.gnome-applets ]";
         };
       };
     };
 
     environment.gnome.excludePackages = mkOption {
       default = [];
-      example = literalExample "[ pkgs.gnome.totem ]";
+      example = literalExpression "[ pkgs.gnome.totem ]";
       type = types.listOf types.package;
       description = "Which packages gnome should exclude from the default environment";
     };
diff --git a/nixos/modules/services/x11/desktop-managers/kodi.nix b/nixos/modules/services/x11/desktop-managers/kodi.nix
index af303d6fb27..b853c94d6fd 100644
--- a/nixos/modules/services/x11/desktop-managers/kodi.nix
+++ b/nixos/modules/services/x11/desktop-managers/kodi.nix
@@ -18,8 +18,8 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.kodi;
-        defaultText = "pkgs.kodi";
-        example = "pkgs.kodi.withPackages (p: with p; [ jellyfin pvr-iptvsimple vfs-sftp ])";
+        defaultText = literalExpression "pkgs.kodi";
+        example = literalExpression "pkgs.kodi.withPackages (p: with p; [ jellyfin pvr-iptvsimple vfs-sftp ])";
         description = ''
           Package that should be used for Kodi.
         '';
diff --git a/nixos/modules/services/x11/desktop-managers/lxqt.nix b/nixos/modules/services/x11/desktop-managers/lxqt.nix
index 71dfad5c7ca..720985ba0d9 100644
--- a/nixos/modules/services/x11/desktop-managers/lxqt.nix
+++ b/nixos/modules/services/x11/desktop-managers/lxqt.nix
@@ -19,7 +19,7 @@ in
 
     environment.lxqt.excludePackages = mkOption {
       default = [];
-      example = literalExample "[ pkgs.lxqt.qterminal ]";
+      example = literalExpression "[ pkgs.lxqt.qterminal ]";
       type = types.listOf types.package;
       description = "Which LXQt packages to exclude from the default environment";
     };
diff --git a/nixos/modules/services/x11/desktop-managers/mate.nix b/nixos/modules/services/x11/desktop-managers/mate.nix
index 19ab9edb732..f8f47a06145 100644
--- a/nixos/modules/services/x11/desktop-managers/mate.nix
+++ b/nixos/modules/services/x11/desktop-managers/mate.nix
@@ -35,7 +35,7 @@ in
 
     environment.mate.excludePackages = mkOption {
       default = [];
-      example = literalExample "[ pkgs.mate.mate-terminal pkgs.mate.pluma ]";
+      example = literalExpression "[ pkgs.mate.mate-terminal pkgs.mate.pluma ]";
       type = types.listOf types.package;
       description = "Which MATE packages to exclude from the default environment";
     };
diff --git a/nixos/modules/services/x11/desktop-managers/pantheon.nix b/nixos/modules/services/x11/desktop-managers/pantheon.nix
index 887d6c91e83..10969a373bb 100644
--- a/nixos/modules/services/x11/desktop-managers/pantheon.nix
+++ b/nixos/modules/services/x11/desktop-managers/pantheon.nix
@@ -43,7 +43,7 @@ in
       sessionPath = mkOption {
         default = [];
         type = types.listOf types.package;
-        example = literalExample "[ pkgs.gnome.gpaste ]";
+        example = literalExpression "[ pkgs.gnome.gpaste ]";
         description = ''
           Additional list of packages to be added to the session search path.
           Useful for GSettings-conditional autostart.
@@ -86,7 +86,7 @@ in
 
     environment.pantheon.excludePackages = mkOption {
       default = [];
-      example = literalExample "[ pkgs.pantheon.elementary-camera ]";
+      example = literalExpression "[ pkgs.pantheon.elementary-camera ]";
       type = types.listOf types.package;
       description = "Which packages pantheon should exclude from the default environment";
     };
diff --git a/nixos/modules/services/x11/desktop-managers/surf-display.nix b/nixos/modules/services/x11/desktop-managers/surf-display.nix
index 9aeb0bbd2a8..4b5a04f988b 100644
--- a/nixos/modules/services/x11/desktop-managers/surf-display.nix
+++ b/nixos/modules/services/x11/desktop-managers/surf-display.nix
@@ -50,6 +50,7 @@ in {
       defaultWwwUri = mkOption {
         type = types.str;
         default = "${pkgs.surf-display}/share/surf-display/empty-page.html";
+        defaultText = literalExpression ''"''${pkgs.surf-display}/share/surf-display/empty-page.html"'';
         example = "https://www.example.com/";
         description = "Default URI to display.";
       };
@@ -57,7 +58,7 @@ in {
       inactivityInterval = mkOption {
         type = types.int;
         default = 300;
-        example = "0";
+        example = 0;
         description = ''
           Setting for internal inactivity timer to restart surf-display if the
           user goes inactive/idle to get a fresh session for the next user of
diff --git a/nixos/modules/services/x11/desktop-managers/xfce.nix b/nixos/modules/services/x11/desktop-managers/xfce.nix
index bbfdea2225b..25276e1d649 100644
--- a/nixos/modules/services/x11/desktop-managers/xfce.nix
+++ b/nixos/modules/services/x11/desktop-managers/xfce.nix
@@ -49,7 +49,7 @@ in
       thunarPlugins = mkOption {
         default = [];
         type = types.listOf types.package;
-        example = literalExample "[ pkgs.xfce.thunar-archive-plugin ]";
+        example = literalExpression "[ pkgs.xfce.thunar-archive-plugin ]";
         description = ''
           A list of plugin that should be installed with Thunar.
         '';
diff --git a/nixos/modules/services/x11/desktop-managers/xterm.nix b/nixos/modules/services/x11/desktop-managers/xterm.nix
index f76db278a92..3424ee1b0e1 100644
--- a/nixos/modules/services/x11/desktop-managers/xterm.nix
+++ b/nixos/modules/services/x11/desktop-managers/xterm.nix
@@ -14,8 +14,8 @@ in
 
     services.xserver.desktopManager.xterm.enable = mkOption {
       type = types.bool;
-      default = (versionOlder config.system.stateVersion "19.09") && xSessionEnabled;
-      defaultText = if versionOlder config.system.stateVersion "19.09" then "config.services.xserver.enable" else "false";
+      default = versionOlder config.system.stateVersion "19.09" && xSessionEnabled;
+      defaultText = literalExpression ''versionOlder config.system.stateVersion "19.09" && config.services.xserver.enable;'';
       description = "Enable a xterm terminal as a desktop manager.";
     };
 
diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix
index 584dfb63c4d..7fc8db95a48 100644
--- a/nixos/modules/services/x11/display-managers/default.nix
+++ b/nixos/modules/services/x11/display-managers/default.nix
@@ -217,7 +217,7 @@ in
 
       session = mkOption {
         default = [];
-        example = literalExample
+        example = literalExpression
           ''
             [ { manage = "desktop";
                 name = "xterm";
@@ -305,9 +305,7 @@ in
 
         execCmd = mkOption {
           type = types.str;
-          example = literalExample ''
-            "''${pkgs.lightdm}/bin/lightdm"
-          '';
+          example = literalExpression ''"''${pkgs.lightdm}/bin/lightdm"'';
           description = "Command to start the display manager.";
         };
 
diff --git a/nixos/modules/services/x11/display-managers/lightdm-greeters/enso-os.nix b/nixos/modules/services/x11/display-managers/lightdm-greeters/enso-os.nix
index ecd46a9ee6d..930ee96b384 100644
--- a/nixos/modules/services/x11/display-managers/lightdm-greeters/enso-os.nix
+++ b/nixos/modules/services/x11/display-managers/lightdm-greeters/enso-os.nix
@@ -35,7 +35,7 @@ in {
         package = mkOption {
           type = types.package;
           default = pkgs.gnome.gnome-themes-extra;
-          defaultText = "pkgs.gnome.gnome-themes-extra";
+          defaultText = literalExpression "pkgs.gnome.gnome-themes-extra";
           description = ''
             The package path that contains the theme given in the name option.
           '';
@@ -54,7 +54,7 @@ in {
         package = mkOption {
           type = types.package;
           default = pkgs.papirus-icon-theme;
-          defaultText = "pkgs.papirus-icon-theme";
+          defaultText = literalExpression "pkgs.papirus-icon-theme";
           description = ''
             The package path that contains the icon theme given in the name option.
           '';
@@ -73,7 +73,7 @@ in {
         package = mkOption {
           type = types.package;
           default = pkgs.capitaine-cursors;
-          defaultText = "pkgs.capitaine-cursors";
+          defaultText = literalExpression "pkgs.capitaine-cursors";
           description = ''
             The package path that contains the cursor theme given in the name option.
           '';
diff --git a/nixos/modules/services/x11/display-managers/lightdm-greeters/gtk.nix b/nixos/modules/services/x11/display-managers/lightdm-greeters/gtk.nix
index fe5a16bc60f..debd4b568bf 100644
--- a/nixos/modules/services/x11/display-managers/lightdm-greeters/gtk.nix
+++ b/nixos/modules/services/x11/display-managers/lightdm-greeters/gtk.nix
@@ -48,7 +48,7 @@ in
         package = mkOption {
           type = types.package;
           default = pkgs.gnome.gnome-themes-extra;
-          defaultText = "pkgs.gnome.gnome-themes-extra";
+          defaultText = literalExpression "pkgs.gnome.gnome-themes-extra";
           description = ''
             The package path that contains the theme given in the name option.
           '';
@@ -69,7 +69,7 @@ in
         package = mkOption {
           type = types.package;
           default = pkgs.gnome.adwaita-icon-theme;
-          defaultText = "pkgs.gnome.adwaita-icon-theme";
+          defaultText = literalExpression "pkgs.gnome.adwaita-icon-theme";
           description = ''
             The package path that contains the icon theme given in the name option.
           '';
@@ -90,7 +90,7 @@ in
         package = mkOption {
           type = types.package;
           default = pkgs.gnome.adwaita-icon-theme;
-          defaultText = "pkgs.gnome.adwaita-icon-theme";
+          defaultText = literalExpression "pkgs.gnome.adwaita-icon-theme";
           description = ''
             The package path that contains the cursor theme given in the name option.
           '';
diff --git a/nixos/modules/services/x11/display-managers/lightdm.nix b/nixos/modules/services/x11/display-managers/lightdm.nix
index 41c1b635f5d..1c9a5f978c5 100644
--- a/nixos/modules/services/x11/display-managers/lightdm.nix
+++ b/nixos/modules/services/x11/display-managers/lightdm.nix
@@ -148,7 +148,7 @@ in
       background = mkOption {
         type = types.path;
         # Manual cannot depend on packages, we are actually setting the default in config below.
-        defaultText = "pkgs.nixos-artwork.wallpapers.simple-dark-gray-bottom.gnomeFilePath";
+        defaultText = literalExpression "pkgs.nixos-artwork.wallpapers.simple-dark-gray-bottom.gnomeFilePath";
         description = ''
           The background image or color to use.
         '';
diff --git a/nixos/modules/services/x11/display-managers/sddm.nix b/nixos/modules/services/x11/display-managers/sddm.nix
index d79b3cda2fc..5a4fad9c4cb 100644
--- a/nixos/modules/services/x11/display-managers/sddm.nix
+++ b/nixos/modules/services/x11/display-managers/sddm.nix
@@ -113,14 +113,12 @@ in
       settings = mkOption {
         type = iniFmt.type;
         default = { };
-        example = ''
-          {
-            Autologin = {
-              User = "john";
-              Session = "plasma.desktop";
-            };
-          }
-        '';
+        example = {
+          Autologin = {
+            User = "john";
+            Session = "plasma.desktop";
+          };
+        };
         description = ''
           Extra settings merged in and overwritting defaults in sddm.conf.
         '';
diff --git a/nixos/modules/services/x11/extra-layouts.nix b/nixos/modules/services/x11/extra-layouts.nix
index b1c4e04975f..159bed63e13 100644
--- a/nixos/modules/services/x11/extra-layouts.nix
+++ b/nixos/modules/services/x11/extra-layouts.nix
@@ -93,7 +93,7 @@ in
     extraLayouts = mkOption {
       type = types.attrsOf (types.submodule layoutOpts);
       default = {};
-      example = literalExample
+      example = literalExpression
       ''
         {
           mine = {
diff --git a/nixos/modules/services/x11/imwheel.nix b/nixos/modules/services/x11/imwheel.nix
index 51f72dadbd4..ae990141a50 100644
--- a/nixos/modules/services/x11/imwheel.nix
+++ b/nixos/modules/services/x11/imwheel.nix
@@ -21,15 +21,17 @@ in
         rules = mkOption {
           type = types.attrsOf types.str;
           default = {};
-          example = literalExample ''
-            ".*" = '''
-              None,      Up,   Button4, 8
-              None,      Down, Button5, 8
-              Shift_L,   Up,   Shift_L|Button4, 4
-              Shift_L,   Down, Shift_L|Button5, 4
-              Control_L, Up,   Control_L|Button4
-              Control_L, Down, Control_L|Button5
-            ''';
+          example = literalExpression ''
+            {
+              ".*" = '''
+                None,      Up,   Button4, 8
+                None,      Down, Button5, 8
+                Shift_L,   Up,   Shift_L|Button4, 4
+                Shift_L,   Down, Shift_L|Button5, 4
+                Control_L, Up,   Control_L|Button4
+                Control_L, Down, Control_L|Button5
+              ''';
+            }
           '';
           description = ''
             Window class translation rules.
diff --git a/nixos/modules/services/x11/picom.nix b/nixos/modules/services/x11/picom.nix
index 977d0fea219..dbd4b1cefef 100644
--- a/nixos/modules/services/x11/picom.nix
+++ b/nixos/modules/services/x11/picom.nix
@@ -254,7 +254,7 @@ in {
     in mkOption {
       type = topLevel;
       default = { };
-      example = literalExample ''
+      example = literalExpression ''
         blur =
           { method = "gaussian";
             size = 10;
diff --git a/nixos/modules/services/x11/redshift.nix b/nixos/modules/services/x11/redshift.nix
index 60d80a28762..cc9f964754f 100644
--- a/nixos/modules/services/x11/redshift.nix
+++ b/nixos/modules/services/x11/redshift.nix
@@ -76,7 +76,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.redshift;
-      defaultText = "pkgs.redshift";
+      defaultText = literalExpression "pkgs.redshift";
       description = ''
         redshift derivation to use.
       '';
diff --git a/nixos/modules/services/x11/touchegg.nix b/nixos/modules/services/x11/touchegg.nix
index fab7fac3f01..9d3678e7696 100644
--- a/nixos/modules/services/x11/touchegg.nix
+++ b/nixos/modules/services/x11/touchegg.nix
@@ -16,7 +16,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.touchegg;
-      defaultText = "pkgs.touchegg";
+      defaultText = literalExpression "pkgs.touchegg";
       description = "touchegg derivation to use.";
     };
   };
diff --git a/nixos/modules/services/x11/unclutter-xfixes.nix b/nixos/modules/services/x11/unclutter-xfixes.nix
index 71262431b68..0b4d06f640d 100644
--- a/nixos/modules/services/x11/unclutter-xfixes.nix
+++ b/nixos/modules/services/x11/unclutter-xfixes.nix
@@ -17,7 +17,7 @@ in {
       description = "unclutter-xfixes derivation to use.";
       type = types.package;
       default = pkgs.unclutter-xfixes;
-      defaultText = "pkgs.unclutter-xfixes";
+      defaultText = literalExpression "pkgs.unclutter-xfixes";
     };
 
     timeout = mkOption {
diff --git a/nixos/modules/services/x11/unclutter.nix b/nixos/modules/services/x11/unclutter.nix
index 56e30c79d1f..bdb5fa7b50c 100644
--- a/nixos/modules/services/x11/unclutter.nix
+++ b/nixos/modules/services/x11/unclutter.nix
@@ -16,7 +16,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.unclutter;
-      defaultText = "pkgs.unclutter";
+      defaultText = literalExpression "pkgs.unclutter";
       description = "unclutter derivation to use.";
     };
 
diff --git a/nixos/modules/services/x11/urxvtd.nix b/nixos/modules/services/x11/urxvtd.nix
index 867ac38a944..0a0df447f4e 100644
--- a/nixos/modules/services/x11/urxvtd.nix
+++ b/nixos/modules/services/x11/urxvtd.nix
@@ -19,7 +19,7 @@ in {
 
     package = mkOption {
       default = pkgs.rxvt-unicode;
-      defaultText = "pkgs.rxvt-unicode";
+      defaultText = literalExpression "pkgs.rxvt-unicode";
       description = ''
         Package to install. Usually pkgs.rxvt-unicode.
       '';
diff --git a/nixos/modules/services/x11/window-managers/awesome.nix b/nixos/modules/services/x11/window-managers/awesome.nix
index 37a14e34f57..c6c0c934f9a 100644
--- a/nixos/modules/services/x11/window-managers/awesome.nix
+++ b/nixos/modules/services/x11/window-managers/awesome.nix
@@ -27,7 +27,7 @@ in
         default = [];
         type = types.listOf types.package;
         description = "List of lua packages available for being used in the Awesome configuration.";
-        example = literalExample "[ pkgs.luaPackages.vicious ]";
+        example = literalExpression "[ pkgs.luaPackages.vicious ]";
       };
 
       package = mkOption {
diff --git a/nixos/modules/services/x11/window-managers/bspwm.nix b/nixos/modules/services/x11/window-managers/bspwm.nix
index 23cd4f6529a..ade24061a06 100644
--- a/nixos/modules/services/x11/window-managers/bspwm.nix
+++ b/nixos/modules/services/x11/window-managers/bspwm.nix
@@ -14,15 +14,15 @@ in
       package = mkOption {
         type        = types.package;
         default     = pkgs.bspwm;
-        defaultText = "pkgs.bspwm";
-        example     = "pkgs.bspwm-unstable";
+        defaultText = literalExpression "pkgs.bspwm";
+        example     = literalExpression "pkgs.bspwm-unstable";
         description = ''
           bspwm package to use.
         '';
       };
       configFile = mkOption {
         type        = with types; nullOr path;
-        example     = "${pkgs.bspwm}/share/doc/bspwm/examples/bspwmrc";
+        example     = literalExpression ''"''${pkgs.bspwm}/share/doc/bspwm/examples/bspwmrc"'';
         default     = null;
         description = ''
           Path to the bspwm configuration file.
@@ -34,15 +34,15 @@ in
         package = mkOption {
           type        = types.package;
           default     = pkgs.sxhkd;
-          defaultText = "pkgs.sxhkd";
-          example     = "pkgs.sxhkd-unstable";
+          defaultText = literalExpression "pkgs.sxhkd";
+          example     = literalExpression "pkgs.sxhkd-unstable";
           description = ''
             sxhkd package to use.
           '';
         };
         configFile = mkOption {
           type        = with types; nullOr path;
-          example     = "${pkgs.bspwm}/share/doc/bspwm/examples/sxhkdrc";
+          example     = literalExpression ''"''${pkgs.bspwm}/share/doc/bspwm/examples/sxhkdrc"'';
           default     = null;
           description = ''
             Path to the sxhkd configuration file.
diff --git a/nixos/modules/services/x11/window-managers/clfswm.nix b/nixos/modules/services/x11/window-managers/clfswm.nix
index 5015852db69..78772c79974 100644
--- a/nixos/modules/services/x11/window-managers/clfswm.nix
+++ b/nixos/modules/services/x11/window-managers/clfswm.nix
@@ -13,7 +13,7 @@ in
       package = mkOption {
         type        = types.package;
         default     = pkgs.lispPackages.clfswm;
-        defaultText = "pkgs.lispPackages.clfswm";
+        defaultText = literalExpression "pkgs.lispPackages.clfswm";
         description = ''
           clfswm package to use.
         '';
diff --git a/nixos/modules/services/x11/window-managers/exwm.nix b/nixos/modules/services/x11/window-managers/exwm.nix
index 4b707d39849..b505f720f04 100644
--- a/nixos/modules/services/x11/window-managers/exwm.nix
+++ b/nixos/modules/services/x11/window-managers/exwm.nix
@@ -22,7 +22,7 @@ in
       loadScript = mkOption {
         default = "(require 'exwm)";
         type = types.lines;
-        example = literalExample ''
+        example = ''
           (require 'exwm)
           (exwm-enable)
         '';
@@ -39,8 +39,9 @@ in
       };
       extraPackages = mkOption {
         type = types.functionTo (types.listOf types.package);
-        default = self: [];
-        example = literalExample ''
+        default = epkgs: [];
+        defaultText = literalExpression "epkgs: []";
+        example = literalExpression ''
           epkgs: [
             epkgs.emms
             epkgs.magit
diff --git a/nixos/modules/services/x11/window-managers/herbstluftwm.nix b/nixos/modules/services/x11/window-managers/herbstluftwm.nix
index 548097a412d..354d70c695c 100644
--- a/nixos/modules/services/x11/window-managers/herbstluftwm.nix
+++ b/nixos/modules/services/x11/window-managers/herbstluftwm.nix
@@ -14,7 +14,7 @@ in
       package = mkOption {
         type = types.package;
         default = pkgs.herbstluftwm;
-        defaultText = "pkgs.herbstluftwm";
+        defaultText = literalExpression "pkgs.herbstluftwm";
         description = ''
           Herbstluftwm package to use.
         '';
diff --git a/nixos/modules/services/x11/window-managers/i3.nix b/nixos/modules/services/x11/window-managers/i3.nix
index 0ef55d5f2c0..99f9997024f 100644
--- a/nixos/modules/services/x11/window-managers/i3.nix
+++ b/nixos/modules/services/x11/window-managers/i3.nix
@@ -30,8 +30,8 @@ in
     package = mkOption {
       type        = types.package;
       default     = pkgs.i3;
-      defaultText = "pkgs.i3";
-      example     = "pkgs.i3-gaps";
+      defaultText = literalExpression "pkgs.i3";
+      example     = literalExpression "pkgs.i3-gaps";
       description = ''
         i3 package to use.
       '';
@@ -40,7 +40,7 @@ in
     extraPackages = mkOption {
       type = with types; listOf package;
       default = with pkgs; [ dmenu i3status i3lock ];
-      example = literalExample ''
+      defaultText = literalExpression ''
         with pkgs; [
           dmenu
           i3status
diff --git a/nixos/modules/services/x11/window-managers/wmderland.nix b/nixos/modules/services/x11/window-managers/wmderland.nix
index a6864a82771..56b69220965 100644
--- a/nixos/modules/services/x11/window-managers/wmderland.nix
+++ b/nixos/modules/services/x11/window-managers/wmderland.nix
@@ -28,7 +28,7 @@ in
         feh
         rxvt-unicode
       ];
-      example = literalExample ''
+      defaultText = literalExpression ''
         with pkgs; [
           rofi
           dunst
diff --git a/nixos/modules/services/x11/window-managers/xmonad.nix b/nixos/modules/services/x11/window-managers/xmonad.nix
index fe8ed381251..6aa0d5f76f2 100644
--- a/nixos/modules/services/x11/window-managers/xmonad.nix
+++ b/nixos/modules/services/x11/window-managers/xmonad.nix
@@ -2,7 +2,7 @@
 
 with lib;
 let
-  inherit (lib) mkOption mkIf optionals literalExample;
+  inherit (lib) mkOption mkIf optionals literalExpression;
   cfg = config.services.xserver.windowManager.xmonad;
 
   ghcWithPackages = cfg.haskellPackages.ghcWithPackages;
@@ -42,8 +42,8 @@ in {
       enable = mkEnableOption "xmonad";
       haskellPackages = mkOption {
         default = pkgs.haskellPackages;
-        defaultText = "pkgs.haskellPackages";
-        example = literalExample "pkgs.haskell.packages.ghc784";
+        defaultText = literalExpression "pkgs.haskellPackages";
+        example = literalExpression "pkgs.haskell.packages.ghc784";
         description = ''
           haskellPackages used to build Xmonad and other packages.
           This can be used to change the GHC version used to build
@@ -55,8 +55,8 @@ in {
       extraPackages = mkOption {
         type = types.functionTo (types.listOf types.package);
         default = self: [];
-        defaultText = "self: []";
-        example = literalExample ''
+        defaultText = literalExpression "self: []";
+        example = literalExpression ''
           haskellPackages: [
             haskellPackages.xmonad-contrib
             haskellPackages.monad-logger
diff --git a/nixos/modules/services/x11/xautolock.nix b/nixos/modules/services/x11/xautolock.nix
index 5ce08fce7c4..947d8f4edfb 100644
--- a/nixos/modules/services/x11/xautolock.nix
+++ b/nixos/modules/services/x11/xautolock.nix
@@ -27,7 +27,8 @@ in
 
         locker = mkOption {
           default = "${pkgs.xlockmore}/bin/xlock"; # default according to `man xautolock`
-          example = "${pkgs.i3lock}/bin/i3lock -i /path/to/img";
+          defaultText = literalExpression ''"''${pkgs.xlockmore}/bin/xlock"'';
+          example = literalExpression ''"''${pkgs.i3lock}/bin/i3lock -i /path/to/img"'';
           type = types.str;
 
           description = ''
@@ -37,7 +38,7 @@ in
 
         nowlocker = mkOption {
           default = null;
-          example = "${pkgs.i3lock}/bin/i3lock -i /path/to/img";
+          example = literalExpression ''"''${pkgs.i3lock}/bin/i3lock -i /path/to/img"'';
           type = types.nullOr types.str;
 
           description = ''
@@ -56,7 +57,7 @@ in
 
         notifier = mkOption {
           default = null;
-          example = "${pkgs.libnotify}/bin/notify-send \"Locking in 10 seconds\"";
+          example = literalExpression ''"''${pkgs.libnotify}/bin/notify-send 'Locking in 10 seconds'"'';
           type = types.nullOr types.str;
 
           description = ''
diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix
index ee190ac3cc4..cb620f10b13 100644
--- a/nixos/modules/services/x11/xserver.nix
+++ b/nixos/modules/services/x11/xserver.nix
@@ -217,7 +217,7 @@ in
       inputClassSections = mkOption {
         type = types.listOf types.lines;
         default = [];
-        example = literalExample ''
+        example = literalExpression ''
           [ '''
               Identifier      "Trackpoint Wheel Emulation"
               MatchProduct    "ThinkPad USB Keyboard with TrackPoint"
@@ -233,7 +233,7 @@ in
       modules = mkOption {
         type = types.listOf types.path;
         default = [];
-        example = literalExample "[ pkgs.xf86_input_wacom ]";
+        example = literalExpression "[ pkgs.xf86_input_wacom ]";
         description = "Packages to be added to the module search path of the X server.";
       };
 
@@ -351,6 +351,7 @@ in
       xkbDir = mkOption {
         type = types.path;
         default = "${pkgs.xkeyboard_config}/etc/X11/xkb";
+        defaultText = literalExpression ''"''${pkgs.xkeyboard_config}/etc/X11/xkb"'';
         description = ''
           Path used for -xkbdir xserver parameter.
         '';
diff --git a/nixos/modules/system/activation/activation-script.nix b/nixos/modules/system/activation/activation-script.nix
index 704fc15fe20..8dbfe393f10 100644
--- a/nixos/modules/system/activation/activation-script.nix
+++ b/nixos/modules/system/activation/activation-script.nix
@@ -110,7 +110,7 @@ in
     system.activationScripts = mkOption {
       default = {};
 
-      example = literalExample ''
+      example = literalExpression ''
         { stdio.text =
           '''
             # Needed by some programs.
@@ -147,7 +147,7 @@ in
     system.userActivationScripts = mkOption {
       default = {};
 
-      example = literalExample ''
+      example = literalExpression ''
         { plasmaSetup = {
             text = '''
               ${pkgs.libsForQt5.kservice}/bin/kbuildsycoca5"
@@ -193,9 +193,8 @@ in
 
     environment.usrbinenv = mkOption {
       default = "${pkgs.coreutils}/bin/env";
-      example = literalExample ''
-        "''${pkgs.busybox}/bin/env"
-      '';
+      defaultText = literalExpression ''"''${pkgs.coreutils}/bin/env"'';
+      example = literalExpression ''"''${pkgs.busybox}/bin/env"'';
       type = types.nullOr types.path;
       visible = false;
       description = ''
diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix
index dad9acba91a..026fd1791d3 100644
--- a/nixos/modules/system/activation/top-level.nix
+++ b/nixos/modules/system/activation/top-level.nix
@@ -155,7 +155,7 @@ in
 
     specialisation = mkOption {
       default = {};
-      example = lib.literalExample "{ fewJobsManyCores.configuration = { nix.buildCores = 0; nix.maxJobs = 1; }; }";
+      example = lib.literalExpression "{ fewJobsManyCores.configuration = { nix.buildCores = 0; nix.maxJobs = 1; }; }";
       description = ''
         Additional configurations to build. If
         <literal>inheritParentConfig</literal> is true, the system
@@ -243,7 +243,7 @@ in
 
     system.replaceRuntimeDependencies = mkOption {
       default = [];
-      example = lib.literalExample "[ ({ original = pkgs.openssl; replacement = pkgs.callPackage /path/to/openssl { }; }) ]";
+      example = lib.literalExpression "[ ({ original = pkgs.openssl; replacement = pkgs.callPackage /path/to/openssl { }; }) ]";
       type = types.listOf (types.submodule (
         { ... }: {
           options.original = mkOption {
@@ -274,7 +274,11 @@ in
         if config.networking.hostName == ""
         then "unnamed"
         else config.networking.hostName;
-      defaultText = '''networking.hostName' if non empty else "unnamed"'';
+      defaultText = literalExpression ''
+        if config.networking.hostName == ""
+        then "unnamed"
+        else config.networking.hostName;
+      '';
       description = ''
         The name of the system used in the <option>system.build.toplevel</option> derivation.
         </para><para>
diff --git a/nixos/modules/system/boot/initrd-openvpn.nix b/nixos/modules/system/boot/initrd-openvpn.nix
index b35fb0b57c0..9b52d4bbdb1 100644
--- a/nixos/modules/system/boot/initrd-openvpn.nix
+++ b/nixos/modules/system/boot/initrd-openvpn.nix
@@ -35,7 +35,7 @@ in
           </para>
         </warning>
       '';
-      example = "./configuration.ovpn";
+      example = literalExpression "./configuration.ovpn";
     };
 
   };
diff --git a/nixos/modules/system/boot/initrd-ssh.nix b/nixos/modules/system/boot/initrd-ssh.nix
index 00ac83a1897..0999142de86 100644
--- a/nixos/modules/system/boot/initrd-ssh.nix
+++ b/nixos/modules/system/boot/initrd-ssh.nix
@@ -78,7 +78,7 @@ in
     authorizedKeys = mkOption {
       type = types.listOf types.str;
       default = config.users.users.root.openssh.authorizedKeys.keys;
-      defaultText = "config.users.users.root.openssh.authorizedKeys.keys";
+      defaultText = literalExpression "config.users.users.root.openssh.authorizedKeys.keys";
       description = ''
         Authorized keys for the root user on initrd.
       '';
diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix
index 15a5fd23609..46f2e3fec04 100644
--- a/nixos/modules/system/boot/kernel.nix
+++ b/nixos/modules/system/boot/kernel.nix
@@ -23,7 +23,7 @@ in
 
     boot.kernel.features = mkOption {
       default = {};
-      example = literalExample "{ debug = true; }";
+      example = literalExpression "{ debug = true; }";
       internal = true;
       description = ''
         This option allows to enable or disable certain kernel features.
@@ -46,8 +46,8 @@ in
       });
       # We don't want to evaluate all of linuxPackages for the manual
       # - some of it might not even evaluate correctly.
-      defaultText = "pkgs.linuxPackages";
-      example = literalExample "pkgs.linuxKernel.packages.linux_5_10";
+      defaultText = literalExpression "pkgs.linuxPackages";
+      example = literalExpression "pkgs.linuxKernel.packages.linux_5_10";
       description = ''
         This option allows you to override the Linux kernel used by
         NixOS.  Since things like external kernel module packages are
@@ -65,7 +65,7 @@ in
     boot.kernelPatches = mkOption {
       type = types.listOf types.attrs;
       default = [];
-      example = literalExample "[ pkgs.kernelPatches.ubuntu_fan_4_4 ]";
+      example = literalExpression "[ pkgs.kernelPatches.ubuntu_fan_4_4 ]";
       description = "A list of additional patches to apply to the kernel.";
     };
 
@@ -113,7 +113,7 @@ in
     boot.extraModulePackages = mkOption {
       type = types.listOf types.package;
       default = [];
-      example = literalExample "[ config.boot.kernelPackages.nvidia_x11 ]";
+      example = literalExpression "[ config.boot.kernelPackages.nvidia_x11 ]";
       description = "A list of additional packages supplying kernel modules.";
     };
 
@@ -181,7 +181,7 @@ in
 
     system.requiredKernelConfig = mkOption {
       default = [];
-      example = literalExample ''
+      example = literalExpression ''
         with config.lib.kernelConfig; [
           (isYes "MODULES")
           (isEnabled "FB_CON_DECOR")
diff --git a/nixos/modules/system/boot/kernel_config.nix b/nixos/modules/system/boot/kernel_config.nix
index 5d9534024b0..495fe74bc21 100644
--- a/nixos/modules/system/boot/kernel_config.nix
+++ b/nixos/modules/system/boot/kernel_config.nix
@@ -100,7 +100,7 @@ in
 
     settings = mkOption {
       type = types.attrsOf kernelItem;
-      example = literalExample '' with lib.kernel; {
+      example = literalExpression '' with lib.kernel; {
         "9P_NET" = yes;
         USB = option yes;
         MMC_BLOCK_MINORS = freeform "32";
diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix
index 1be66367038..fa8500dd42b 100644
--- a/nixos/modules/system/boot/loader/grub/grub.nix
+++ b/nixos/modules/system/boot/loader/grub/grub.nix
@@ -329,7 +329,7 @@ in
 
       extraInstallCommands = mkOption {
         default = "";
-        example = literalExample ''
+        example = ''
           # the example below generates detached signatures that GRUB can verify
           # https://www.gnu.org/software/grub/manual/grub/grub.html#Using-digital-signatures
           ''${pkgs.findutils}/bin/find /boot -not -path "/boot/efi/*" -type f -name '*.sig' -delete
@@ -392,7 +392,7 @@ in
       extraFiles = mkOption {
         type = types.attrsOf types.path;
         default = {};
-        example = literalExample ''
+        example = literalExpression ''
           { "memtest.bin" = "''${pkgs.memtest86plus}/memtest.bin"; }
         '';
         description = ''
@@ -413,7 +413,7 @@ in
 
       splashImage = mkOption {
         type = types.nullOr types.path;
-        example = literalExample "./my-background.png";
+        example = literalExpression "./my-background.png";
         description = ''
           Background image used for GRUB.
           Set to <literal>null</literal> to run GRUB in text mode.
@@ -449,7 +449,7 @@ in
 
       theme = mkOption {
         type = types.nullOr types.path;
-        example = literalExample "pkgs.nixos-grub2-theme";
+        example = literalExpression "pkgs.nixos-grub2-theme";
         default = null;
         description = ''
           Grub theme to be used.
@@ -475,7 +475,7 @@ in
       font = mkOption {
         type = types.nullOr types.path;
         default = "${realGrub}/share/grub/unicode.pf2";
-        defaultText = ''"''${pkgs.grub2}/share/grub/unicode.pf2"'';
+        defaultText = literalExpression ''"''${pkgs.grub2}/share/grub/unicode.pf2"'';
         description = ''
           Path to a TrueType, OpenType, or pf2 font to be used by Grub.
         '';
@@ -483,7 +483,7 @@ in
 
       fontSize = mkOption {
         type = types.nullOr types.int;
-        example = literalExample 16;
+        example = 16;
         default = null;
         description = ''
           Font size for the grub menu. Ignored unless <literal>font</literal>
diff --git a/nixos/modules/system/boot/loader/grub/ipxe.nix b/nixos/modules/system/boot/loader/grub/ipxe.nix
index 249c2761934..ef8595592f4 100644
--- a/nixos/modules/system/boot/loader/grub/ipxe.nix
+++ b/nixos/modules/system/boot/loader/grub/ipxe.nix
@@ -33,7 +33,7 @@ in
             booting from the GRUB boot menu.
           '';
         default = { };
-        example = literalExample ''
+        example = literalExpression ''
           { demo = '''
               #!ipxe
               dhcp
diff --git a/nixos/modules/system/boot/luksroot.nix b/nixos/modules/system/boot/luksroot.nix
index f87d3b07a36..fb5269e43d0 100644
--- a/nixos/modules/system/boot/luksroot.nix
+++ b/nixos/modules/system/boot/luksroot.nix
@@ -663,13 +663,11 @@ in
                 };
 
                 encryptedPass = mkOption {
-                  default = "";
                   type = types.path;
                   description = "Path to the GPG encrypted passphrase.";
                 };
 
                 publicKey = mkOption {
-                  default = "";
                   type = types.path;
                   description = "Path to the Public Key.";
                 };
diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix
index bf254be1341..a50abc73511 100644
--- a/nixos/modules/system/boot/networkd.nix
+++ b/nixos/modules/system/boot/networkd.nix
@@ -844,7 +844,6 @@ let
     options = {
       wireguardPeerConfig = mkOption {
         default = {};
-        example = { };
         type = types.addCheck (types.attrsOf unitOption) check.netdev.sectionWireGuardPeer;
         description = ''
           Each attribute in this set specifies an option in the
@@ -859,7 +858,6 @@ let
   netdevOptions = commonNetworkOptions // {
 
     netdevConfig = mkOption {
-      default = {};
       example = { Name = "mybridge"; Kind = "bridge"; };
       type = types.addCheck (types.attrsOf unitOption) check.netdev.sectionNetdev;
       description = ''
@@ -896,7 +894,6 @@ let
 
     vxlanConfig = mkOption {
       default = {};
-      example = { Id = "4"; };
       type = types.addCheck (types.attrsOf unitOption) check.netdev.sectionVXLAN;
       description = ''
         Each attribute in this set specifies an option in the
@@ -959,7 +956,7 @@ let
       example = {
         PrivateKeyFile = "/etc/wireguard/secret.key";
         ListenPort = 51820;
-        FwMark = 42;
+        FirewallMark = 42;
       };
       type = types.addCheck (types.attrsOf unitOption) check.netdev.sectionWireGuard;
       description = ''
@@ -1038,7 +1035,6 @@ let
   addressOptions = {
     options = {
       addressConfig = mkOption {
-        default = {};
         example = { Address = "192.168.0.100/24"; };
         type = types.addCheck (types.attrsOf unitOption) check.network.sectionAddress;
         description = ''
@@ -1055,7 +1051,7 @@ let
     options = {
       routingPolicyRuleConfig = mkOption {
         default = { };
-        example = { routingPolicyRuleConfig = { Table = 10; IncomingInterface = "eth1"; Family = "both"; } ;};
+        example = { Table = 10; IncomingInterface = "eth1"; Family = "both"; };
         type = types.addCheck (types.attrsOf unitOption) check.network.sectionRoutingPolicyRule;
         description = ''
           Each attribute in this set specifies an option in the
@@ -1146,7 +1142,7 @@ let
 
     dhcpV6Config = mkOption {
       default = {};
-      example = { UseDNS = true; UseRoutes = true; };
+      example = { UseDNS = true; };
       type = types.addCheck (types.attrsOf unitOption) check.network.sectionDHCPv6;
       description = ''
         Each attribute in this set specifies an option in the
@@ -1213,7 +1209,7 @@ let
 
     ipv6Prefixes = mkOption {
       default = [];
-      example = { AddressAutoconfiguration = true; OnLink = true; };
+      example = [ { AddressAutoconfiguration = true; OnLink = true; } ];
       type = with types; listOf (submodule ipv6PrefixOptions);
       description = ''
         A list of ipv6Prefix sections to be added to the unit.  See
diff --git a/nixos/modules/system/boot/plymouth.nix b/nixos/modules/system/boot/plymouth.nix
index 2a545e55251..4b8194d2f85 100644
--- a/nixos/modules/system/boot/plymouth.nix
+++ b/nixos/modules/system/boot/plymouth.nix
@@ -62,6 +62,7 @@ in
 
       font = mkOption {
         default = "${pkgs.dejavu_fonts.minimal}/share/fonts/truetype/DejaVuSans.ttf";
+        defaultText = literalExpression ''"''${pkgs.dejavu_fonts.minimal}/share/fonts/truetype/DejaVuSans.ttf"'';
         type = types.path;
         description = ''
           Font file made available for displaying text on the splash screen.
@@ -88,7 +89,7 @@ in
         type = types.path;
         # Dimensions are 48x48 to match GDM logo
         default = "${nixos-icons}/share/icons/hicolor/48x48/apps/nix-snowflake-white.png";
-        defaultText = ''pkgs.fetchurl {
+        defaultText = literalExpression ''pkgs.fetchurl {
           url = "https://nixos.org/logo/nixos-hires.png";
           sha256 = "1ivzgd7iz0i06y36p8m5w48fd8pjqwxhdaavc0pxs7w1g7mcy5si";
         }'';
diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix
index 03133fa1bc4..bd7e955a6f4 100644
--- a/nixos/modules/system/boot/stage-1.nix
+++ b/nixos/modules/system/boot/stage-1.nix
@@ -411,7 +411,7 @@ in
     boot.initrd.enable = mkOption {
       type = types.bool;
       default = !config.boot.isContainer;
-      defaultText = "!config.boot.isContainer";
+      defaultText = literalExpression "!config.boot.isContainer";
       description = ''
         Whether to enable the NixOS initial RAM disk (initrd). This may be
         needed to perform some initialisation tasks (like mounting
@@ -527,7 +527,7 @@ in
         then "zstd"
         else "gzip"
       );
-      defaultText = "zstd if the kernel supports it (5.9+), gzip if not.";
+      defaultText = literalDocBook "<literal>zstd</literal> if the kernel supports it (5.9+), <literal>gzip</literal> if not";
       type = types.unspecified; # We don't have a function type...
       description = ''
         The compressor to use on the initrd image. May be any of:
@@ -559,7 +559,7 @@ in
             is the path it should be copied from (or null for the same
             path inside and out).
           '';
-        example = literalExample
+        example = literalExpression
           ''
             { "/etc/dropbear/dropbear_rsa_host_key" =
                 ./secret-dropbear-key;
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index 9693e2e377a..93ea77d1ee7 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -426,7 +426,7 @@ in
 
     systemd.package = mkOption {
       default = pkgs.systemd;
-      defaultText = "pkgs.systemd";
+      defaultText = literalExpression "pkgs.systemd";
       type = types.package;
       description = "The systemd package.";
     };
@@ -446,7 +446,7 @@ in
     systemd.packages = mkOption {
       default = [];
       type = types.listOf types.package;
-      example = literalExample "[ pkgs.systemd-cryptsetup-generator ]";
+      example = literalExpression "[ pkgs.systemd-cryptsetup-generator ]";
       description = "Packages providing systemd units and hooks.";
     };
 
@@ -663,7 +663,7 @@ in
 
     services.journald.forwardToSyslog = mkOption {
       default = config.services.rsyslogd.enable || config.services.syslog-ng.enable;
-      defaultText = "services.rsyslogd.enable || services.syslog-ng.enable";
+      defaultText = literalExpression "services.rsyslogd.enable || services.syslog-ng.enable";
       type = types.bool;
       description = ''
         Whether to forward log messages to syslog.
@@ -722,7 +722,7 @@ in
 
     services.logind.lidSwitchExternalPower = mkOption {
       default = config.services.logind.lidSwitch;
-      defaultText = "services.logind.lidSwitch";
+      defaultText = literalExpression "services.logind.lidSwitch";
       example = "ignore";
       type = logindHandlerType;
 
@@ -768,7 +768,7 @@ in
     systemd.tmpfiles.packages = mkOption {
       type = types.listOf types.package;
       default = [];
-      example = literalExample "[ pkgs.lvm2 ]";
+      example = literalExpression "[ pkgs.lvm2 ]";
       apply = map getLib;
       description = ''
         List of packages containing <command>systemd-tmpfiles</command> rules.
diff --git a/nixos/modules/system/etc/etc.nix b/nixos/modules/system/etc/etc.nix
index 80e728d09a6..8f14f04a1f6 100644
--- a/nixos/modules/system/etc/etc.nix
+++ b/nixos/modules/system/etc/etc.nix
@@ -72,7 +72,7 @@ in
 
     environment.etc = mkOption {
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         { example-configuration-file =
             { source = "/nix/store/.../etc/dir/file.conf.example";
               mode = "0440";
diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix
index 4f56504f45e..225bcbe58e0 100644
--- a/nixos/modules/tasks/filesystems.nix
+++ b/nixos/modules/tasks/filesystems.nix
@@ -163,7 +163,7 @@ in
 
     fileSystems = mkOption {
       default = {};
-      example = literalExample ''
+      example = literalExpression ''
         {
           "/".device = "/dev/hda1";
           "/data" = {
diff --git a/nixos/modules/tasks/filesystems/nfs.nix b/nixos/modules/tasks/filesystems/nfs.nix
index fd35c35d32a..38c3920a78a 100644
--- a/nixos/modules/tasks/filesystems/nfs.nix
+++ b/nixos/modules/tasks/filesystems/nfs.nix
@@ -35,7 +35,7 @@ in
           <link xlink:href="https://linux.die.net/man/5/idmapd.conf"/>
           for details.
         '';
-        example = literalExample ''
+        example = literalExpression ''
           {
             Translation = {
               GSS-Methods = "static,nsswitch";
diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix
index cb0e6640247..2c03ef7ba7e 100644
--- a/nixos/modules/tasks/filesystems/zfs.nix
+++ b/nixos/modules/tasks/filesystems/zfs.nix
@@ -104,7 +104,7 @@ in
         readOnly = true;
         type = types.package;
         default = if config.boot.zfs.enableUnstable then pkgs.zfsUnstable else pkgs.zfs;
-        defaultText = "if config.boot.zfs.enableUnstable then pkgs.zfsUnstable else pkgs.zfs";
+        defaultText = literalExpression "if config.boot.zfs.enableUnstable then pkgs.zfsUnstable else pkgs.zfs";
         description = "Configured ZFS userland tools package.";
       };
 
@@ -150,7 +150,6 @@ in
       devNodes = mkOption {
         type = types.path;
         default = "/dev/disk/by-id";
-        example = "/dev/disk/by-id";
         description = ''
           Name of directory from which to import ZFS devices.
 
@@ -351,7 +350,7 @@ in
 
       settings = mkOption {
         type = with types; attrsOf (oneOf [ str int bool (listOf str) ]);
-        example = literalExample ''
+        example = literalExpression ''
           {
             ZED_DEBUG_LOG = "/tmp/zed.debug.log";
 
diff --git a/nixos/modules/tasks/lvm.nix b/nixos/modules/tasks/lvm.nix
index aaa76b49fa3..35316603c38 100644
--- a/nixos/modules/tasks/lvm.nix
+++ b/nixos/modules/tasks/lvm.nix
@@ -9,7 +9,7 @@ in {
       type = types.package;
       default = if cfg.dmeventd.enable then pkgs.lvm2_dmeventd else pkgs.lvm2;
       internal = true;
-      defaultText = "pkgs.lvm2";
+      defaultText = literalExpression "pkgs.lvm2";
       description = ''
         This option allows you to override the LVM package that's used on the system
         (udev rules, tmpfiles, systemd services).
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix
index 34a44b383a4..47626bf030a 100644
--- a/nixos/modules/tasks/network-interfaces.nix
+++ b/nixos/modules/tasks/network-interfaces.nix
@@ -146,7 +146,7 @@ let
       tempAddress = mkOption {
         type = types.enum (lib.attrNames tempaddrValues);
         default = cfg.tempAddresses;
-        defaultText = literalExample ''config.networking.tempAddresses'';
+        defaultText = literalExpression ''config.networking.tempAddresses'';
         description = ''
           When IPv6 is enabled with SLAAC, this option controls the use of
           temporary address (aka privacy extensions) on this
@@ -257,7 +257,7 @@ let
 
       virtualType = mkOption {
         default = if hasPrefix "tun" name then "tun" else "tap";
-        defaultText = literalExample ''if hasPrefix "tun" name then "tun" else "tap"'';
+        defaultText = literalExpression ''if hasPrefix "tun" name then "tun" else "tap"'';
         type = with types; enum [ "tun" "tap" ];
         description = ''
           The type of interface to create.
@@ -420,7 +420,7 @@ in
           The FQDN is required but cannot be determined. Please make sure that
           both networking.hostName and networking.domain are set properly.
         '';
-      defaultText = literalExample ''''${networking.hostName}.''${networking.domain}'';
+      defaultText = literalExpression ''"''${networking.hostName}.''${networking.domain}"'';
       description = ''
         The fully qualified domain name (FQDN) of this host. It is the result
         of combining networking.hostName and networking.domain. Using this
@@ -578,7 +578,6 @@ in
         options = {
 
           interfaces = mkOption {
-            example = [ "eth0" "eth1" ];
             description = "The physical network interfaces connected by the vSwitch.";
             type = with types; attrsOf (submodule vswitchInterfaceOpts);
           };
@@ -691,7 +690,7 @@ in
         '';
       in mkOption {
         default = { };
-        example = literalExample ''
+        example = literalExpression ''
           {
             bond0 = {
               interfaces = [ "eth0" "wlan0" ];
@@ -720,7 +719,7 @@ in
             driverOptions = mkOption {
               type = types.attrsOf types.str;
               default = {};
-              example = literalExample driverOptionsExample;
+              example = literalExpression driverOptionsExample;
               description = ''
                 Options for the bonding driver.
                 Documentation can be found in
@@ -784,7 +783,7 @@ in
 
     networking.macvlans = mkOption {
       default = { };
-      example = literalExample ''
+      example = literalExpression ''
         {
           wan = {
             interface = "enp2s0";
@@ -819,7 +818,7 @@ in
 
     networking.sits = mkOption {
       default = { };
-      example = literalExample ''
+      example = literalExpression ''
         {
           hurricane = {
             remote = "10.0.0.1";
@@ -883,7 +882,7 @@ in
 
     networking.vlans = mkOption {
       default = { };
-      example = literalExample ''
+      example = literalExpression ''
         {
           vlan0 = {
             id = 3;
@@ -927,7 +926,7 @@ in
 
     networking.wlanInterfaces = mkOption {
       default = { };
-      example = literalExample ''
+      example = literalExpression ''
         {
           wlan-station0 = {
               device = "wlp6s0";
diff --git a/nixos/modules/virtualisation/anbox.nix b/nixos/modules/virtualisation/anbox.nix
index 7b096bd1a9f..a4da62eb5f7 100644
--- a/nixos/modules/virtualisation/anbox.nix
+++ b/nixos/modules/virtualisation/anbox.nix
@@ -35,7 +35,7 @@ in
 
     image = mkOption {
       default = pkgs.anbox.image;
-      example = literalExample "pkgs.anbox.image";
+      defaultText = literalExpression "pkgs.anbox.image";
       type = types.package;
       description = ''
         Base android image for Anbox.
diff --git a/nixos/modules/virtualisation/containers.nix b/nixos/modules/virtualisation/containers.nix
index 84824e2f90f..cea3d51d3ae 100644
--- a/nixos/modules/virtualisation/containers.nix
+++ b/nixos/modules/virtualisation/containers.nix
@@ -2,7 +2,7 @@
 let
   cfg = config.virtualisation.containers;
 
-  inherit (lib) mkOption types;
+  inherit (lib) literalExpression mkOption types;
 
   toml = pkgs.formats.toml { };
 in
@@ -50,12 +50,12 @@ in
 
     containersConf.cniPlugins = mkOption {
       type = types.listOf types.package;
-      defaultText = ''
+      defaultText = literalExpression ''
         [
           pkgs.cni-plugins
         ]
       '';
-      example = lib.literalExample ''
+      example = literalExpression ''
         [
           pkgs.cniPlugins.dnsname
         ]
@@ -106,7 +106,7 @@ in
     policy = mkOption {
       default = {};
       type = types.attrs;
-      example = lib.literalExample ''
+      example = literalExpression ''
         {
           default = [ { type = "insecureAcceptAnything"; } ];
           transports = {
diff --git a/nixos/modules/virtualisation/cri-o.nix b/nixos/modules/virtualisation/cri-o.nix
index c135081959a..38766113f39 100644
--- a/nixos/modules/virtualisation/cri-o.nix
+++ b/nixos/modules/virtualisation/cri-o.nix
@@ -38,27 +38,27 @@ in
       type = types.nullOr types.str;
       default = null;
       description = "Override the default pause image for pod sandboxes";
-      example = [ "k8s.gcr.io/pause:3.2" ];
+      example = "k8s.gcr.io/pause:3.2";
     };
 
     pauseCommand = mkOption {
       type = types.nullOr types.str;
       default = null;
       description = "Override the default pause command";
-      example = [ "/pause" ];
+      example = "/pause";
     };
 
     runtime = mkOption {
       type = types.nullOr types.str;
       default = null;
       description = "Override the default runtime";
-      example = [ "crun" ];
+      example = "crun";
     };
 
     extraPackages = mkOption {
       type = with types; listOf package;
       default = [ ];
-      example = literalExample ''
+      example = literalExpression ''
         [
           pkgs.gvisor
         ]
diff --git a/nixos/modules/virtualisation/digital-ocean-init.nix b/nixos/modules/virtualisation/digital-ocean-init.nix
index 02f4de009fa..4339d91de16 100644
--- a/nixos/modules/virtualisation/digital-ocean-init.nix
+++ b/nixos/modules/virtualisation/digital-ocean-init.nix
@@ -20,7 +20,7 @@ in {
   options.virtualisation.digitalOcean.defaultConfigFile = mkOption {
     type = types.path;
     default = defaultConfigFile;
-    defaultText = ''
+    defaultText = literalDocBook ''
       The default configuration imports user-data if applicable and
       <literal>(modulesPath + "/virtualisation/digital-ocean-config.nix")</literal>.
     '';
diff --git a/nixos/modules/virtualisation/docker.nix b/nixos/modules/virtualisation/docker.nix
index 29f133786d8..06858e15030 100644
--- a/nixos/modules/virtualisation/docker.nix
+++ b/nixos/modules/virtualisation/docker.nix
@@ -138,8 +138,9 @@ in
 
     package = mkOption {
       default = pkgs.docker;
+      defaultText = literalExpression "pkgs.docker";
       type = types.package;
-      example = pkgs.docker-edge;
+      example = literalExpression "pkgs.docker-edge";
       description = ''
         Docker package to be used in the module.
       '';
diff --git a/nixos/modules/virtualisation/ecs-agent.nix b/nixos/modules/virtualisation/ecs-agent.nix
index 93fefe56d1a..aa38a02ea08 100644
--- a/nixos/modules/virtualisation/ecs-agent.nix
+++ b/nixos/modules/virtualisation/ecs-agent.nix
@@ -12,7 +12,7 @@ in {
       type = types.path;
       description = "The ECS agent package to use";
       default = pkgs.ecs-agent;
-      defaultText = "pkgs.ecs-agent";
+      defaultText = literalExpression "pkgs.ecs-agent";
     };
 
     extra-environment = mkOption {
diff --git a/nixos/modules/virtualisation/libvirtd.nix b/nixos/modules/virtualisation/libvirtd.nix
index 3c291397a99..77b43d9d843 100644
--- a/nixos/modules/virtualisation/libvirtd.nix
+++ b/nixos/modules/virtualisation/libvirtd.nix
@@ -50,7 +50,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.libvirt;
-      defaultText = "pkgs.libvirt";
+      defaultText = literalExpression "pkgs.libvirt";
       description = ''
         libvirt package to use.
       '';
@@ -59,6 +59,7 @@ in {
     qemuPackage = mkOption {
       type = types.package;
       default = pkgs.qemu;
+      defaultText = literalExpression "pkgs.qemu";
       description = ''
         Qemu package to use with libvirt.
         `pkgs.qemu` can emulate alien architectures (e.g. aarch64 on x86)
diff --git a/nixos/modules/virtualisation/lxd.nix b/nixos/modules/virtualisation/lxd.nix
index 6732e244369..94cd22d1371 100644
--- a/nixos/modules/virtualisation/lxd.nix
+++ b/nixos/modules/virtualisation/lxd.nix
@@ -35,7 +35,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.lxd.override { nftablesSupport = config.networking.nftables.enable; };
-        defaultText = "pkgs.lxd";
+        defaultText = literalExpression "pkgs.lxd";
         description = ''
           The LXD package to use.
         '';
@@ -44,7 +44,7 @@ in {
       lxcPackage = mkOption {
         type = types.package;
         default = pkgs.lxc;
-        defaultText = "pkgs.lxc";
+        defaultText = literalExpression "pkgs.lxc";
         description = ''
           The LXC package to use with LXD (required for AppArmor profiles).
         '';
@@ -53,7 +53,7 @@ in {
       zfsSupport = mkOption {
         type = types.bool;
         default = config.boot.zfs.enabled;
-        defaultText = "config.boot.zfs.enabled";
+        defaultText = literalExpression "config.boot.zfs.enabled";
         description = ''
           Enables lxd to use zfs as a storage for containers.
 
diff --git a/nixos/modules/virtualisation/nixos-containers.nix b/nixos/modules/virtualisation/nixos-containers.nix
index f3f318412df..279c9656735 100644
--- a/nixos/modules/virtualisation/nixos-containers.nix
+++ b/nixos/modules/virtualisation/nixos-containers.nix
@@ -530,7 +530,7 @@ in
             nixpkgs = mkOption {
               type = types.path;
               default = pkgs.path;
-              defaultText = "pkgs.path";
+              defaultText = literalExpression "pkgs.path";
               description = ''
                 A path to the nixpkgs that provide the modules, pkgs and lib for evaluating the container.
 
@@ -636,7 +636,7 @@ in
             bindMounts = mkOption {
               type = with types; attrsOf (submodule bindMountOpts);
               default = {};
-              example = literalExample ''
+              example = literalExpression ''
                 { "/home" = { hostPath = "/home/alice";
                               isReadOnly = false; };
                 }
@@ -707,7 +707,7 @@ in
         }));
 
       default = {};
-      example = literalExample
+      example = literalExpression
         ''
           { webserver =
               { path = "/nix/var/nix/profiles/webserver";
diff --git a/nixos/modules/virtualisation/oci-containers.nix b/nixos/modules/virtualisation/oci-containers.nix
index a4a92f22506..24573bba480 100644
--- a/nixos/modules/virtualisation/oci-containers.nix
+++ b/nixos/modules/virtualisation/oci-containers.nix
@@ -28,7 +28,7 @@ let
             You still need to set the <literal>image</literal> attribute, as it
             will be used as the image name for docker to start a container.
           '';
-          example = literalExample "pkgs.dockerTools.buildDockerImage {...};";
+          example = literalExpression "pkgs.dockerTools.buildDockerImage {...};";
         };
 
         login = {
@@ -59,7 +59,7 @@ let
           type =  with types; listOf str;
           default = [];
           description = "Commandline arguments to pass to the image's entrypoint.";
-          example = literalExample ''
+          example = literalExpression ''
             ["--port=9000"]
           '';
         };
@@ -75,7 +75,7 @@ let
           type = with types; attrsOf str;
           default = {};
           description = "Environment variables to set for this container.";
-          example = literalExample ''
+          example = literalExpression ''
             {
               DATABASE_HOST = "db.example.com";
               DATABASE_PORT = "3306";
@@ -87,7 +87,7 @@ let
           type = with types; listOf path;
           default = [];
           description = "Environment files for this container.";
-          example = literalExample ''
+          example = literalExpression ''
             [
               /path/to/.env
               /path/to/.env.secret
@@ -160,7 +160,7 @@ let
             <link xlink:href="https://docs.docker.com/engine/reference/run/#expose-incoming-ports">
             Docker engine documentation</link> for full details.
           '';
-          example = literalExample ''
+          example = literalExpression ''
             [
               "8080:9000"
             ]
@@ -191,7 +191,7 @@ let
             <link xlink:href="https://docs.docker.com/engine/reference/run/#volume-shared-filesystems">
             docker engine documentation</link> for details.
           '';
-          example = literalExample ''
+          example = literalExpression ''
             [
               "volume_name:/path/inside/container"
               "/path/on/host:/path/inside/container"
@@ -214,7 +214,7 @@ let
 
             Use the same name as the attribute under <literal>virtualisation.oci-containers.containers</literal>.
           '';
-          example = literalExample ''
+          example = literalExpression ''
             virtualisation.oci-containers.containers = {
               node1 = {};
               node2 = {
@@ -228,7 +228,7 @@ let
           type = with types; listOf str;
           default = [];
           description = "Extra options for <command>${defaultBackend} run</command>.";
-          example = literalExample ''
+          example = literalExpression ''
             ["--network=host"]
           '';
         };
diff --git a/nixos/modules/virtualisation/openvswitch.nix b/nixos/modules/virtualisation/openvswitch.nix
index ccf32641df6..325f6f5b43f 100644
--- a/nixos/modules/virtualisation/openvswitch.nix
+++ b/nixos/modules/virtualisation/openvswitch.nix
@@ -31,7 +31,7 @@ in {
     package = mkOption {
       type = types.package;
       default = pkgs.openvswitch;
-      defaultText = "pkgs.openvswitch";
+      defaultText = literalExpression "pkgs.openvswitch";
       description = ''
         Open vSwitch package to use.
       '';
diff --git a/nixos/modules/virtualisation/parallels-guest.nix b/nixos/modules/virtualisation/parallels-guest.nix
index 55605b388b7..d950cecff6f 100644
--- a/nixos/modules/virtualisation/parallels-guest.nix
+++ b/nixos/modules/virtualisation/parallels-guest.nix
@@ -34,8 +34,7 @@ in
       package = mkOption {
         type = types.nullOr types.package;
         default = config.boot.kernelPackages.prl-tools;
-        defaultText = "config.boot.kernelPackages.prl-tools";
-        example = literalExample "config.boot.kernelPackages.prl-tools";
+        defaultText = literalExpression "config.boot.kernelPackages.prl-tools";
         description = ''
           Defines which package to use for prl-tools. Override to change the version.
         '';
diff --git a/nixos/modules/virtualisation/podman.nix b/nixos/modules/virtualisation/podman.nix
index 893afee4c32..385475c84a1 100644
--- a/nixos/modules/virtualisation/podman.nix
+++ b/nixos/modules/virtualisation/podman.nix
@@ -95,7 +95,7 @@ in
     extraPackages = mkOption {
       type = with types; listOf package;
       default = [ ];
-      example = lib.literalExample ''
+      example = lib.literalExpression ''
         [
           pkgs.gvisor
         ]
diff --git a/nixos/modules/virtualisation/qemu-guest-agent.nix b/nixos/modules/virtualisation/qemu-guest-agent.nix
index 3824d0c168f..37a93a29976 100644
--- a/nixos/modules/virtualisation/qemu-guest-agent.nix
+++ b/nixos/modules/virtualisation/qemu-guest-agent.nix
@@ -15,6 +15,7 @@ in {
       package = mkOption {
         type = types.package;
         default = pkgs.qemu.ga;
+        defaultText = literalExpression "pkgs.qemu.ga";
         description = "The QEMU guest agent package.";
       };
   };
diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix
index 494c2c14284..69d67685f55 100644
--- a/nixos/modules/virtualisation/qemu-vm.nix
+++ b/nixos/modules/virtualisation/qemu-vm.nix
@@ -455,7 +455,7 @@ in
           };
         });
       default = [];
-      example = lib.literalExample
+      example = lib.literalExpression
         ''
         [ # forward local port 2222 -> 22, to ssh into the VM
           { from = "host"; host.port = 2222; guest.port = 22; }
diff --git a/nixos/modules/virtualisation/railcar.nix b/nixos/modules/virtualisation/railcar.nix
index b603effef6e..e719e25650d 100644
--- a/nixos/modules/virtualisation/railcar.nix
+++ b/nixos/modules/virtualisation/railcar.nix
@@ -41,7 +41,7 @@ let
         description = "Source for the in-container mount";
       };
       options = mkOption {
-        type = attrsOf (str);
+        type = listOf str;
         default = [ "bind" ];
         description = ''
           Mount options of the filesystem to be used.
@@ -77,9 +77,7 @@ in
               The defaults have been chosen for simple bindmounts, meaning
               that you only need to provide the "source" parameter.
             '';
-            example = ''
-              { "/data" = { source = "/var/lib/data"; }; }
-            '';
+            example = { "/data" = { source = "/var/lib/data"; }; };
           };
 
           runType = mkOption {
@@ -112,6 +110,7 @@ in
     package = mkOption {
       type = types.package;
       default = pkgs.railcar;
+      defaultText = literalExpression "pkgs.railcar";
       description = "Railcar package to use";
     };
   };
diff --git a/nixos/modules/virtualisation/virtualbox-host.nix b/nixos/modules/virtualisation/virtualbox-host.nix
index ddb0a7bda4f..6c742ad371c 100644
--- a/nixos/modules/virtualisation/virtualbox-host.nix
+++ b/nixos/modules/virtualisation/virtualbox-host.nix
@@ -43,7 +43,7 @@ in
     package = mkOption {
       type = types.package;
       default = pkgs.virtualbox;
-      defaultText = "pkgs.virtualbox";
+      defaultText = literalExpression "pkgs.virtualbox";
       description = ''
         Which VirtualBox package to use.
       '';
diff --git a/nixos/modules/virtualisation/xen-dom0.nix b/nixos/modules/virtualisation/xen-dom0.nix
index fea43727f2f..f8f4af4f6b8 100644
--- a/nixos/modules/virtualisation/xen-dom0.nix
+++ b/nixos/modules/virtualisation/xen-dom0.nix
@@ -35,8 +35,8 @@ in
 
     virtualisation.xen.package = mkOption {
       type = types.package;
-      defaultText = "pkgs.xen";
-      example = literalExample "pkgs.xen-light";
+      defaultText = literalExpression "pkgs.xen";
+      example = literalExpression "pkgs.xen-light";
       description = ''
         The package used for Xen binary.
       '';
@@ -45,8 +45,8 @@ in
 
     virtualisation.xen.package-qemu = mkOption {
       type = types.package;
-      defaultText = "pkgs.xen";
-      example = literalExample "pkgs.qemu_xen-light";
+      defaultText = literalExpression "pkgs.xen";
+      example = literalExpression "pkgs.qemu_xen-light";
       description = ''
         The package with qemu binaries for dom0 qemu and xendomains.
       '';