Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 482b39a7e5ac
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c496b1b10245
Choose a head ref
  • 4 commits
  • 177 files changed
  • 2 contributors

Commits on Jan 6, 2020

  1. Copy the full SHA
    1d61efb View commit details
  2. Copy the full SHA
    cde4649 View commit details
  3. Copy the full SHA
    0330989 View commit details
  4. Merge pull request #63103 from rnhmjoj/loaof

    Deprecate types.loaOf [WIP]
    worldofpeace authored Jan 6, 2020
    Copy the full SHA
    c496b1b View commit details
Showing with 905 additions and 1,127 deletions.
  1. +25 −31 lib/tests/modules.sh
  2. +2 −2 lib/tests/modules/{declare-loaOfSub-any-enable.nix → declare-attrsOfSub-any-enable.nix}
  3. +3 −0 lib/tests/modules/define-attrsOfSub-bar-enable.nix
  4. +3 −0 lib/tests/modules/define-attrsOfSub-bar.nix
  5. +5 −0 lib/tests/modules/define-attrsOfSub-foo-enable-force.nix
  6. +5 −0 lib/tests/modules/define-attrsOfSub-foo-enable-if.nix
  7. +3 −0 lib/tests/modules/define-attrsOfSub-foo-enable.nix
  8. +1 −1 lib/tests/modules/{define-loaOfSub-foo-force-enable.nix → define-attrsOfSub-foo-force-enable.nix}
  9. +1 −1 lib/tests/modules/{define-loaOfSub-foo-if-enable.nix → define-attrsOfSub-foo-if-enable.nix}
  10. +3 −0 lib/tests/modules/define-attrsOfSub-foo.nix
  11. +1 −1 lib/tests/modules/{define-loaOfSub-force-foo-enable.nix → define-attrsOfSub-force-foo-enable.nix}
  12. +1 −1 lib/tests/modules/{define-loaOfSub-if-foo-enable.nix → define-attrsOfSub-if-foo-enable.nix}
  13. +5 −0 lib/tests/modules/define-force-attrsOfSub-foo-enable.nix
  14. +0 −5 lib/tests/modules/define-force-loaOfSub-foo-enable.nix
  15. +1 −1 lib/tests/modules/{define-if-loaOfSub-foo-enable.nix → define-if-attrsOfSub-foo-enable.nix}
  16. +0 −3 lib/tests/modules/define-loaOfSub-bar-enable.nix
  17. +0 −3 lib/tests/modules/define-loaOfSub-bar.nix
  18. +0 −5 lib/tests/modules/define-loaOfSub-foo-enable-force.nix
  19. +0 −5 lib/tests/modules/define-loaOfSub-foo-enable-if.nix
  20. +0 −3 lib/tests/modules/define-loaOfSub-foo-enable.nix
  21. +0 −3 lib/tests/modules/define-loaOfSub-foo.nix
  22. +0 −19 lib/tests/modules/loaOf-with-long-list.nix
  23. +0 −19 lib/tests/modules/loaOf-with-many-list-merges.nix
  24. +29 −12 lib/types.nix
  25. +5 −8 nixos/modules/config/i18n.nix
  26. +3 −1 nixos/modules/config/ldap.nix
  27. +11 −16 nixos/modules/config/pulseaudio.nix
  28. +2 −3 nixos/modules/installer/cd-dvd/system-tarball-pc.nix
  29. +2 −3 nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix
  30. +1 −1 nixos/modules/installer/cd-dvd/system-tarball.nix
  31. +6 −3 nixos/modules/programs/dconf.nix
  32. +12 −16 nixos/modules/programs/shadow.nix
  33. +15 −13 nixos/modules/security/duosec.nix
  34. +4 −5 nixos/modules/security/pam.nix
  35. +2 −3 nixos/modules/security/pam_mount.nix
  36. +2 −3 nixos/modules/security/rtkit.nix
  37. +1 −2 nixos/modules/security/sudo.nix
  38. +13 −13 nixos/modules/services/audio/mpd.nix
  39. +4 −3 nixos/modules/services/backup/mysql-backup.nix
  40. +1 −2 nixos/modules/services/cluster/kubernetes/default.nix
  41. +11 −10 nixos/modules/services/continuous-integration/buildbot/master.nix
  42. +11 −10 nixos/modules/services/continuous-integration/buildbot/worker.nix
  43. +12 −12 nixos/modules/services/continuous-integration/gocd-agent/default.nix
  44. +12 −12 nixos/modules/services/continuous-integration/gocd-server/default.nix
  45. +12 −12 nixos/modules/services/continuous-integration/jenkins/default.nix
  46. +10 −10 nixos/modules/services/continuous-integration/jenkins/slave.nix
  47. +7 −7 nixos/modules/services/databases/cockroachdb.nix
  48. +7 −7 nixos/modules/services/databases/foundationdb.nix
  49. +7 −7 nixos/modules/services/databases/influxdb.nix
  50. +3 −4 nixos/modules/services/databases/memcached.nix
  51. +1 −2 nixos/modules/services/databases/neo4j.nix
  52. +2 −3 nixos/modules/services/databases/virtuoso.nix
  53. +8 −7 nixos/modules/services/editors/infinoted.nix
  54. +3 −3 nixos/modules/services/hardware/bluetooth.nix
  55. +4 −7 nixos/modules/services/hardware/sane_extra_backends/brscan4.nix
  56. +7 −7 nixos/modules/services/hardware/tcsd.nix
  57. +8 −7 nixos/modules/services/hardware/tlp.nix
  58. +4 −7 nixos/modules/services/hardware/udev.nix
  59. +7 −6 nixos/modules/services/hardware/usbmuxd.nix
  60. +4 −3 nixos/modules/services/logging/logcheck.nix
  61. +24 −28 nixos/modules/services/mail/dovecot.nix
  62. +7 −7 nixos/modules/services/mail/dspam.nix
  63. +2 −4 nixos/modules/services/mail/exim.nix
  64. +2 −4 nixos/modules/services/mail/mlmmj.nix
  65. +2 −5 nixos/modules/services/mail/nullmailer.nix
  66. +7 −7 nixos/modules/services/mail/opendkim.nix
  67. +10 −11 nixos/modules/services/mail/postfix.nix
  68. +7 −7 nixos/modules/services/mail/postsrsd.nix
  69. +2 −4 nixos/modules/services/mail/rspamd.nix
  70. +2 −4 nixos/modules/services/mail/spamassassin.nix
  71. +1 −2 nixos/modules/services/misc/apache-kafka.nix
  72. +7 −11 nixos/modules/services/misc/bepasty.nix
  73. +4 −3 nixos/modules/services/misc/cgminer.nix
  74. +4 −7 nixos/modules/services/misc/couchpotato.nix
  75. +3 −7 nixos/modules/services/misc/dictd.nix
  76. +1 −2 nixos/modules/services/misc/etcd.nix
  77. +1 −2 nixos/modules/services/misc/exhibitor.nix
  78. +3 −7 nixos/modules/services/misc/felix.nix
  79. +2 −3 nixos/modules/services/misc/folding-at-home.nix
  80. +4 −10 nixos/modules/services/misc/gitlab.nix
  81. +3 −7 nixos/modules/services/misc/gpsd.nix
  82. +12 −12 nixos/modules/services/misc/headphones.nix
  83. +6 −7 nixos/modules/services/misc/matrix-synapse.nix
  84. +12 −12 nixos/modules/services/misc/mediatomb.nix
  85. +6 −4 nixos/modules/services/misc/nix-daemon.nix
  86. +7 −7 nixos/modules/services/misc/octoprint.nix
  87. +7 −7 nixos/modules/services/misc/redmine.nix
  88. +2 −3 nixos/modules/services/misc/ripple-data-api.nix
  89. +2 −3 nixos/modules/services/misc/rippled.nix
  90. +4 −9 nixos/modules/services/misc/serviio.nix
  91. +12 −12 nixos/modules/services/misc/sickbeard.nix
  92. +1 −2 nixos/modules/services/misc/siproxd.nix
  93. +8 −8 nixos/modules/services/misc/taskserver/default.nix
  94. +9 −15 nixos/modules/services/misc/uhub.nix
  95. +1 −2 nixos/modules/services/misc/zookeeper.nix
  96. +4 −3 nixos/modules/services/monitoring/collectd.nix
  97. +11 −10 nixos/modules/services/monitoring/datadog-agent.nix
  98. +29 −31 nixos/modules/services/monitoring/dd-agent/dd-agent.nix
  99. +1 −2 nixos/modules/services/monitoring/fusion-inventory.nix
  100. +1 −2 nixos/modules/services/monitoring/graphite.nix
  101. +1 −2 nixos/modules/services/monitoring/heapster.nix
  102. +4 −6 nixos/modules/services/monitoring/munin.nix
  103. +1 −5 nixos/modules/services/monitoring/nagios.nix
  104. +6 −5 nixos/modules/services/monitoring/netdata.nix
  105. +1 −2 nixos/modules/services/monitoring/statsd.nix
  106. +2 −3 nixos/modules/services/monitoring/telegraf.nix
  107. +14 −31 nixos/modules/services/monitoring/ups.nix
  108. +3 −4 nixos/modules/services/network-filesystems/ceph.nix
  109. +12 −11 nixos/modules/services/network-filesystems/davfs2.nix
  110. +2 −4 nixos/modules/services/network-filesystems/drbd.nix
  111. +2 −3 nixos/modules/services/networking/bind.nix
  112. +1 −2 nixos/modules/services/networking/bitlbee.nix
  113. +2 −4 nixos/modules/services/networking/charybdis.nix
  114. +6 −8 nixos/modules/services/networking/coturn.nix
  115. +1 −5 nixos/modules/services/networking/dhcpcd.nix
  116. +1 −2 nixos/modules/services/networking/dnschain.nix
  117. +1 −2 nixos/modules/services/networking/dnsmasq.nix
  118. +7 −7 nixos/modules/services/networking/ejabberd.nix
  119. +2 −3 nixos/modules/services/networking/gale.nix
  120. +6 −6 nixos/modules/services/networking/git-daemon.nix
  121. +1 −2 nixos/modules/services/networking/hans.nix
  122. +9 −9 nixos/modules/services/networking/i2pd.nix
  123. +1 −2 nixos/modules/services/networking/iodine.nix
  124. +2 −3 nixos/modules/services/networking/ircd-hybrid/default.nix
  125. +2 −3 nixos/modules/services/networking/kippo.nix
  126. +3 −7 nixos/modules/services/networking/kresd.nix
  127. +7 −6 nixos/modules/services/networking/matterbridge.nix
  128. +5 −4 nixos/modules/services/networking/mjpg-streamer.nix
  129. +3 −5 nixos/modules/services/networking/monero.nix
  130. +5 −8 nixos/modules/services/networking/mxisd.nix
  131. +2 −4 nixos/modules/services/networking/namecoind.nix
  132. +49 −52 nixos/modules/services/networking/networkmanager.nix
  133. +2 −3 nixos/modules/services/networking/nntp-proxy.nix
  134. +2 −6 nixos/modules/services/networking/nsd.nix
  135. +3 −7 nixos/modules/services/networking/ntp/chrony.nix
  136. +2 −3 nixos/modules/services/networking/ntp/ntpd.nix
  137. +1 −2 nixos/modules/services/networking/ntp/openntpd.nix
  138. +2 −5 nixos/modules/services/networking/owamp.nix
  139. +2 −4 nixos/modules/services/networking/pdnsd.nix
  140. +4 −6 nixos/modules/services/networking/polipo.nix
  141. +6 −4 nixos/modules/services/networking/pppd.nix
  142. +4 −7 nixos/modules/services/networking/prayer.nix
  143. +4 −7 nixos/modules/services/networking/radicale.nix
  144. +2 −3 nixos/modules/services/networking/shairport-sync.nix
  145. +1 −2 nixos/modules/services/networking/shout.nix
  146. +1 −2 nixos/modules/services/networking/smokeping.nix
  147. +1 −3 nixos/modules/services/networking/supybot.nix
  148. +1 −2 nixos/modules/services/networking/tcpcrypt.nix
  149. +2 −3 nixos/modules/services/networking/tox-bootstrapd.nix
  150. +11 −10 nixos/modules/services/networking/vsftpd.nix
  151. +14 −12 nixos/modules/services/networking/znc/default.nix
  152. +2 −3 nixos/modules/services/printing/cupsd.nix
  153. +3 −7 nixos/modules/services/scheduling/atd.nix
  154. +3 −2 nixos/modules/services/scheduling/fcron.nix
  155. +11 −11 nixos/modules/services/search/hound.nix
  156. +1 −2 nixos/modules/services/search/kibana.nix
  157. +7 −7 nixos/modules/services/search/solr.nix
  158. +3 −6 nixos/modules/services/security/clamav.nix
  159. +5 −9 nixos/modules/services/security/fprot.nix
  160. +4 −5 nixos/modules/services/security/torsocks.nix
  161. +1 −4 nixos/modules/services/system/dbus.nix
  162. +4 −0 nixos/modules/services/system/localtime.nix
  163. +1 −2 nixos/modules/services/ttys/agetty.nix
  164. +4 −6 nixos/modules/services/web-apps/frab.nix
  165. +11 −11 nixos/modules/services/web-apps/mattermost.nix
  166. +7 −7 nixos/modules/services/web-servers/apache-httpd/default.nix
  167. +8 −7 nixos/modules/services/web-servers/nginx/default.nix
  168. +3 −7 nixos/modules/services/web-servers/tomcat.nix
  169. +7 −7 nixos/modules/services/web-servers/unit/default.nix
  170. +7 −7 nixos/modules/services/web-servers/uwsgi.nix
  171. +1 −4 nixos/modules/services/x11/desktop-managers/enlightenment.nix
  172. +1 −4 nixos/modules/services/x11/desktop-managers/plasma5.nix
  173. +7 −6 nixos/modules/services/x11/hardware/libinput.nix
  174. +11 −19 nixos/modules/services/x11/xserver.nix
  175. +2 −3 nixos/modules/system/boot/kernel.nix
  176. +5 −5 nixos/modules/system/boot/networkd.nix
  177. +12 −19 nixos/modules/virtualisation/xen-dom0.nix
56 changes: 25 additions & 31 deletions lib/tests/modules.sh
Original file line number Diff line number Diff line change
@@ -87,36 +87,36 @@ checkConfigOutput "false" "$@" ./define-force-enable.nix
checkConfigOutput "false" "$@" ./define-enable-force.nix

# Check mkForce with option and submodules.
checkConfigError 'attribute .*foo.* .* not found' config.loaOfSub.foo.enable ./declare-loaOfSub-any-enable.nix
checkConfigOutput 'false' config.loaOfSub.foo.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix
set -- config.loaOfSub.foo.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo-enable.nix
checkConfigError 'attribute .*foo.* .* not found' config.attrsOfSub.foo.enable ./declare-attrsOfSub-any-enable.nix
checkConfigOutput 'false' config.attrsOfSub.foo.enable ./declare-attrsOfSub-any-enable.nix ./define-attrsOfSub-foo.nix
set -- config.attrsOfSub.foo.enable ./declare-attrsOfSub-any-enable.nix ./define-attrsOfSub-foo-enable.nix
checkConfigOutput 'true' "$@"
checkConfigOutput 'false' "$@" ./define-force-loaOfSub-foo-enable.nix
checkConfigOutput 'false' "$@" ./define-loaOfSub-force-foo-enable.nix
checkConfigOutput 'false' "$@" ./define-loaOfSub-foo-force-enable.nix
checkConfigOutput 'false' "$@" ./define-loaOfSub-foo-enable-force.nix
checkConfigOutput 'false' "$@" ./define-force-attrsOfSub-foo-enable.nix
checkConfigOutput 'false' "$@" ./define-attrsOfSub-force-foo-enable.nix
checkConfigOutput 'false' "$@" ./define-attrsOfSub-foo-force-enable.nix
checkConfigOutput 'false' "$@" ./define-attrsOfSub-foo-enable-force.nix

# Check overriding effect of mkForce on submodule definitions.
checkConfigError 'attribute .*bar.* .* not found' config.loaOfSub.bar.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix
checkConfigOutput 'false' config.loaOfSub.bar.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix ./define-loaOfSub-bar.nix
set -- config.loaOfSub.bar.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix ./define-loaOfSub-bar-enable.nix
checkConfigError 'attribute .*bar.* .* not found' config.attrsOfSub.bar.enable ./declare-attrsOfSub-any-enable.nix ./define-attrsOfSub-foo.nix
checkConfigOutput 'false' config.attrsOfSub.bar.enable ./declare-attrsOfSub-any-enable.nix ./define-attrsOfSub-foo.nix ./define-attrsOfSub-bar.nix
set -- config.attrsOfSub.bar.enable ./declare-attrsOfSub-any-enable.nix ./define-attrsOfSub-foo.nix ./define-attrsOfSub-bar-enable.nix
checkConfigOutput 'true' "$@"
checkConfigError 'attribute .*bar.* .* not found' "$@" ./define-force-loaOfSub-foo-enable.nix
checkConfigError 'attribute .*bar.* .* not found' "$@" ./define-loaOfSub-force-foo-enable.nix
checkConfigOutput 'true' "$@" ./define-loaOfSub-foo-force-enable.nix
checkConfigOutput 'true' "$@" ./define-loaOfSub-foo-enable-force.nix
checkConfigError 'attribute .*bar.* .* not found' "$@" ./define-force-attrsOfSub-foo-enable.nix
checkConfigError 'attribute .*bar.* .* not found' "$@" ./define-attrsOfSub-force-foo-enable.nix
checkConfigOutput 'true' "$@" ./define-attrsOfSub-foo-force-enable.nix
checkConfigOutput 'true' "$@" ./define-attrsOfSub-foo-enable-force.nix

# Check mkIf with submodules.
checkConfigError 'attribute .*foo.* .* not found' config.loaOfSub.foo.enable ./declare-enable.nix ./declare-loaOfSub-any-enable.nix
set -- config.loaOfSub.foo.enable ./declare-enable.nix ./declare-loaOfSub-any-enable.nix
checkConfigError 'attribute .*foo.* .* not found' "$@" ./define-if-loaOfSub-foo-enable.nix
checkConfigError 'attribute .*foo.* .* not found' "$@" ./define-loaOfSub-if-foo-enable.nix
checkConfigError 'attribute .*foo.* .* not found' "$@" ./define-loaOfSub-foo-if-enable.nix
checkConfigOutput 'false' "$@" ./define-loaOfSub-foo-enable-if.nix
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-if-loaOfSub-foo-enable.nix
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-loaOfSub-if-foo-enable.nix
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-loaOfSub-foo-if-enable.nix
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-loaOfSub-foo-enable-if.nix
checkConfigError 'attribute .*foo.* .* not found' config.attrsOfSub.foo.enable ./declare-enable.nix ./declare-attrsOfSub-any-enable.nix
set -- config.attrsOfSub.foo.enable ./declare-enable.nix ./declare-attrsOfSub-any-enable.nix
checkConfigError 'attribute .*foo.* .* not found' "$@" ./define-if-attrsOfSub-foo-enable.nix
checkConfigError 'attribute .*foo.* .* not found' "$@" ./define-attrsOfSub-if-foo-enable.nix
checkConfigError 'attribute .*foo.* .* not found' "$@" ./define-attrsOfSub-foo-if-enable.nix
checkConfigOutput 'false' "$@" ./define-attrsOfSub-foo-enable-if.nix
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-if-attrsOfSub-foo-enable.nix
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-attrsOfSub-if-foo-enable.nix
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-attrsOfSub-foo-if-enable.nix
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-attrsOfSub-foo-enable-if.nix

# Check disabledModules with config definitions and option declarations.
set -- config.enable ./define-enable.nix ./declare-enable.nix
@@ -138,7 +138,7 @@ checkConfigError 'while evaluating the module argument .*custom.* in .*import-cu
checkConfigError 'infinite recursion encountered' "$@"

# Check _module.check.
set -- config.enable ./declare-enable.nix ./define-enable.nix ./define-loaOfSub-foo.nix
set -- config.enable ./declare-enable.nix ./define-enable.nix ./define-attrsOfSub-foo.nix
checkConfigError 'The option .* defined in .* does not exist.' "$@"
checkConfigOutput "true" "$@" ./define-module-check.nix

@@ -152,12 +152,6 @@ checkConfigOutput "12" config.value ./declare-coerced-value-unsound.nix
checkConfigError 'The option value .* in .* is not.*8 bit signed integer.* or string convertible to it' config.value ./declare-coerced-value-unsound.nix ./define-value-string-bigint.nix
checkConfigError 'unrecognised JSON value' config.value ./declare-coerced-value-unsound.nix ./define-value-string-arbitrary.nix

# Check loaOf with long list.
checkConfigOutput "1 2 3 4 5 6 7 8 9 10" config.result ./loaOf-with-long-list.nix

# Check loaOf with many merges of lists.
checkConfigOutput "1 2 3 4 5 6 7 8 9 10" config.result ./loaOf-with-many-list-merges.nix

# Check mkAliasOptionModule.
checkConfigOutput "true" config.enable ./alias-with-priority.nix
checkConfigOutput "true" config.enableAlias ./alias-with-priority.nix
Original file line number Diff line number Diff line change
@@ -17,10 +17,10 @@ in

{
options = {
loaOfSub = lib.mkOption {
attrsOfSub = lib.mkOption {
default = {};
example = {};
type = lib.types.loaOf (lib.types.submodule [ submod ]);
type = lib.types.attrsOf (lib.types.submodule [ submod ]);
description = ''
Some descriptive text
'';
3 changes: 3 additions & 0 deletions lib/tests/modules/define-attrsOfSub-bar-enable.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
attrsOfSub.bar.enable = true;
}
3 changes: 3 additions & 0 deletions lib/tests/modules/define-attrsOfSub-bar.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
attrsOfSub.bar = {};
}
5 changes: 5 additions & 0 deletions lib/tests/modules/define-attrsOfSub-foo-enable-force.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{ lib, ... }:

{
attrsOfSub.foo.enable = lib.mkForce false;
}
5 changes: 5 additions & 0 deletions lib/tests/modules/define-attrsOfSub-foo-enable-if.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{ config, lib, ... }:

{
attrsOfSub.foo.enable = lib.mkIf config.enable true;
}
3 changes: 3 additions & 0 deletions lib/tests/modules/define-attrsOfSub-foo-enable.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
attrsOfSub.foo.enable = true;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ lib, ... }:

{
loaOfSub.foo = lib.mkForce {
attrsOfSub.foo = lib.mkForce {
enable = false;
};
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ config, lib, ... }:

{
loaOfSub.foo = lib.mkIf config.enable {
attrsOfSub.foo = lib.mkIf config.enable {
enable = true;
};
}
3 changes: 3 additions & 0 deletions lib/tests/modules/define-attrsOfSub-foo.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
attrsOfSub.foo = {};
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ lib, ... }:

{
loaOfSub = lib.mkForce {
attrsOfSub = lib.mkForce {
foo.enable = false;
};
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ config, lib, ... }:

{
loaOfSub = lib.mkIf config.enable {
attrsOfSub = lib.mkIf config.enable {
foo.enable = true;
};
}
5 changes: 5 additions & 0 deletions lib/tests/modules/define-force-attrsOfSub-foo-enable.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{ lib, ... }:

lib.mkForce {
attrsOfSub.foo.enable = false;
}
5 changes: 0 additions & 5 deletions lib/tests/modules/define-force-loaOfSub-foo-enable.nix

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ config, lib, ... }:

lib.mkIf config.enable {
loaOfSub.foo.enable = true;
attrsOfSub.foo.enable = true;
}
3 changes: 0 additions & 3 deletions lib/tests/modules/define-loaOfSub-bar-enable.nix

This file was deleted.

3 changes: 0 additions & 3 deletions lib/tests/modules/define-loaOfSub-bar.nix

This file was deleted.

5 changes: 0 additions & 5 deletions lib/tests/modules/define-loaOfSub-foo-enable-force.nix

This file was deleted.

5 changes: 0 additions & 5 deletions lib/tests/modules/define-loaOfSub-foo-enable-if.nix

This file was deleted.

3 changes: 0 additions & 3 deletions lib/tests/modules/define-loaOfSub-foo-enable.nix

This file was deleted.

3 changes: 0 additions & 3 deletions lib/tests/modules/define-loaOfSub-foo.nix

This file was deleted.

19 changes: 0 additions & 19 deletions lib/tests/modules/loaOf-with-long-list.nix

This file was deleted.

19 changes: 0 additions & 19 deletions lib/tests/modules/loaOf-with-many-list-merges.nix

This file was deleted.

41 changes: 29 additions & 12 deletions lib/types.nix
Original file line number Diff line number Diff line change
@@ -295,34 +295,51 @@ rec {
# List or attribute set of ...
loaOf = elemType:
let
convertAllLists = defs:
convertAllLists = loc: defs:
let
padWidth = stringLength (toString (length defs));
unnamedPrefix = i: "unnamed-" + fixedWidthNumber padWidth i + ".";
in
imap1 (i: convertIfList (unnamedPrefix i)) defs;

convertIfList = unnamedPrefix: def:
imap1 (i: convertIfList loc (unnamedPrefix i)) defs;
convertIfList = loc: unnamedPrefix: def:
if isList def.value then
let
padWidth = stringLength (toString (length def.value));
unnamed = i: unnamedPrefix + fixedWidthNumber padWidth i;
res =
{ inherit (def) file;
value = listToAttrs (
imap1 (elemIdx: elem:
{ name = elem.name or (unnamed elemIdx);
value = elem;
}) def.value);
};
option = concatStringsSep "." loc;
sample = take 3 def.value;
list = concatMapStrings (x: ''{ name = "${x.name or "unnamed"}"; ...} '') sample;
set = concatMapStrings (x: ''${x.name or "unnamed"} = {...}; '') sample;
msg = ''
In file ${def.file}
a list is being assigned to the option config.${option}.
This will soon be an error as type loaOf is deprecated.
See https://git.io/fj2zm for more information.
Do
${option} =
{ ${set}...}
instead of
${option} =
[ ${list}...]
'';
in
{ inherit (def) file;
value = listToAttrs (
imap1 (elemIdx: elem:
{ name = elem.name or (unnamed elemIdx);
value = elem;
}) def.value);
}
lib.warn msg res
else
def;
attrOnly = attrsOf elemType;
in mkOptionType rec {
name = "loaOf";
description = "list or attribute set of ${elemType.description}s";
check = x: isList x || isAttrs x;
merge = loc: defs: attrOnly.merge loc (convertAllLists defs);
merge = loc: defs: attrOnly.merge loc (convertAllLists loc defs);
getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["<name?>"]);
getSubModules = elemType.getSubModules;
substSubModules = m: loaOf (elemType.substSubModules m);
13 changes: 5 additions & 8 deletions nixos/modules/config/i18n.nix
Original file line number Diff line number Diff line change
@@ -80,14 +80,11 @@ with lib;
};

# ‘/etc/locale.conf’ is used by systemd.
environment.etc = singleton
{ target = "locale.conf";
source = pkgs.writeText "locale.conf"
''
LANG=${config.i18n.defaultLocale}
${concatStringsSep "\n" (mapAttrsToList (n: v: ''${n}=${v}'') config.i18n.extraLocaleSettings)}
'';
};
environment.etc."locale.conf".source = pkgs.writeText "locale.conf"
''
LANG=${config.i18n.defaultLocale}
${concatStringsSep "\n" (mapAttrsToList (n: v: ''${n}=${v}'') config.i18n.extraLocaleSettings)}
'';

};
}
4 changes: 3 additions & 1 deletion nixos/modules/config/ldap.nix
Original file line number Diff line number Diff line change
@@ -224,7 +224,9 @@ in

config = mkIf cfg.enable {

environment.etc = optional (!cfg.daemon.enable) ldapConfig;
environment.etc = optionalAttrs (!cfg.daemon.enable) {
"ldap.conf" = ldapConfig;
};

system.activationScripts = mkIf (!cfg.daemon.enable) {
ldap = stringAfter [ "etc" "groups" "users" ] ''
27 changes: 11 additions & 16 deletions nixos/modules/config/pulseaudio.nix
Original file line number Diff line number Diff line change
@@ -215,9 +215,8 @@ in {

config = mkMerge [
{
environment.etc = singleton {
target = "pulse/client.conf";
source = clientConf;
environment.etc = {
"pulse/client.conf".source = clientConf;
};

hardware.pulseaudio.configFile = mkDefault "${getBin overriddenPackage}/etc/pulse/default.pa";
@@ -228,19 +227,16 @@ in {

sound.enable = true;

environment.etc = [
{ target = "asound.conf";
source = alsaConf; }
environment.etc = {
"asound.conf".source = alsaConf;

{ target = "pulse/daemon.conf";
source = writeText "daemon.conf" (lib.generators.toKeyValue {} cfg.daemon.config); }
"pulse/daemon.conf".source = writeText "daemon.conf"
(lib.generators.toKeyValue {} cfg.daemon.config);

{ target = "openal/alsoft.conf";
source = writeText "alsoft.conf" "drivers=pulse"; }
"openal/alsoft.conf".source = writeText "alsoft.conf" "drivers=pulse";

{ target = "libao.conf";
source = writeText "libao.conf" "default_driver=pulse"; }
];
"libao.conf".source = writeText "libao.conf" "default_driver=pulse";
};

# Disable flat volumes to enable relative ones
hardware.pulseaudio.daemon.config.flat-volumes = mkDefault "no";
@@ -275,9 +271,8 @@ in {
})

(mkIf nonSystemWide {
environment.etc = singleton {
target = "pulse/default.pa";
source = myConfigFile;
environment.etc = {
"pulse/default.pa".source = myConfigFile;
};
systemd.user = {
services.pulseaudio = {
Loading