chore: nixfmt *

This commit is contained in:
steveej 2022-10-31 11:04:38 +01:00
parent dc761a5271
commit d039179898
161 changed files with 2688 additions and 3024 deletions

View file

@ -1,6 +1,4 @@
{ lib
, config
, ... }:
{ lib, config, ... }:
let
cfg = config.services.ddclientovh;
@ -11,21 +9,20 @@ 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 {
services.ddclient = {
enable = true;
protocol = "dyndns2";
server = "www.ovh.com";
ssl = true;
domains = [ cfg.domain ];
use = "web";
inherit (passwords.dyndns.${cfg.domain}) username;
passwordFile = builtins.toFile passwords.dyndns._filename passwords.dyndns.${cfg.domain}.password;
services.ddclient = {
enable = true;
protocol = "dyndns2";
server = "www.ovh.com";
ssl = true;
domains = [ cfg.domain ];
use = "web";
inherit (passwords.dyndns.${cfg.domain}) username;
passwordFile = builtins.toFile passwords.dyndns._filename
passwords.dyndns.${cfg.domain}.password;
};
};
}

View file

@ -6,29 +6,26 @@ let
cfg = config.boot.initrd.network;
udhcpcScript = pkgs.writeScript "udhcp-script"
''
#! /bin/sh
if [ "$1" = bound ]; then
ip address add "$ip/$mask" dev "$interface"
if [ -n "$router" ]; then
ip route add "$router" dev "$interface" # just in case if "$router" is not within "$ip/$mask" (e.g. Hetzner Cloud)
ip route add default via "$router" dev "$interface"
fi
if [ -n "$dns" ]; then
rm -f /etc/resolv.conf
for i in $dns; do
echo "nameserver $dns" >> /etc/resolv.conf
done
fi
udhcpcScript = pkgs.writeScript "udhcp-script" ''
#! /bin/sh
if [ "$1" = bound ]; then
ip address add "$ip/$mask" dev "$interface"
if [ -n "$router" ]; then
ip route add "$router" dev "$interface" # just in case if "$router" is not within "$ip/$mask" (e.g. Hetzner Cloud)
ip route add default via "$router" dev "$interface"
fi
'';
if [ -n "$dns" ]; then
rm -f /etc/resolv.conf
for i in $dns; do
echo "nameserver $dns" >> /etc/resolv.conf
done
fi
fi
'';
udhcpcArgs = toString cfg.udhcpc.extraArgs;
in
{
in {
options = {
@ -51,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

View file

@ -1,7 +1,5 @@
{ lib
, config
, ... }:
with lib;
{ lib, config, ... }:
with lib;
{
# TODO

View file

@ -1,7 +1,5 @@
{ lib
, config
, ... }:
with lib;
{ lib, config, ... }:
with lib;
let
cfg = config.hardware.opinionatedDisk;
@ -9,9 +7,7 @@ let
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,27 +32,25 @@ in {
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);
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;
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;
};
}
]);
}]);
};
}