mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-25 18:46:32 +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-build https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \
--argstr baseRev b32a094368
result/bin/apply-formatting $NIXPKGS_PATH
89 lines
2 KiB
Nix
89 lines
2 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
|
|
let
|
|
inherit (lib)
|
|
mkEnableOption
|
|
mkPackageOption
|
|
mkIf
|
|
mkOption
|
|
types
|
|
recursiveUpdate
|
|
;
|
|
|
|
cfg = config.networking.wireless.iwd;
|
|
ini = pkgs.formats.ini { };
|
|
defaults = {
|
|
# without UseDefaultInterface, sometimes wlan0 simply goes AWOL with NetworkManager
|
|
# https://iwd.wiki.kernel.org/interface_lifecycle#interface_management_in_iwd
|
|
General.UseDefaultInterface =
|
|
with config.networking.networkmanager;
|
|
(enable && (wifi.backend == "iwd"));
|
|
};
|
|
configFile = ini.generate "main.conf" (recursiveUpdate defaults cfg.settings);
|
|
|
|
in
|
|
{
|
|
options.networking.wireless.iwd = {
|
|
enable = mkEnableOption "iwd";
|
|
|
|
package = mkPackageOption pkgs "iwd" { };
|
|
|
|
settings = mkOption {
|
|
type = ini.type;
|
|
default = { };
|
|
|
|
example = {
|
|
Settings.AutoConnect = true;
|
|
|
|
Network = {
|
|
EnableIPv6 = true;
|
|
RoutePriorityOffset = 300;
|
|
};
|
|
};
|
|
|
|
description = ''
|
|
Options passed to iwd.
|
|
See {manpage}`iwd.config(5)` for supported options.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
assertions = [
|
|
{
|
|
assertion = !config.networking.wireless.enable;
|
|
message = ''
|
|
Only one wireless daemon is allowed at the time: networking.wireless.enable and networking.wireless.iwd.enable are mutually exclusive.
|
|
'';
|
|
}
|
|
];
|
|
|
|
environment.etc."iwd/${configFile.name}".source = configFile;
|
|
|
|
# for iwctl
|
|
environment.systemPackages = [ cfg.package ];
|
|
|
|
services.dbus.packages = [ cfg.package ];
|
|
|
|
systemd.packages = [ cfg.package ];
|
|
|
|
systemd.network.links."80-iwd" = {
|
|
matchConfig.Type = "wlan";
|
|
linkConfig.NamePolicy = "keep kernel";
|
|
};
|
|
|
|
systemd.services.iwd = {
|
|
path = [ config.networking.resolvconf.package ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
restartTriggers = [ configFile ];
|
|
serviceConfig.ReadWritePaths = "-/etc/resolv.conf";
|
|
};
|
|
};
|
|
|
|
meta.maintainers = with lib.maintainers; [ dtzWill ];
|
|
}
|