Commit Graph

30 Commits

Author SHA1 Message Date
nikstur
af87c19427 nixos/yggdrasil: replace activationScript
Replace with separate service because it cannot be moved into the
preStart of the yggdrasil service.
2023-12-29 03:22:27 +01:00
h7x4
0a37316d6c
treewide: use mkPackageOption
This commit replaces a lot of usages of `mkOption` with the package
type, to be `mkPackageOption`, in order to reduce the amount of code.
2023-11-27 01:28:36 +01:00
Bjørn Forsman
142074c2a8 nixos: fix bad mkEnableOption descriptions
Fix descriptions that don't account for (1) the "Whether to enable"
prefix or (2) the automatically added trailing dot.
2023-10-20 16:22:40 +01:00
Emery Hemingway
3fc4ecafeb nixos/yggdrasil: add extraArgs option 2023-10-06 17:59:14 +01:00
Martin Puppe
8bc615d0e0 nixos/yggdrasil: correct documentation
The option `LinkLocalTCPPort` does not exist anymore in recent versions
of Yggdrasil. The port for incoming link-local connections is now
configured as part of the `MulticastInterfaces` option. Our
documentation should reflect that.
2023-02-20 23:10:54 +01:00
Martin Puppe
cf8b1fb85e nixos/yggdrasil: support HJSON files as configFile
Yggdrasil uses HJSON as its configuration file format. The NixOS module
meanwhile only supports pure JSON. This commit adds support for HJSON
files.
2023-02-20 23:10:54 +01:00
Martin Puppe
78ac812356 nixos/yggdrasil: fix configFile option
As far as I can tell the configFile option cannot have worked as
intended. The Yggdrasil systemd service uses a dynamic user. As it was,
there was no way to set the correct permissions on a config file
beforehand which would allow the dynamic user to read the config file
without making it readable for all users. But since the config file can
contain a private key it *must not* be world-readable.

The file must only be readable by root. The file has to be copied and
the permissions have to be fixed during service startup. This can either
be done in a ExecStartPre directive with the '+' prefix (which executes
that command with elevated privileges), or it can be done more
declarative with the LoadCredential directive. I have chosen the latter
approach because it delegates more work to systemd itself. It should be
noted that this has the minor tradeoff that the config file must not be
larger than 1 MB. This is a limit which systemd imposes on credential
files. But I think 1 MB ought to be enough for anybody ;).
2023-02-20 23:04:24 +01:00
Martin Puppe
9b2e2e8006 nixos/yggdrasil: nixpkgs-fmt 2023-02-20 22:02:59 +01:00
pennae
0a6e6cf7e6 nixos/manual: render module chapters with nixos-render-docs
this converts meta.doc into an md pointer, not an xml pointer. since we
no longer need xml for manual chapters we can also remove support for
manual chapters from md-to-db.sh

since pandoc converts smart quotes to docbook quote elements and our
nixos-render-docs does not we lose this distinction in the rendered
output. that's probably not that bad, our stylesheet didn't make use of
this anyway (and pre-23.05 versions of the chapters didn't use quote
elements either).

also updates the nixpkgs manual to clarify that option docs support all
extensions (although it doesn't support headings at all, so heading
anchors don't work by extension).
2023-01-27 20:07:34 +01:00
MidAutumnMoon
7742cd543d
nixos/yggdrasil: set proper SystemCallFilter 2022-10-25 16:09:31 +08:00
Emery Hemingway
dbf8bba95b nixos/yggdrasil: services.yggdrasil.config renamed to settings 2022-09-25 11:10:32 -05:00
pennae
ef176dcf7e nixos/*: automatically convert option descriptions
conversions were done using https://github.com/pennae/nix-doc-munge
using (probably) rev f34e145 running

    nix-doc-munge nixos/**/*.nix
    nix-doc-munge --import nixos/**/*.nix

the tool ensures that only changes that could affect the generated
manual *but don't* are committed, other changes require manual review
and are discarded.
2022-08-31 16:32:53 +02:00
pennae
6039648c50 nixos/*: automatically convert option docs 2022-08-19 22:40:58 +02:00
pennae
e4ed177f82 nixos/* eliminate inner whitespace in tags that was missed earlier
nix-doc-munge won't match tags that contain newlines anywhere. most of
these have already been removed, but a few obviously made it through.
2022-08-19 22:40:58 +02:00
Emery Hemingway
300c5c98c6 nixos/yggdrasil: rename "config" option to "settings"
Make this service consistent with rfc42.

https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md
2022-08-11 16:09:42 -05:00
Emery Hemingway
c0eaefb30c nixos/yggdrasil: want/before systemd's network.target 2022-08-06 07:25:15 -05:00
pennae
61e93df189 nixos/*: automatically convert option docs to MD
once again using nix-doc-munge (69d080323a)
2022-08-03 22:46:41 +02:00
pennae
16102dce2f nixos/*: replace <code> in option docs with <literal>
markdown can't represent the difference without another extension and
both the html manual and the manpage render them the same, so keeping the
distinction is not very useful on its own. with the distinction removed
we can automatically convert many options that use <code> tags to markdown.

the manpage remains unchanged, html manual does not render
differently (but class names on code tags do change from "code" to "literal").
2022-08-03 21:03:23 +02:00
pennae
2e751c0772 treewide: automatically md-convert option descriptions
the conversion procedure is simple:

 - find all things that look like options, ie calls to either `mkOption`
   or `lib.mkOption` that take an attrset. remember the attrset as the
   option
 - for all options, find a `description` attribute who's value is not a
   call to `mdDoc` or `lib.mdDoc`
 - textually convert the entire value of the attribute to MD with a few
   simple regexes (the set from mdize-module.sh)
 - if the change produced a change in the manual output, discard
 - if the change kept the manual unchanged, add some text to the
   description to make sure we've actually found an option. if the
   manual changes this time, keep the converted description

this procedure converts 80% of nixos options to markdown. around 2000
options remain to be inspected, but most of those fail the "does not
change the manual output check": currently the MD conversion process
does not faithfully convert docbook tags like <code> and <package>, so
any option using such tags will not be converted at all.
2022-07-30 15:16:34 +02:00
oaksoaj
fc9e22fca1 yggdrasil: add group option back and remove systemd User= directive
The group configuration parameter allow to share access to yggdrasil
control socket with the users in the system. In the version we propose,
it is null by default so that only root can access the control socket,
but let user create their own group if they need.

Remove User= durective in systemd unit. Should a user with the specified
name already exist in the system, it would be used silently instead of a
dynamic user which could be a security concern.
2022-07-18 12:56:59 -05:00
oaksoaj
080774e28f yggdrasil: reenable DynamicUser
Since version 0.4 Yggdrasil works again using systemd's DynamicUser option.
This patch reenables it to improve security.

We tested this with both persistent and non-persistent keys. Everything
seems to work fine.
2022-07-18 12:56:59 -05:00
Naïm Favier
2ddc335e6f
nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
Gemini Lasswell
28f51d7757 nixos/yggdrasil: set directory permissions before writing keys
Remove the opportunity for someone to read the keys in between when
they are written and when the chmod is done.  Addresses #121293.
2021-05-08 09:49:19 +02:00
Emery Hemingway
764a9252a3 nixos/yggdrasil: add manual section 2020-07-25 16:34:20 +02:00
Emery Hemingway
ac97b19a2a nixos/yggdrasil: change config priority, persistentKeys
Favor the configuration in "configFile" over "config" to allow
"configFile" to override "config" without a system rebuild.

Add a "persistentKeys" option to generate keys and addresses that
persist across service restarts. This is useful for self-configuring
boot media.
2020-05-21 12:11:13 +05:30
Emery Hemingway
0d49162aa0 nixos/yggdrasil: add group option
Allow users to access the Yggdrasil control socket by group.
2020-05-02 01:21:55 +05:30
Emery Hemingway
6c1c99d6b4 nixos/yggdrasil: fix for configFile option
The configFile was not being merged with the declarative configuration at
runtime.
2019-12-07 19:56:49 +01:00
Emery Hemingway
7a1b4d1964 nixos/yggdrasil: remove /etc effects
Use of the /etc directory should be avoided for software without
hardcoded configuration paths.
2019-11-16 16:36:17 +01:00
Gemini Lasswell
d6549a2c42 nixos/yggdrasil: remove DynamicUser for systemd 243 2019-10-26 13:51:31 +02:00
Gemini Lasswell
b8cb8c39d6 nixos/yggdrasil: add service 2019-10-26 13:51:31 +02:00