chore: nf-fmt-nix

This commit is contained in:
Kat Inskip 2024-09-05 00:57:48 -07:00
parent c2089adbc7
commit 5cbde2e43f
Signed by: kat
GPG key ID: 465E64DECEA8CF0F
4 changed files with 33 additions and 24 deletions

View file

@ -26,23 +26,25 @@
]; ];
mapDynamic4 = replaceStrings ["10.1.1."] ["0.0.0."]; mapDynamic4 = replaceStrings ["10.1.1."] ["0.0.0."];
mapDynamic6 = replaceStrings ["fd0a::"] ["2001::"]; mapDynamic6 = replaceStrings ["fd0a::"] ["2001::"];
mkDynamicHostRecords = system: map (mkDynamicHostRecord system) ( mkDynamicHostRecords = system:
singleton system.access.fqdn map (mkDynamicHostRecord system) (
++ system.access.fqdnAliases singleton system.access.fqdn
); ++ system.access.fqdnAliases
);
mkDynamicHostRecord = system: let mkDynamicHostRecord = system: let
address4 = system.network.networks.local.address4 or null; address4 = system.network.networks.local.address4 or null;
address6 = system.network.networks.local.address6 or null; address6 = system.network.networks.local.address6 or null;
in fqdn: in
concatStringsSep "," ( fqdn:
singleton fqdn concatStringsSep "," (
++ optional (address4 != null) singleton fqdn
(toString (mapNullable mapDynamic4 address4)) ++ optional (address4 != null)
++ optional (address6 != null) (toString (mapNullable mapDynamic4 address4))
(toString (mapNullable mapDynamic6 address6)) ++ optional (address6 != null)
++ singleton (toString (mapNullable mapDynamic6 address6))
cfg.dynamic.interface ++ singleton
); cfg.dynamic.interface
);
mkHostRecordPair = network: system: let mkHostRecordPair = network: system: let
address4 = system.network.networks.${network}.address4 or null; address4 = system.network.networks.${network}.address4 or null;
address6 = system.network.networks.${network}.address6 or null; address6 = system.network.networks.${network}.address6 or null;

View file

@ -6,9 +6,9 @@ _: {
modules = [ modules = [
./nixos.nix ./nixos.nix
]; ];
deploy = { deploy = {
hostname = "10.1.1.50"; hostname = "10.1.1.50";
}; };
network.networks = { network.networks = {
tail = { tail = {
#address4 = "100.70.124.79"; #address4 = "100.70.124.79";

View file

@ -1,8 +1,11 @@
{ config, meta, ... }: { {
config,
meta,
...
}: {
imports = let imports = let
inherit (meta) nixos; inherit (meta) nixos;
in [ in [
nixos.sops nixos.sops
nixos.tailscale nixos.tailscale
]; ];
@ -12,9 +15,9 @@
}; };
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888"; device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888";
fsType = "ext4"; fsType = "ext4";
}; };
networking.useNetworkd = true; networking.useNetworkd = true;
systemd.network = { systemd.network = {

View file

@ -1,4 +1,8 @@
{config, lib, ...}: let {
config,
lib,
...
}: let
inherit (lib.strings) concatStringsSep; inherit (lib.strings) concatStringsSep;
dot = concatStringsSep "."; dot = concatStringsSep ".";
cutie = dot ["cutie" "moe"]; cutie = dot ["cutie" "moe"];