modules/*: lint (esp: modules/vpn.nix -- removed unused priorityWgTable)
This commit is contained in:
@@ -1,11 +1,9 @@
|
|||||||
# TODO: consider using this library for .zone file generation:
|
# TODO: consider using this library for .zone file generation:
|
||||||
# - <https://github.com/kirelagin/dns.nix>
|
# - <https://github.com/kirelagin/dns.nix>
|
||||||
{ config, lib, pkgs, ... }:
|
{ lib, ... }:
|
||||||
|
|
||||||
with builtins;
|
with builtins;
|
||||||
let
|
let
|
||||||
cfg = config.sane.dns;
|
|
||||||
toml = pkgs.formats.toml { };
|
|
||||||
recordFormatters = {
|
recordFormatters = {
|
||||||
# quote rules for zone files:
|
# quote rules for zone files:
|
||||||
# - any character may be encoded by `\DDD`, where `DDD` represents its ascii value in base 8.
|
# - any character may be encoded by `\DDD`, where `DDD` represents its ascii value in base 8.
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
#
|
#
|
||||||
# TODO: replace mobile-nixos parts with Disko <https://github.com/nix-community/disko>
|
# TODO: replace mobile-nixos parts with Disko <https://github.com/nix-community/disko>
|
||||||
# or just inline them here.
|
# or just inline them here.
|
||||||
{ config, lib, pkgs, utils, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
@@ -91,10 +91,6 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
config = let
|
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`
|
# return the (string) path to get from `stem` to `path`
|
||||||
# or errors if not a sub-path
|
# or errors if not a sub-path
|
||||||
relPath = stem: path: (
|
relPath = stem: path: (
|
||||||
|
@@ -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.
|
# 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.
|
# 3c. juse use `sanebox`, which abstracts the above options.
|
||||||
|
|
||||||
{ config, lib, pkgs, sane-lib, ... }:
|
{ config, lib, sane-lib, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.sane.vpn;
|
cfg = config.sane.vpn;
|
||||||
vpnOpts = with lib; types.submodule ({ name, config, ... }: {
|
vpnOpts = with lib; types.submodule ({ name, config, ... }: {
|
||||||
@@ -52,10 +52,6 @@ let
|
|||||||
type = types.int;
|
type = types.int;
|
||||||
internal = true;
|
internal = true;
|
||||||
};
|
};
|
||||||
priorityWgTable = mkOption {
|
|
||||||
type = types.int;
|
|
||||||
internal = true;
|
|
||||||
};
|
|
||||||
priorityFwMark = mkOption {
|
priorityFwMark = mkOption {
|
||||||
type = types.int;
|
type = types.int;
|
||||||
internal = true;
|
internal = true;
|
||||||
@@ -119,11 +115,10 @@ let
|
|||||||
isDefault = builtins.all (other: config.id <= other.id) (builtins.attrValues cfg);
|
isDefault = builtins.all (other: config.id <= other.id) (builtins.attrValues cfg);
|
||||||
fwmark = config.id + 10000;
|
fwmark = config.id + 10000;
|
||||||
priorityMain = config.id + 100;
|
priorityMain = config.id + 100;
|
||||||
priorityWgTable = config.id + 200;
|
|
||||||
priorityFwMark = config.id + 300;
|
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 = [
|
assertions = [
|
||||||
{
|
{
|
||||||
assertion = (lib.count (c: c.id == id) (builtins.attrValues cfg)) == 1;
|
assertion = (lib.count (c: c.id == id) (builtins.attrValues cfg)) == 1;
|
||||||
|
Reference in New Issue
Block a user