mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 13:40:28 +03:00
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 https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \
--argstr baseRev b32a094368
result/bin/apply-formatting $NIXPKGS_PATH
This commit is contained in:
parent
b32a094368
commit
4f0dadbf38
21293 changed files with 701351 additions and 428307 deletions
|
@ -1,4 +1,10 @@
|
|||
{ config, lib, options, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
options,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
|
||||
host = config.networking.fqdnOrHostName;
|
||||
|
@ -55,8 +61,9 @@ let
|
|||
''}
|
||||
'';
|
||||
|
||||
notifyOpts = lib.optionalString (nm.enable || nw.enable || nx.enable)
|
||||
("-m <nomailer> -M exec ${smartdNotify} " + lib.optionalString cfg.notifications.test "-M test ");
|
||||
notifyOpts = lib.optionalString (nm.enable || nw.enable || nx.enable) (
|
||||
"-m <nomailer> -M exec ${smartdNotify} " + lib.optionalString cfg.notifications.test "-M test "
|
||||
);
|
||||
|
||||
smartdConf = pkgs.writeText "smartd.conf" ''
|
||||
# Autogenerated smartd startup config file
|
||||
|
@ -64,31 +71,32 @@ let
|
|||
|
||||
${lib.concatMapStringsSep "\n" (d: "${d.device} ${d.options}") cfg.devices}
|
||||
|
||||
${lib.optionalString cfg.autodetect
|
||||
"DEVICESCAN ${notifyOpts}${cfg.defaults.autodetected}"}
|
||||
${lib.optionalString cfg.autodetect "DEVICESCAN ${notifyOpts}${cfg.defaults.autodetected}"}
|
||||
'';
|
||||
|
||||
smartdDeviceOpts = { ... }: {
|
||||
smartdDeviceOpts =
|
||||
{ ... }:
|
||||
{
|
||||
|
||||
options = {
|
||||
options = {
|
||||
|
||||
device = lib.mkOption {
|
||||
example = "/dev/sda";
|
||||
type = lib.types.str;
|
||||
description = "Location of the device.";
|
||||
};
|
||||
device = lib.mkOption {
|
||||
example = "/dev/sda";
|
||||
type = lib.types.str;
|
||||
description = "Location of the device.";
|
||||
};
|
||||
|
||||
options = lib.mkOption {
|
||||
default = "";
|
||||
example = "-d sat";
|
||||
type = lib.types.separatedString " ";
|
||||
description = "Options that determine how smartd monitors the device.";
|
||||
};
|
||||
|
||||
options = lib.mkOption {
|
||||
default = "";
|
||||
example = "-d sat";
|
||||
type = lib.types.separatedString " ";
|
||||
description = "Options that determine how smartd monitors the device.";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
|
@ -113,9 +121,12 @@ in
|
|||
};
|
||||
|
||||
extraOptions = lib.mkOption {
|
||||
default = [];
|
||||
default = [ ];
|
||||
type = lib.types.listOf lib.types.str;
|
||||
example = ["-A /var/log/smartd/" "--interval=3600"];
|
||||
example = [
|
||||
"-A /var/log/smartd/"
|
||||
"--interval=3600"
|
||||
];
|
||||
description = ''
|
||||
Extra command-line options passed to the `smartd`
|
||||
daemon on startup.
|
||||
|
@ -243,8 +254,14 @@ in
|
|||
};
|
||||
|
||||
devices = lib.mkOption {
|
||||
default = [];
|
||||
example = [ { device = "/dev/sda"; } { device = "/dev/sdb"; options = "-d sat"; } ];
|
||||
default = [ ];
|
||||
example = [
|
||||
{ device = "/dev/sda"; }
|
||||
{
|
||||
device = "/dev/sdb";
|
||||
options = "-d sat";
|
||||
}
|
||||
];
|
||||
type = with lib.types; listOf (submodule smartdDeviceOpts);
|
||||
description = "List of devices to monitor.";
|
||||
};
|
||||
|
@ -253,15 +270,16 @@ in
|
|||
|
||||
};
|
||||
|
||||
|
||||
###### implementation
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
assertions = [ {
|
||||
assertion = cfg.autodetect || cfg.devices != [];
|
||||
message = "smartd can't run with both disabled autodetect and an empty list of devices to monitor.";
|
||||
} ];
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.autodetect || cfg.devices != [ ];
|
||||
message = "smartd can't run with both disabled autodetect and an empty list of devices to monitor.";
|
||||
}
|
||||
];
|
||||
|
||||
systemd.services.smartd = {
|
||||
description = "S.M.A.R.T. Daemon";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue