chore: format with alejandra

This commit is contained in:
steveej 2023-02-07 18:24:28 +01:00
parent 05f0cbdfb4
commit 89f5f65f2d
181 changed files with 2720 additions and 2560 deletions

View file

@ -1,9 +1,10 @@
{ config, lib, pkgs, ... }:
with lib;
let
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.boot.initrd.network;
udhcpcScript = pkgs.writeScript "udhcp-script" ''
@ -24,11 +25,8 @@ let
'';
udhcpcArgs = toString cfg.udhcpc.extraArgs;
in {
options = {
boot.initrd.network.enable = mkOption {
type = types.bool;
default = false;
@ -48,7 +46,7 @@ in {
};
boot.initrd.network.udhcpc.extraArgs = mkOption {
default = [ ];
default = [];
type = types.listOf types.str;
description = ''
Additional command-line arguments passed verbatim to udhcpc if
@ -73,14 +71,12 @@ in {
Whether to enable DHCP for the network interfaces.
'';
};
};
config = mkIf cfg.enable {
warnings = ["Enabled SSH for stage1"];
warnings = [ "Enabled SSH for stage1" ];
boot.initrd.kernelModules = [ "af_packet" ];
boot.initrd.kernelModules = ["af_packet"];
boot.initrd.extraUtilsCommands = ''
copy_bin_and_libs ${pkgs.mkinitcpio-nfs-utils}/bin/ipconfig
@ -97,7 +93,6 @@ in {
esac
done
''
# Otherwise, use DHCP.
+ optionalString cfg.useDHCP ''
if [ -z "$hasNetwork" ]; then
@ -113,14 +108,12 @@ in {
udhcpc --quit --now --script ${udhcpcScript} ${udhcpcArgs} && hasNetwork=1
fi
''
+ ''
if [ -n "$hasNetwork" ]; then
echo "networking is up!"
${cfg.postCommands}
fi
'');
''
);
};
}