Commit graph

35501 commits

Author SHA1 Message Date
Maximilian Bosch 11376df6d4
nixos/rust-motd: allow ordering sections by priority
Closes #234802

The problem here is that with e.g.

    {
      uptime.prefix = "Up";
      banner.command = "hostname | figlet -f slant";
    }

`banner` still appears before `uptime` in the final motd text because
Nix sorts attribute names alphabetically internally.

To work around this without breaking compatibility or losing the
property to override individual sections in other modules - e.g.

    {
      banner.color = mkForce "blue";
    }

I decided to introduce an option `priority` here, similar to the
priority field for `nginx`[1] and with the same semantics (i.e. higher
value means lower priority).

Internally a bunch of env vars are generated, i.e. `env0` to `envN` for
`N` sections with each of them containing a declaration for the TOML,
i.e. `env0` contains `{ uptime.prefix = "Up"; }` and `env1` contains
`{ banner.command = "hostname | figlet -f slant"; }` if `uptime.priority`
is set to a value below 1000.

In this order, the declarations are concatenated together by `jq(1)`
which doesn't sort keys alphabetically which results in a JSON
representation with `uptime` before `banner`. This is finally piped to
`json2toml` which converts this into TOML for rust-motd.

[1] https://nixos.org/manual/nixos/unstable/options#opt-services.nginx.virtualHosts._name_.locations._name_.priority
2023-09-21 13:17:13 +02:00
Maximilian Bosch 0a71cf07a8
nixos/rust-motd: run once on bootup
That way e.g. the last login and uptime isn't completely bogus when
accessing a machine for the first time after a reboot.
2023-09-20 22:16:03 +02:00
Maciej Krüger 61536e7a1f
nixosTests.sudo-rs: fix syntax 2023-09-20 13:58:08 +02:00
Maciej Krüger 922926cfbc
Merge pull request #253876 from nbraud/nixos/sudo-rs 2023-09-20 13:55:33 +02:00
Lin Jian d27a248494
Merge pull request #255064 from tomfitzhenry/vikunja-cli
nixos/vikunja: install 'vikunja' CLI tool
2023-09-20 18:03:34 +08:00
zaldnoay 79599c86ae nixos/frp: fix example url of configure file 2023-09-20 13:55:53 +08:00
Weijia Wang 0425ad73b3
Merge pull request #255549 from wegank/wordpress-bump
wordpress: 6.2.2 -> 6.3.1
2023-09-20 00:41:56 +02:00
Will Fancher c6db677b1c
Merge pull request #255008 from SuperSandro2000/x-triggers-name
systemd-lib: add name to X-{Reloads,Restart}-Triggers to easily ident…
2023-09-19 17:38:05 -04:00
Pol Dellaiera 3ff2629897
Merge pull request #255880 from Atemu/installer-configuration.nix-search.nixos.org
nixos/installer: mention search.nixos.org
2023-09-19 21:50:15 +02:00
Niklas Hambüchen 1a8e576180
Merge pull request #255977 from nh2/vaultwarden-fix-default-config-evaluation
vaultwarden service: Fix doubly-nested `config` value. Fixes evaluation
2023-09-19 18:46:58 +02:00
Niklas Hambüchen c460434104 nixos/vaultwarden: Fix doubly-nested config value. Fixes evaluation 2023-09-19 16:46:08 +00:00
Nick Cao e8e461df5d
Merge pull request #254833 from NickCao/qt4-leftover
nixos/environment: drop QT_PLUGIN_PATH for qt4 and kde4 as they has b…
2023-09-19 10:08:27 -04:00
Fabián Heredia Montiel 90040cd36a linux/hardened/patches/6.5: init at 6.5.3-hardened1 2023-09-19 07:09:14 +00:00
Artturi 73d552ecb7
Merge pull request #254918 from RaitoBezarius/dnssec-resolved 2023-09-19 06:45:07 +03:00
Erno Hopearuoho 7d112f7da3 luksroot: fix issue when yubikey is detached during boot process
Fixes #228141, which describes an issue where detaching Yubikey during the boot process
causes cryptsetup to write empty passphrase instead of the challenge-response salt stored
on the boot drive.
2023-09-18 23:10:06 -03:00
nicoo d8d0b8019f nixos/sudo: Add myself as maintainer 2023-09-18 18:03:58 +00:00
nicoo d63eb55e81 nixos/sudo: Generate sudo-i PAM config for interactive use of sudo-rs 2023-09-18 18:03:58 +00:00
nicoo 7b5b3f5124 nixos/sudo: Add tests for sudo-rs too
Duplicated sudo's testsuite for now, as its maintainer does not with
to collaborate on testing effors; see #253876.

Environment-related tests were removed, as sudo-rs does not support
`(NO)SETENV` yet; see memorysafety/sudo-rs#760
2023-09-18 18:03:58 +00:00
Maximilian Bosch e4f0f0977e
Merge pull request #241973 from 999eagle/feat/synapse-workers
nixos/synapse: add support for workers, cleanup
2023-09-18 19:54:20 +02:00
Maciej Krüger 4729358fa5 nixos/test-driver: do not break if the command writes to stderr
Capturing `stderr` as part of the return `output` could break existing tests.
2023-09-18 17:36:16 +00:00
nicoo f66eb0df3b nixos/sudo: Only wrap sudoedit when using Miller's sudo 2023-09-18 17:36:15 +00:00
nicoo 914bf58369 nixos/{sudo, terminfo}: Adjust defaults for compatibility with sudo-rs 2023-09-18 17:36:15 +00:00
nicoo f0107b4f63 nixos/sudo: Check syntax using the configured package
This is preferable even for regular `sudo`, but will ensure the check is useful
when using `sudo-rs` in the future.

Also, dropped antediluvian comment about the syntax check being disabled,
when it was clearly not commented out:
  - introduced in 2007, commit 6d65f0ae03ae14f3e978d89959253d9a8f5e0ec1;
  - reverted in 2014, commit e68a5b265a,
    but without ammending the comments.
2023-09-18 17:36:15 +00:00
nicoo c11da39117 nixos/sudo: Drop the sudoers comment for extraRules
All rules are now handled through `extraRules`,
and it is never empty so `optionalString` isn't needed either.
2023-09-18 17:36:15 +00:00
nicoo 717e51a140 nixos/sudo: Make the default rules' options configurable 2023-09-18 17:36:15 +00:00
nicoo b1eab8ca53 nixos/sudo: Handle root's default rule through extraRules
This makes things more uniform, and simplifies compatibility with sudo-rs.

Moreover, users can not inject rules before this if they need to.
2023-09-18 17:35:45 +00:00
nicoo 3a95964fd5 nixos/sudo: Drop useless lib. qualifiers
Also normalise indentation for `mdDoc` to what's prevalent in this file.
2023-09-18 17:35:07 +00:00
nicoo 8b9e867ac8 nixos/sudo: Refactor checks for Todd C. Miller's implemetation 2023-09-18 17:35:07 +00:00
nicoo f5aadb56be nixos/sudo: Refactor option definitions 2023-09-18 17:35:06 +00:00
nicoo 0365b05f13 nixos/terminfo: Add config option not to add extra sudo config
This will be necessary for compatibility with `sudo-rs`.
2023-09-18 17:35:06 +00:00
nicoo 8742134c80 nixos/sudo: Only keep SSH_AUTH_SOCK if used for authentication
This will make compatibility with `sudo-rs` easier.
2023-09-18 17:35:06 +00:00
nicoo 454151375d nixos/sudo: Don't include empty sections
This makes the generated sudoers a touch easier to read.
2023-09-18 17:35:06 +00:00
nicoo 409d29ca73 nixos/sudo: Split up configFile into individual sections 2023-09-18 17:35:06 +00:00
Atemu 9084f59d36 nixos/installer: mention search.nixos.org
It's immensely helpful and more user-friendly than the humongous
configuration.nix man page.
2023-09-18 14:38:26 +02:00
Lin Jian 4dc624f9c7
Merge pull request #255264 from emilylange/nixos/caddy
nixos/caddy: ensure vhosts come after user-specified `cfg.extraConfig`
2023-09-18 19:34:34 +08:00
emilylange fcdcccaed6
nixos/caddy: ensure vhosts come after user-specified cfg.extraConfig
This solves an issue, where loading the nixos-unstable module in
nixos-stable using `disabledModules` and `imports` resulted in the
following Caddyfile:

```
<globalConfig>

<vhosts>

<extraConfig>
```

instead of

```
<globalConfig>

<extraConfig>

<vhosts>
```

This is important in cases where `cfg.extraConfig` contains so called
Caddyfile snippets.

See https://caddyserver.com/docs/caddyfile/concepts#structure

Co-authored-by: Lin Jian <me@linj.tech>
2023-09-18 11:12:19 +02:00
Sophie Tauchert 24f6a70abf
nixos/synapse: make sure workers require main process
This should ensure systemd handles starting all services (main and
workers) in a single transaction, thus preserving unit orderings
defined through After= even when not restarting the target.
2023-09-18 10:52:54 +02:00
Sophie Tauchert aed8a5c6cd
nixos/synapse: add documentation for required reverse proxy setup 2023-09-18 08:24:38 +02:00
Maximilian Bosch 6b95c618e2
nixos/rl-2311: fix option references for synapse workers 2023-09-18 08:24:38 +02:00
Sophie Tauchert dea34ad0fa
nixos/synapse: default tls to off for workers and document worker replication port 2023-09-18 08:24:37 +02:00
Sophie Tauchert c693c2fd96
nixos/synapse: simplify replication listener assertion 2023-09-18 08:24:37 +02:00
Sophie Tauchert ca1ffe5869
nixos/synapse: move services.matrix-synapse.workers.config to services.matrix-synapse.workers 2023-09-18 08:24:37 +02:00
Sophie Tauchert 53ab84cf49
nixos/synapse: automatically configure logging for synapse and workers 2023-09-18 08:24:36 +02:00
Sophie Tauchert 857b4932ec
nixos/synapse: remove obsolete log context
see 0304ad0c3d for when this was removed upstream
2023-09-18 08:24:36 +02:00
Sophie Tauchert 2edea7611b
nixos/synapse: document options better
Co-authored-by: Daniel Olsen <daniel.olsen99@gmail.com>
2023-09-18 08:24:36 +02:00
Sophie Tauchert b20cbb12cd
nixos/synapse: add test for running synapse with workers
Co-authored-by: Daniel Olsen <daniel.olsen99@gmail.com>
2023-09-18 08:24:36 +02:00
Sophie Tauchert 3a6a07ecf1
nixos/synapse: automatically configure replication listener 2023-09-18 08:24:35 +02:00
Sophie Tauchert 72a26e2b54
nixos/synapse: add options to configure workers 2023-09-18 08:24:35 +02:00
Sophie Tauchert b329180128
nixos/synapse: add option to configure redis automatically 2023-09-18 08:24:35 +02:00
Sophie Tauchert b7c41da8d6
nixos/synapse: update listener settings
The resource type health is currently missing, but should be available
according to https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#listeners
2023-09-18 08:24:35 +02:00