Commit Graph

77 Commits

Author SHA1 Message Date
Sandro
532fb52bde nixos/chrony: restart service (#535221) 2026-06-28 16:34:31 +00:00
Adam C. Stephens
2b7d895a0d nixos/ntpd-rs: set default log-level to warn (#482149) 2026-06-27 16:18:25 +00:00
Cassandra Comar
a3bd3d8f18 nixos/ntpd-rs: set default log-level to warn
see [dev
recommendation](https://discourse.nixos.org/t/why-are-we-using-systemd-timesyncd-by-default/74052/32).

this should reduce the spamminess of the service in the system log while
leaving the option to turn up logging if needed for debugging.
2026-06-25 09:04:03 -04:00
Sandro Jäckel
b6b3c09229 nixos/chrony: restart service 2026-06-25 11:53:30 +02:00
Sandro
051d810692 nixos/chrony: fix chrony key file permissions warning (#489979) 2026-03-15 20:37:54 +00:00
Sandro
a1b5a48921 nixos/chrony: fix typo in variable name: dispathcer -> dispatcher (#489981) 2026-03-15 20:35:06 +00:00
novenary
2b724de17a shutdown: stop manually saving hwclock
Nowadays, the RTC is fully managed by systemd and the kernel.

In userspace, timedated is enabled by default and the clock can be
adjusted with timedatectl.
Further, NixOS enables timesyncd by default, so the clock should be
synced to NTP as long as the system is connected to the internet.

Since early 2013 (Linux 3.9), CONFIG_RTC_SYSTOHC is available and on by
default. [1]
When userspace reports that NTP is synced, this causes the kernel to
periodically update the RTC.
It therefore makes no sense to keep this service enabled when using NTP.
The kernel has seemingly loaded the time from the RTC at bootup for a
very long time. [2]
Manual `hwclock --hctosys` was removed in #165684.

This all seem to make manual RTC fiddling redundant.
My Arch systems don't do it and they've never had any trouble keeping
the time.

The only remaining raison d'être for this service is offline drift
compensation as documented in hwclock(8). [3]
This isn't implemented in NixOS, and the (unmaintained) tool [4] for
this isn't even packaged.
I don't think anyone is relying on this functionality, and it doesn't
seem right to only implement it partially rather than within a more
complete module.

One thing this service actually implemented, rather shakily, is
time.hardwareClockInLocalTime.
This can more reliably be achieved by creating /etc/adjtime directly.

[1]: 023f333a99
[2]: 0c86edc0d4
[3]: https://man.archlinux.org/man/hwclock.8#Keeping_Time_without_External_Synchronization
[4]: https://github.com/rogers0/adjtimex
2026-02-26 00:21:10 +02:00
royce-c
b44354d0c8 nixos/chrony: fix typo in variable name: dispathcer -> dispatcher 2026-02-12 17:24:24 -08:00
royce-c
e81b4fb88a nixos/chrony: change chrony.keys owner to prevent chronyd user write access 2026-02-12 17:14:57 -08:00
Wolfgang Walther
fea5e1f7c1 various: add {file} tags for nixos option descriptions (#455811) 2026-02-10 10:01:28 +00:00
ccicnce113424
a40f80e47f nixos/chrony: add NetworkManager dispatcher script 2026-02-08 13:00:48 +08:00
ccicnce113424
eb9f97786b nixos/chrony: use pool option for pool server 2026-02-08 13:00:48 +08:00
ccicnce113424
8584d7ec31 nixos/chrony: add makestep option 2026-02-08 13:00:43 +08:00
h7x4
b36f8e0b79 various: add {file} tags for nixos option descriptions 2026-01-18 21:49:31 +09:00
NAHO
a2ed7e8d88 nixos: remove optional builtins prefixes from prelude functions
Remove optional builtins prefixes from prelude functions by running:

    builtins=(
      abort
      baseNameOf
      break
      derivation
      derivationStrict
      dirOf
      false
      fetchGit
      fetchMercurial
      fetchTarball
      fetchTree
      fromTOML
      import
      isNull
      map
      null
      placeholder
      removeAttrs
      scopedImport
      throw
      toString
      true
    )

    fd \
      --exclude doc/manual/release-notes \
      --type file \
      . \
      nixos \
      --exec-batch sed --in-place --regexp-extended "
        s/\<builtins\.($(
          printf '%s\n' "${builtins[@]}" |
            paste --delimiter '|' --serial -
        ))\>/\1/g
      "

    nix fmt
2026-01-15 16:07:55 +01:00
Sandro
3c38eca043 nixos/chrony: do not require CAP_SYS_TIME when not controlling system clock (#443011) 2025-12-03 01:09:08 +00:00
Stefan Frijters
7d531bc865 nixos/ntpd: automagically use pool instead of server
The same heuristic has been used for ntpd-rs
2025-10-12 12:41:23 +02:00
Sandro Jäckel
3e91417f82 nixos/chrony: do not require CAP_SYS_TIME when not controlling system clock 2025-09-14 23:48:03 +02:00
Sandro Jäckel
8d8ddd50cb nixos/chrony: remove with lib over entire file 2025-09-14 23:20:10 +02:00
liberodark
a9cd681b8d nixos/ntpd-rs: hardening 2025-08-07 11:36:09 +05:30
Wolfgang Walther
5a0711127c treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Franz Pletz
b1c964b557 nixos/tests/chrony: graphene-hardened works without mlock
Fix #423330. Broken by #416715.
2025-07-08 01:44:35 +02:00
Jonathan Davies
185eba3148 nixos/ntpd-rs: Validate the ntpd-rs.toml file 2025-06-30 15:24:05 +02:00
Sandro
48f5657fb9 nixos/chrony: fix defaultText rendering of enableMemoryLocking option 2025-06-28 18:22:12 +02:00
Franz Pletz
b333d60710 nixos/tests/chrony: not compatible with graphene-hardened anymore
Version 4.7 introduced the incompatibility, see #416005.
2025-06-14 16:56:34 +02:00
Franz Pletz
7a6c67e796 nixos/chrony: add systemd service notify support 2025-06-14 16:47:44 +02:00
Jonathan Davies
86d94b2d88 nixos/ntpd-rs: Handle configuring timeserver FQDN as a pool 2025-05-04 14:30:12 +00:00
Nico Felbinger
e0d1b49a46 chore: move meta option to top level in many modules 2025-04-19 18:27:48 +02:00
Silvan Mosberger
374e6bcc40 treewide: Format all Nix files
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:

  nix-build ci -A fmt.check

This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).

This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).

Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase).

If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
2025-04-01 20:10:43 +02:00
Arne Keller
5de8c5b941 nixos/chrony: fix memory locking issue with graphene-hardened-light (#356837) 2024-12-29 15:08:43 +01:00
Stefan Frijters
31942f20f4 nixos/ntpd: fix permissions error when creating drift file
This fixes "frequency file /var/lib/ntp/ntp.drift.TEMP: Permission denied".

Creating a directory via StateDirectory makes that directory /var/lib/ntp owned by root:root.
However, when running ntpd we change to user ntp (see ntpFlags), so the process cannot
actually use that directory.

Actually creating a home directory for the user at that location solves that problem.
2024-12-22 16:20:31 -06:00
Silvan Mosberger
4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00
royce-c
9af100479c nixos/chrony: fix memory locking issue with graphene-hardened-light
The chronyd.service fails with 'graphene-hardened-light' unless enableMemoryLocking is set to false.
2024-11-17 16:07:36 -08:00
Pyrox
4e632e9c3f nixos/ntpd: Add hardening 2024-10-19 14:26:17 -04:00
Pyrox
53bc9450bc nixos/ntpd: Use StateDirectory instead of a preStart script 2024-10-19 14:26:00 -04:00
Pyrox
297f21e357 nixos/ntpd: format with nixfmt-rfc-style 2024-10-19 04:39:16 -04:00
stuebinm
6afb255d97 nixos: remove all uses of lib.mdDoc
these changes were generated with nixq 0.0.2, by running

  nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix

two mentions of the mdDoc function remain in nixos/, both of which
are inside of comments.

Since lib.mdDoc is already defined as just id, this commit is a no-op as
far as Nix (and the built manual) is concerned.
2024-04-13 10:07:35 -07:00
Franz Pletz
35c015ff91 nixos/ntpd-rs: fix metrics service 2024-01-17 15:06:20 +01:00
Franz Pletz
9707745cf8 nixos/ntpd-rs: init 2024-01-14 17:34:42 +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
Adrian Pistol
b30601bba2 nixos/chrony: Add missing rtcsync assertion.
Due to a lot of rebasing, I dropped my added assertion in #259405. This is important.
2023-11-19 09:08:26 -06:00
Adrian Pistol
7a1d45811e nixos/chrony: Let Chrony control/track RTC drift 2023-11-15 15:09:22 -06:00
Anthony Roussel
e30f48be94 treewide: fix redirected and broken URLs
Using the script in maintainers/scripts/update-redirected-urls.sh
2023-11-11 10:49:01 +01:00
Franz Pletz
c13c1412bf nixos/chrony: add enableMemoryLocking option
Fixes #222629.
2023-08-10 03:03:53 +02:00
Ben Wolsieffer
b92dae961c nixos/chrony: allow @chown syscall set
The module was allowing specific chown syscalls, which is brittle because
there are several and different ones are used by glibc on different
architectures. For example, fchownat was already added to the allowlist for
aarch64, while on armv6l chrony crashes because chown32 is not in the
allowlist.

systemd provides the @chown syscall set, which includes all the chown
syscalls and avoids this brittleness. I believe the syscalls would all be
equivalent from an attacker's perspective, so there is unlikely to be any
security impact.
2023-03-12 18:10:56 -05:00
Izorkin
59dbe319ce nixos/gitea: update SystemCallFilter 2023-01-31 10:08:32 -06:00
Izorkin
48ecda0962 nixos/chrony: disable PrivateDevices setting 2023-01-31 10:08:32 -06:00
Izorkin
b943fb24b7 chrony: update sandboxing options 2023-01-03 07:04:55 -06:00
Artturin
f4ea1208ec treewide: *Flags convert to list from str
*Flags implies a list

slightly relevant:
> stdenv: start deprecating non-list configureFlags https://github.com/NixOS/nixpkgs/pull/173172

the makeInstalledTests function in `nixos/tests/installed-tests/default.nix` isn't available outside of nixpkgs so
it's not a breaking change
2022-10-10 15:30:59 +03: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