From e5965bd4897310d1f99ad75f51ef99f1f0e2c274 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sun, 11 Aug 2019 15:38:20 +0200 Subject: [PATCH] nixos/sysctl: rename /etc/sysctl.d/nixos.conf -> 60-nixos.conf sysctl.d(5) recommends prefixing all filenames in /etc/sysctl.d with a two-digit number and a dash, to simplify the ordering of the files. Some packages provide custom files, often with "50-" prefix. To ensure user-supplied configuration takes precedence over the one specified via `boot.kernel.sysctl`, prefix the file generated there with "60-". --- nixos/doc/manual/release-notes/rl-1909.xml | 8 ++++++++ nixos/modules/config/sysctl.nix | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/nixos/doc/manual/release-notes/rl-1909.xml b/nixos/doc/manual/release-notes/rl-1909.xml index ca2f26ec4a82..4fe82e10ae6d 100644 --- a/nixos/doc/manual/release-notes/rl-1909.xml +++ b/nixos/doc/manual/release-notes/rl-1909.xml @@ -435,6 +435,14 @@ idiom or extract that anonymous mapping function to a named one. Both can still be used but lib.forEach is preferred over lib.flip map. + + The /etc/sysctl.d/nixos.conf file containing all the options set via + boot.kernel.sysctl was moved to + /etc/sysctl.d/60-nixos.conf, as + sysctl.d5 + recommends prefixing all filenames in /etc/sysctl.d with a + two-digit number and a dash to simplify the ordering of the files. + diff --git a/nixos/modules/config/sysctl.nix b/nixos/modules/config/sysctl.nix index 0c6a7e2431aa..112e5e744d4c 100644 --- a/nixos/modules/config/sysctl.nix +++ b/nixos/modules/config/sysctl.nix @@ -42,14 +42,14 @@ in config = { - environment.etc."sysctl.d/nixos.conf".text = + environment.etc."sysctl.d/60-nixos.conf".text = concatStrings (mapAttrsToList (n: v: optionalString (v != null) "${n}=${if v == false then "0" else toString v}\n" ) config.boot.kernel.sysctl); systemd.services.systemd-sysctl = { wantedBy = [ "multi-user.target" ]; - restartTriggers = [ config.environment.etc."sysctl.d/nixos.conf".source ]; + restartTriggers = [ config.environment.etc."sysctl.d/60-nixos.conf".source ]; }; # Enable hardlink and symlink restrictions. See