nixpkgs-suyu/nixos/modules/security
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
..
wrappers wrapper.c: fixup includes to work w/musl 2018-03-25 18:06:02 -05:00
acme.nix Fix incorrect merge 2018-04-21 22:34:39 +02:00
acme.xml
apparmor-suid.nix
apparmor.nix
audit.nix nixos: Move uses of stdenv.shell to runtimeShell. 2018-03-01 14:38:53 -05:00
auditd.nix
ca.nix
chromium-suid-sandbox.nix
dhparams.nix nixos/dhparams: Clean up module expression 2018-04-26 08:04:52 +02:00
duosec.nix duosec: use root uid as sshd uid has been retired (#33597) 2018-03-21 18:46:35 -05:00
hidepid.nix
hidepid.xml
lock-kernel-modules.nix
oath.nix
pam.nix Merge pull request #31969 from Assassinkin/master 2018-04-21 14:36:47 -05:00
pam_mount.nix
pam_usb.nix
polkit.nix
prey.nix
rngd.nix
rtkit.nix
sudo.nix nixos/security: fix description of sudo.wheelNeedsPassword 2018-03-16 21:50:46 +00:00