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,15 +1,15 @@
{ lib, config, ... }:
let
{
lib,
config,
...
}: let
cfg = config.services.ddclientovh;
passwords = import ../../variables/passwords.crypt.nix;
in {
options.services.ddclientovh = with lib; {
enable = mkEnableOption "Enable ddclient-ovh";
domain = mkOption { type = types.str; };
domain = mkOption {type = types.str;};
};
config = lib.mkIf cfg.enable {
@ -18,10 +18,11 @@ in {
protocol = "dyndns2";
server = "www.ovh.com";
ssl = true;
domains = [ cfg.domain ];
domains = [cfg.domain];
use = "web";
inherit (passwords.dyndns.${cfg.domain}) username;
passwordFile = builtins.toFile passwords.dyndns._filename
passwordFile =
builtins.toFile passwords.dyndns._filename
passwords.dyndns.${cfg.domain}.password;
};
};

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
'');
''
);
};
}

View file

@ -1,7 +1,9 @@
{ lib, config, ... }:
with lib;
{
lib,
config,
...
}:
with lib; {
# TODO
# Provide a NAT/DHCP Router
#

View file

@ -1,13 +1,15 @@
{ lib, config, ... }:
with lib;
let
{
lib,
config,
...
}:
with lib; let
cfg = config.hardware.opinionatedDisk;
ownLib = import ../lib/default.nix { };
ownLib = import ../lib/default.nix {};
in {
options.hardware.opinionatedDisk = {
enable = mkEnableOption "Enable opinionated filesystem layout";
diskId = mkOption { type = types.str; };
diskId = mkOption {type = types.str;};
encrypted = mkOption {
default = true;
type = types.bool;
@ -16,41 +18,45 @@ in {
config = lib.mkIf cfg.enable {
fileSystems."/boot" = {
device = (ownLib.disk.bootFsDevice cfg.diskId);
device = ownLib.disk.bootFsDevice cfg.diskId;
fsType = "vfat";
};
fileSystems."/" = {
device = (ownLib.disk.rootFsDevice cfg.diskId);
device = ownLib.disk.rootFsDevice cfg.diskId;
fsType = "btrfs";
options = [ "subvol=nixos" ];
options = ["subvol=nixos"];
};
fileSystems."/home" = {
device = (ownLib.disk.rootFsDevice cfg.diskId);
device = ownLib.disk.rootFsDevice cfg.diskId;
fsType = "btrfs";
options = [ "subvol=home" ];
options = ["subvol=home"];
};
swapDevices = [{ device = (ownLib.disk.swapFsDevice cfg.diskId); }];
swapDevices = [{device = ownLib.disk.swapFsDevice cfg.diskId;}];
boot.loader.grub = {
device = (ownLib.disk.bootGrubDevice cfg.diskId);
device = ownLib.disk.bootGrubDevice cfg.diskId;
enableCryptodisk = cfg.encrypted;
};
boot.initrd.luks.devices = lib.optionalAttrs cfg.encrypted
(builtins.listToAttrs [{
name = let
splitstring =
builtins.split "/" (ownLib.disk.bootLuksDevice cfg.diskId);
lastelem = (builtins.length splitstring) - 1;
in builtins.elemAt splitstring lastelem;
value = {
device = (ownLib.disk.bootLuksDevice cfg.diskId);
preLVM = true;
allowDiscards = true;
};
}]);
boot.initrd.luks.devices =
lib.optionalAttrs cfg.encrypted
(builtins.listToAttrs [
{
name = let
splitstring =
builtins.split "/" (ownLib.disk.bootLuksDevice cfg.diskId);
lastelem = (builtins.length splitstring) - 1;
in
builtins.elemAt splitstring lastelem;
value = {
device = ownLib.disk.bootLuksDevice cfg.diskId;
preLVM = true;
allowDiscards = true;
};
}
]);
};
}