From 35a41be824d6cdfcc053b21c005e605acaa64495 Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 3 Sep 2024 20:24:36 +0000 Subject: [PATCH] modules/*: lint (esp: modules/vpn.nix -- removed unused priorityWgTable) --- modules/dns.nix | 4 +--- modules/image.nix | 6 +----- modules/vpn.nix | 9 ++------- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/modules/dns.nix b/modules/dns.nix index d6dc3a446..1bc8bac6f 100644 --- a/modules/dns.nix +++ b/modules/dns.nix @@ -1,11 +1,9 @@ # TODO: consider using this library for .zone file generation: # - -{ config, lib, pkgs, ... }: +{ lib, ... }: with builtins; let - cfg = config.sane.dns; - toml = pkgs.formats.toml { }; recordFormatters = { # quote rules for zone files: # - any character may be encoded by `\DDD`, where `DDD` represents its ascii value in base 8. diff --git a/modules/image.nix b/modules/image.nix index 2d929ffad..e67f9b9f1 100644 --- a/modules/image.nix +++ b/modules/image.nix @@ -9,7 +9,7 @@ # # TODO: replace mobile-nixos parts with Disko # or just inline them here. -{ config, lib, pkgs, utils, ... }: +{ config, lib, pkgs, ... }: with lib; let @@ -91,10 +91,6 @@ in }; }; config = let - # return true if super starts with sub - startsWith = super: sub: ( - (builtins.substring 0 (builtins.stringLength sub) super) == sub - ); # return the (string) path to get from `stem` to `path` # or errors if not a sub-path relPath = stem: path: ( diff --git a/modules/vpn.nix b/modules/vpn.nix index 97be2b210..464af8586 100644 --- a/modules/vpn.nix +++ b/modules/vpn.nix @@ -24,7 +24,7 @@ # 3b. attach the VPN device to a bridge device, then connect that to a network namespace by using a veth pair. # 3c. juse use `sanebox`, which abstracts the above options. -{ config, lib, pkgs, sane-lib, ... }: +{ config, lib, sane-lib, ... }: let cfg = config.sane.vpn; vpnOpts = with lib; types.submodule ({ name, config, ... }: { @@ -52,10 +52,6 @@ let type = types.int; internal = true; }; - priorityWgTable = mkOption { - type = types.int; - internal = true; - }; priorityFwMark = mkOption { type = types.int; internal = true; @@ -119,11 +115,10 @@ let isDefault = builtins.all (other: config.id <= other.id) (builtins.attrValues cfg); fwmark = config.id + 10000; priorityMain = config.id + 100; - priorityWgTable = config.id + 200; priorityFwMark = config.id + 300; }; }); - mkVpnConfig = name: { addrV4, dns, endpoint, fwmark, id, priorityMain, priorityWgTable, priorityFwMark, privateKeyFile, publicKey, subnetV4, ... }: { + mkVpnConfig = name: { addrV4, dns, endpoint, fwmark, id, privateKeyFile, publicKey, subnetV4, ... }: { assertions = [ { assertion = (lib.count (c: c.id == id) (builtins.attrValues cfg)) == 1;