modules/*: lint (esp: modules/vpn.nix -- removed unused priorityWgTable)

This commit is contained in:
2024-09-03 20:24:36 +00:00
parent f384515c51
commit 35a41be824
3 changed files with 4 additions and 15 deletions

View File

@@ -1,11 +1,9 @@
# TODO: consider using this library for .zone file generation:
# - <https://github.com/kirelagin/dns.nix>
{ 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.

View File

@@ -9,7 +9,7 @@
#
# TODO: replace mobile-nixos parts with Disko <https://github.com/nix-community/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: (

View File

@@ -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;