nixpkgs/nixos/modules
aszlig ce87773867
nixos/dhparams: Clean up module expression
First of all let's start with a clean up the multiline string
indentation for descriptions, because having two indentation levels
after description is a waste of screen estate.

A quick survey in the form of the following also reveals that the
majority of multiline strings in nixpkgs is starting the two beginning
quotes in the same line:

$ find -name '*.nix' -exec sed -n -e '/=$/ { n; /'\'\''/p }' {} + | wc -l
817
$ find -name '*.nix' -exec grep "= *'' *\$" {} + | wc -l
14818

The next point is to get the type, default and example attributes on top
of the description because that's the way it's rendered in the manual.

Most services have their enable option close to the beginning of the
file, so let's move it to the top.

Also, I found the script attribute for dhparams-init.service a bit hard
to read as it was using string concatenation to split a "for" loop.

Now for the more substantial clean ups rather than just code style:

  * Remove the "with lib;" at the beginning of the module, because it
    makes it easier to do a quick check with "nix-instantiate --parse".
  * Use ConditionPathExists instead of test -e for checking whether we
    need to generate the dhparams file. This avoids spawning a shell if
    the file exists already and it's probably more common that it will
    exist, except for the initial creation of course.
  * When cleaning up old dhparams file, use RemainAfterExit so that the
    unit won't be triggered again whenever we stop and start a service
    depending on it.
  * Capitalize systemd unit descriptions to be more in par with most
    other unit descriptions (also see 0c5e837b66).
  * Use "=" instead of "==" for conditionals using []. It's just a very
    small nitpick though and it will only fail for POSIX shells. Bash on
    the other side accepts it anyway.

Signed-off-by: aszlig <aszlig@nix.build>
Cc: @Ekleog
2018-04-26 08:04:52 +02:00
..
config treewide: isArm -> isAarch32 2018-04-25 15:28:55 -04:00
hardware Merge branch 'master' into staging 2018-04-10 09:13:36 +02:00
i18n/input-method Remove top-level kde5 attribute 2017-02-27 11:49:10 -06:00
installer Merge pull request #39342 from samueldr/fix/nixos-enter-efivarfs 2018-04-23 21:42:12 +00:00
misc nixos: documentation: implement documentation.dev.enable option 2018-04-23 15:08:58 +02:00
profiles Merge pull request #38114 from oxij/nixos/doc-module 2018-04-05 07:09:32 +00:00
programs nixos: enable bash command completion by default 2018-04-13 18:36:51 +02:00
security nixos/dhparams: Clean up module expression 2018-04-26 08:04:52 +02:00
services gitlab module: update to gitlab 10.7 2018-04-26 00:15:24 +02:00
system raspberrypi-bootloader: Adds firmwareConfig config option 2018-04-22 18:27:17 +03:00
tasks lxd: 2.16 -> 3.0.0 2018-04-14 11:02:24 +01:00
testing nixos/qemu: Deduplicate QEMU serialDevice into qemu-flags.nix 2018-01-30 16:57:27 +02:00
virtualisation treewide: isArm -> isAarch32 2018-04-25 15:28:55 -04:00
module-list.nix Revert "gitlab: disable" 2018-04-26 00:15:24 +02:00
rename.nix Merge pull request #39048 from oxij/nixos/fix-rename-bugs 2018-04-22 17:46:09 +00:00