mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 20:55:31 +03:00

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-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
87 lines
2.1 KiB
Nix
87 lines
2.1 KiB
Nix
{
|
|
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`. 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 = mkMerge [
|
|
|
|
(mkIf cfg.enable {
|
|
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 =
|
|
# Fix systemd-coredump error caused by truncation of `kernel.core_pattern`
|
|
# when the `systemd` derivation name is too long. This works by substituting
|
|
# the path to `systemd` with a symlink that has a constant-length path.
|
|
#
|
|
# See: https://github.com/NixOS/nixpkgs/issues/213408
|
|
pkgs.substitute {
|
|
src = "${systemd}/example/sysctl.d/50-coredump.conf";
|
|
substitutions = [
|
|
"--replace-fail"
|
|
"${systemd}"
|
|
"${pkgs.symlinkJoin {
|
|
name = "systemd";
|
|
paths = [ systemd ];
|
|
}}"
|
|
];
|
|
};
|
|
|
|
"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 = { };
|
|
})
|
|
|
|
(mkIf (!cfg.enable) {
|
|
boot.kernel.sysctl."kernel.core_pattern" = mkDefault "core";
|
|
})
|
|
|
|
];
|
|
|
|
}
|