feat: introduce treefmt and fmt all

This commit is contained in:
steveej 2024-11-15 10:17:56 +01:00
parent 80250b0179
commit 27c6c4f9fa
237 changed files with 5440 additions and 5214 deletions

View file

@ -1,14 +1,9 @@
{ lib, ... }:
{
lib,
config,
...
}: let
cfg = config.services.ddclient-hetzner;
in {
options.services.ddclient-hetzner = with lib; {
enable = mkEnableOption "Enable ddclient-hetzner";
zone = mkOption {type = types.str;};
domains = mkOption {type = types.listOf types.str;};
passwordFile = mkOption {type = types.path;};
zone = mkOption { type = types.str; };
domains = mkOption { type = types.listOf types.str; };
passwordFile = mkOption { type = types.path; };
};
}

View file

@ -1,12 +1,7 @@
{ lib, ... }:
{
lib,
config,
...
}: let
cfg = config.services.ddclientovh;
in {
options.services.ddclientovh = with lib; {
enable = mkEnableOption "Enable ddclient-ovh";
domain = mkOption {type = types.str;};
domain = mkOption { type = types.str; };
};
}

View file

@ -4,7 +4,8 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.boot.initrd.network;
udhcpcScript = pkgs.writeScript "udhcp-script" ''
@ -25,7 +26,8 @@ with lib; let
'';
udhcpcArgs = toString cfg.udhcpc.extraArgs;
in {
in
{
options = {
boot.initrd.network.enable = mkOption {
type = types.bool;
@ -46,7 +48,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
@ -74,9 +76,9 @@ in {
};
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

View file

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

View file

@ -4,18 +4,17 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.hardware.opinionatedDisk;
ownLib = pkgs.callPackage ../lib/default.nix {};
ownLib = pkgs.callPackage ../lib/default.nix { };
earlyDiskId = cfg:
if cfg.earlyDiskIdOverride != ""
then cfg.earlyDiskIdOverride
else cfg.diskId;
in {
earlyDiskId = cfg: if cfg.earlyDiskIdOverride != "" then cfg.earlyDiskIdOverride else cfg.diskId;
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;
@ -36,31 +35,30 @@ in {
fileSystems."/" = {
device = ownLib.disk.rootFsDevice cfg.diskId;
fsType = "btrfs";
options = ["subvol=nixos"];
options = [ "subvol=nixos" ];
};
fileSystems."/home" = {
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 (earlyDiskId cfg);
enableCryptodisk = cfg.encrypted;
};
boot.initrd.luks.devices =
lib.optionalAttrs cfg.encrypted
(builtins.listToAttrs [
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
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;
@ -69,6 +67,7 @@ in {
allowDiscards = true;
};
}
]);
]
);
};
}