*.nix: remove unused code

This commit is contained in:
Astro 2022-03-22 18:13:17 +01:00
parent e16be776bb
commit 2de02cc5bb
25 changed files with 28 additions and 29 deletions

View File

@ -1,4 +1,4 @@
{ config, ... }: { ... }:
{ {
site.net.vpn = { site.net.vpn = {
vlan = null; vlan = null;

View File

@ -14,7 +14,7 @@ let
) )
) {} (builtins.attrValues containers); ) {} (builtins.attrValues containers);
makeServer = name: { makeServer = _name: {
role = "server"; role = "server";
model = "pc"; model = "pc";
interfaces = bridgeInterfaces // { interfaces = bridgeInterfaces // {

View File

@ -26,7 +26,7 @@
}; };
in { in {
# Config, and utilities # Config, and utilities
lib = nixpkgs.lib.extend (final: prev: lib = nixpkgs.lib.extend (_final: _prev:
import ./nix/lib { import ./nix/lib {
inherit self; inherit self;
inherit openwrt; inherit openwrt;

View File

@ -224,7 +224,7 @@ let
}; };
}; };
interfaceOpts = { name, ... }: { interfaceOpts = { ... }: {
options = { options = {
hwaddr = mkOption { hwaddr = mkOption {
type = with types; nullOr str; type = with types; nullOr str;
@ -433,7 +433,7 @@ let
wifi = mkOption { wifi = mkOption {
default = {}; default = {};
type = with types; attrsOf (submodule ( type = with types; attrsOf (submodule (
{ name, ... }: { { ... }: {
options = { options = {
htmode = mkOption { htmode = mkOption {
type = enum [ "HT20" "HT40-" "HT40+" "VHT80" ]; type = enum [ "HT20" "HT40-" "HT40+" "VHT80" ];
@ -443,7 +443,7 @@ let
}; };
ssids = mkOption { ssids = mkOption {
type = attrsOf (submodule ( type = attrsOf (submodule (
{ name, ... }: { { ... }: {
options = { options = {
net = mkOption { net = mkOption {
type = str; type = str;
@ -479,7 +479,7 @@ let
type = types.int; type = types.int;
}; };
peers = mkOption { peers = mkOption {
type = with types; attrsOf (submodule ({ name, ... }: { type = with types; attrsOf (submodule ({ ... }: {
options = { options = {
asn = mkOption { asn = mkOption {
type = types.int; type = types.int;

View File

@ -43,7 +43,7 @@ rec {
); );
# generate zones only for nets with hosts # generate zones only for nets with hosts
namedNets = lib.filterAttrs (name: { hosts4, hosts6, dynamicDomain, ... }: namedNets = lib.filterAttrs (_name: { hosts4, hosts6, dynamicDomain, ... }:
(hosts4 != [] && hosts6 != []) || (hosts4 != [] && hosts6 != []) ||
dynamicDomain dynamicDomain
) config.site.net; ) config.site.net;
@ -143,7 +143,7 @@ rec {
)) {} (builtins.attrNames namedNets); )) {} (builtins.attrNames namedNets);
# `{ dn42 = [ "....ip6.arpa" ]; }` # `{ dn42 = [ "....ip6.arpa" ]; }`
reverseZones6 = builtins.mapAttrs (ctx: reverseHosts6ctx: reverseZones6 = builtins.mapAttrs (_ctx: reverseHosts6ctx:
builtins.attrNames ( builtins.attrNames (
builtins.foldl' (result: rname: result // { builtins.foldl' (result: rname: result // {
"${builtins.substring ((128 - reverseZone6Size) / 2) (72 - ((128 - reverseZone6Size) / 2)) rname}" = true; "${builtins.substring ((128 - reverseZone6Size) / 2) (72 - ((128 - reverseZone6Size) / 2)) rname}" = true;

View File

@ -1,5 +1,5 @@
# Routing daemon configuration # Routing daemon configuration
{ hostName, config, options, lib, pkgs, ... }: { hostName, config, lib, pkgs, ... }:
let let
hostConf = config.site.hosts.${hostName}; hostConf = config.site.hosts.${hostName};

View File

@ -1,5 +1,5 @@
# ISC DHCP/IPv4 server configuration # ISC DHCP/IPv4 server configuration
{ hostName, inputs, config, lib, ... }: { hostName, config, lib, ... }:
let let
dhcpNets = dhcpNets =

View File

@ -1,4 +1,4 @@
{ hostName, config, lib, pkgs, self, inputs, ... }: { hostName, config, lib, pkgs, self, ... }:
let let
serial = serial =

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }: { pkgs, ... }:
let let
netboot_xyz_efi = pkgs.fetchurl { netboot_xyz_efi = pkgs.fetchurl {
url = "https://github.com/netbootxyz/netboot.xyz/releases/download/2.0.40/netboot.xyz.efi"; url = "https://github.com/netbootxyz/netboot.xyz/releases/download/2.0.40/netboot.xyz.efi";

View File

@ -1,4 +1,4 @@
{ hostName, inputs, config, lib, ... }: { hostName, config, lib, ... }:
let let
hostConf = config.site.hosts.${hostName}; hostConf = config.site.hosts.${hostName};

View File

@ -1,4 +1,4 @@
{ hostName, config, lib, pkgs, ... }: { config, pkgs, ... }:
let let
privateKeyFile = ifName: privateKeyFile = ifName:

View File

@ -1,7 +1,6 @@
{ hostName, config, lib, pkgs, ... }: { hostName, config, lib, pkgs, ... }:
let let
gateway = "upstream1";
tunnels = lib.filterAttrs (_: { wireguard, ... }: tunnels = lib.filterAttrs (_: { wireguard, ... }:
wireguard != null wireguard != null

View File

@ -1,4 +1,4 @@
{ pkgs, lib, config, hostName, ... }: { lib, config, hostName, ... }:
let let
hostConf = config.site.hosts.${hostName}; hostConf = config.site.hosts.${hostName};

View File

@ -1,6 +1,6 @@
# Pulls together NixOS configuration modules according to the # Pulls together NixOS configuration modules according to the
# name/role of the host to be built. # name/role of the host to be built.
{ hostName, config, lib, pkgs, ... }: { hostName, config, lib, ... }:
let let
inherit (lib) optionals; inherit (lib) optionals;

View File

@ -1,4 +1,4 @@
{ hostName, inputs, pkgs, config, options, lib, ... }: { hostName, inputs, pkgs, ... }:
{ {
boot.kernelParams = [ boot.kernelParams = [

View File

@ -1,4 +1,4 @@
{ hostName, config, lib, pkgs, ... }: { hostName, config, lib, ... }:
let let
# pick an address for a net's gateway # pick an address for a net's gateway

View File

@ -1,4 +1,4 @@
{ hostName, self, config, lib, pkgs, ... }: { self, config, lib, pkgs, ... }:
let let
# Containers that are run on this host # Containers that are run on this host

View File

@ -1,5 +1,5 @@
# Server network configuration # Server network configuration
{ hostName, self, config, lib, pkgs, ... }: { config, lib, ... }:
let let
# LXC containers on this host # LXC containers on this host

View File

@ -1,4 +1,4 @@
{ config, pkgs, ... }: { config, ... }:
{ {
boot.loader.grub.enable = true; boot.loader.grub.enable = true;

View File

@ -1,4 +1,4 @@
{ pkgs, ... }: { ... }:
{ {
boot.initrd.availableKernelModules = [ "uhci_hcd" "ehci_pci" "ahci" "usbhid" "sd_mod" "sr_mod" ]; boot.initrd.availableKernelModules = [ "uhci_hcd" "ehci_pci" "ahci" "usbhid" "sd_mod" "sr_mod" ];

View File

@ -59,7 +59,7 @@ let
vm-packages = vm-packages =
builtins.foldl' (rootfs: hostName: rootfs // { builtins.foldl' (rootfs: hostName: rootfs // {
"${hostName}-vm" = self.nixosConfigurations.${hostName}.config.system.build.vm "${hostName}-vm" = self.nixosConfigurations.${hostName}.config.system.build.vm
.overrideAttrs (oa: { .overrideAttrs (_oa: {
meta.mainProgram = "run-${hostName}-vm"; meta.mainProgram = "run-${hostName}-vm";
}); });
}) {} ( }) {} (

View File

@ -15,7 +15,7 @@ let
in in
writeText "named.slave.conf" ( writeText "named.slave.conf" (
lib.concatMapStringsSep "\n" ({ name, ns, ... }: '' lib.concatMapStringsSep "\n" ({ name, ... }: ''
zone "${name}" IN { zone "${name}" IN {
type slave; type slave;
masters {${mastersStr} }; masters {${mastersStr} };

View File

@ -138,7 +138,7 @@ in rec {
logical-cypher-graph = logical-cypher-graph =
let let
containers = containers =
lib.filterAttrs (_: { isRouter, role, ... }: lib.filterAttrs (_: { role, ... }:
role == "container" role == "container"
) config.site.hosts; ) config.site.hosts;
in in

View File

@ -134,7 +134,7 @@ in rec {
logical-graph = logical-graph =
let let
containers = containers =
lib.filterAttrs (_: { isRouter, role, ... }: lib.filterAttrs (_: { role, ... }:
role == "container" role == "container"
) config.site.hosts; ) config.site.hosts;
in in

View File

@ -1,5 +1,5 @@
# https://www.crc.id.au/real-console-on-linksys-srw2024-switch/ # https://www.crc.id.au/real-console-on-linksys-srw2024-switch/
{ self, pkgs, hostName, config, hostConfig { pkgs, hostName, config, hostConfig
, sort, sortBy, sortNetsByVlan , sort, sortBy, sortNetsByVlan
, ... }: , ... }:
with pkgs; with pkgs;