Unverified Commit 9427a17c authored by Florian Klink's avatar Florian Klink Committed by GitHub
Browse files

Merge pull request #164016 from bobvanderlinden/pr-refactor-systemd-module

nixos: systemd: split module up into multiple files
parents b043c9d5 397b8257
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1168,7 +1168,12 @@
  ./system/boot/stage-1.nix
  ./system/boot/stage-2.nix
  ./system/boot/systemd.nix
  ./system/boot/systemd-nspawn.nix
  ./system/boot/systemd/coredump.nix
  ./system/boot/systemd/journald.nix
  ./system/boot/systemd/logind.nix
  ./system/boot/systemd/nspawn.nix
  ./system/boot/systemd/tmpfiles.nix
  ./system/boot/systemd/user.nix
  ./system/boot/timesyncd.nix
  ./system/boot/tmp.nix
  ./system/etc/etc-activation.nix
+2 −446

File changed.

Preview size limit exceeded, changes collapsed.

+57 −0
Original line number Diff line number Diff line
{ config, lib, pkgs, utils, ... }:

with lib;

let
  cfg = config.systemd.coredump;
  systemd = config.systemd.package;
in {
  options = {
    systemd.coredump.enable = mkOption {
      default = true;
      type = types.bool;
      description = ''
        Whether core dumps should be processed by
        <command>systemd-coredump</command>. If disabled, core dumps
        appear in the current directory of the crashing process.
      '';
    };

    systemd.coredump.extraConfig = mkOption {
      default = "";
      type = types.lines;
      example = "Storage=journal";
      description = ''
        Extra config options for systemd-coredump. See coredump.conf(5) man page
        for available options.
      '';
    };
  };

  config = {
    systemd.additionalUpstreamSystemUnits = [
      "systemd-coredump.socket"
      "systemd-coredump@.service"
    ];

    environment.etc = {
      "systemd/coredump.conf".text =
      ''
        [Coredump]
        ${cfg.extraConfig}
      '';

      # install provided sysctl snippets
      "sysctl.d/50-coredump.conf".source = "${systemd}/example/sysctl.d/50-coredump.conf";
      "sysctl.d/50-default.conf".source = "${systemd}/example/sysctl.d/50-default.conf";
    };

    users.users.systemd-coredump = {
      uid = config.ids.uids.systemd-coredump;
      group = "systemd-coredump";
    };
    users.groups.systemd-coredump = {};

    boot.kernel.sysctl."kernel.core_pattern" = mkIf (!cfg.enable) "core";
  };
}
+131 −0

File added.

Preview size limit exceeded, changes collapsed.

+114 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading