diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2023-02-19 12:02:03 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-19 12:02:03 +0000 |
commit | 1ce3b0f2723c79e2fd0560afa11e27a7f3acfef0 (patch) | |
tree | d23d33040211e448382c159daac1fdfed9453dea /nixos | |
parent | adfc10e0d8604164f6cfaa2d2d8008a02ad2b96f (diff) | |
parent | 85ba84c218735aca6e562796fa87b6df31304a38 (diff) | |
download | nixlib-1ce3b0f2723c79e2fd0560afa11e27a7f3acfef0.tar nixlib-1ce3b0f2723c79e2fd0560afa11e27a7f3acfef0.tar.gz nixlib-1ce3b0f2723c79e2fd0560afa11e27a7f3acfef0.tar.bz2 nixlib-1ce3b0f2723c79e2fd0560afa11e27a7f3acfef0.tar.lz nixlib-1ce3b0f2723c79e2fd0560afa11e27a7f3acfef0.tar.xz nixlib-1ce3b0f2723c79e2fd0560afa11e27a7f3acfef0.tar.zst nixlib-1ce3b0f2723c79e2fd0560afa11e27a7f3acfef0.zip |
Merge staging-next into staging
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/doc/manual/release-notes/rl-2305.section.md | 2 | ||||
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/networking/networkd-dispatcher.nix | 63 | ||||
-rw-r--r-- | nixos/modules/services/networking/v2raya.nix | 49 |
4 files changed, 96 insertions, 19 deletions
diff --git a/nixos/doc/manual/release-notes/rl-2305.section.md b/nixos/doc/manual/release-notes/rl-2305.section.md index 9a89f7fcdcbd..843c4acac93f 100644 --- a/nixos/doc/manual/release-notes/rl-2305.section.md +++ b/nixos/doc/manual/release-notes/rl-2305.section.md @@ -42,6 +42,8 @@ In addition to numerous new and upgraded packages, this release has the followin - [atuin](https://github.com/ellie/atuin), a sync server for shell history. Available as [services.atuin](#opt-services.atuin.enable). +- [networkd-dispatcher](https://gitlab.com/craftyguy/networkd-dispatcher), a dispatcher service for systemd-networkd connection status changes. Available as [services.networkd-dispatcher](#opt-services.networkd-dispatcher.enable). + - [mmsd](https://gitlab.com/kop316/mmsd), a lower level daemon that transmits and recieves MMSes. Available as [services.mmsd](#opt-services.mmsd.enable). - [QDMR](https://dm3mat.darc.de/qdmr/), a GUI application and command line tool for programming DMR radios [programs.qdmr](#opt-programs.qdmr.enable) diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 9ce78c9eb124..4fa3e8e8acdb 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -912,6 +912,7 @@ ./services/networking/ndppd.nix ./services/networking/nebula.nix ./services/networking/netbird.nix + ./services/networking/networkd-dispatcher.nix ./services/networking/networkmanager.nix ./services/networking/nextdns.nix ./services/networking/nftables.nix diff --git a/nixos/modules/services/networking/networkd-dispatcher.nix b/nixos/modules/services/networking/networkd-dispatcher.nix new file mode 100644 index 000000000000..d13ca23368c5 --- /dev/null +++ b/nixos/modules/services/networking/networkd-dispatcher.nix @@ -0,0 +1,63 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.services.networkd-dispatcher; +in { + options = { + services.networkd-dispatcher = { + + enable = mkEnableOption (mdDoc '' + Networkd-dispatcher service for systemd-networkd connection status + change. See [https://gitlab.com/craftyguy/networkd-dispatcher](upstream instructions) + for usage. + ''); + + scriptDir = mkOption { + type = types.path; + default = "/var/lib/networkd-dispatcher"; + description = mdDoc '' + This directory is used for keeping various scripts read and run by + networkd-dispatcher. See [https://gitlab.com/craftyguy/networkd-dispatcher](upstream instructions) + for directory structure and script usage. + ''; + }; + + }; + }; + + config = mkIf cfg.enable { + + systemd = { + + packages = [ pkgs.networkd-dispatcher ]; + services.networkd-dispatcher = { + wantedBy = [ "multi-user.target" ]; + # Override existing ExecStart definition + serviceConfig.ExecStart = [ + "" + "${pkgs.networkd-dispatcher}/bin/networkd-dispatcher -v --script-dir ${cfg.scriptDir} $networkd_dispatcher_args" + ]; + }; + + # Directory structure required according to upstream instructions + # https://gitlab.com/craftyguy/networkd-dispatcher + tmpfiles.rules = [ + "d '${cfg.scriptDir}' 0750 root root - -" + "d '${cfg.scriptDir}/routable.d' 0750 root root - -" + "d '${cfg.scriptDir}/dormant.d' 0750 root root - -" + "d '${cfg.scriptDir}/no-carrier.d' 0750 root root - -" + "d '${cfg.scriptDir}/off.d' 0750 root root - -" + "d '${cfg.scriptDir}/carrier.d' 0750 root root - -" + "d '${cfg.scriptDir}/degraded.d' 0750 root root - -" + "d '${cfg.scriptDir}/configuring.d' 0750 root root - -" + "d '${cfg.scriptDir}/configured.d' 0750 root root - -" + ]; + + }; + + + }; +} + diff --git a/nixos/modules/services/networking/v2raya.nix b/nixos/modules/services/networking/v2raya.nix index 2d697b4fb56f..0bea73798daf 100644 --- a/nixos/modules/services/networking/v2raya.nix +++ b/nixos/modules/services/networking/v2raya.nix @@ -12,27 +12,38 @@ with lib; config = mkIf config.services.v2raya.enable { environment.systemPackages = [ pkgs.v2raya ]; - systemd.services.v2raya = { - unitConfig = { - Description = "v2rayA service"; - Documentation = "https://github.com/v2rayA/v2rayA/wiki"; - After = [ "network.target" "nss-lookup.target" "iptables.service" "ip6tables.service" ]; - Wants = [ "network.target" ]; - }; + systemd.services.v2raya = + let + nftablesEnabled = config.networking.nftables.enable; + iptablesServices = [ + "iptables.service" + ] ++ optional config.networking.enableIPv6 "ip6tables.service"; + tableServices = if nftablesEnabled then [ "nftables.service" ] else iptablesServices; + in + { + unitConfig = { + Description = "v2rayA service"; + Documentation = "https://github.com/v2rayA/v2rayA/wiki"; + After = [ + "network.target" + "nss-lookup.target" + ] ++ tableServices; + Wants = [ "network.target" ]; + }; - serviceConfig = { - User = "root"; - ExecStart = "${getExe pkgs.v2raya} --log-disable-timestamp"; - Environment = [ "V2RAYA_LOG_FILE=/var/log/v2raya/v2raya.log" ]; - LimitNPROC = 500; - LimitNOFILE = 1000000; - Restart = "on-failure"; - Type = "simple"; - }; + serviceConfig = { + User = "root"; + ExecStart = "${getExe pkgs.v2raya} --log-disable-timestamp"; + Environment = [ "V2RAYA_LOG_FILE=/var/log/v2raya/v2raya.log" ]; + LimitNPROC = 500; + LimitNOFILE = 1000000; + Restart = "on-failure"; + Type = "simple"; + }; - wantedBy = [ "multi-user.target" ]; - path = with pkgs; [ iptables bash iproute2 ]; # required by v2rayA TProxy functionality - }; + wantedBy = [ "multi-user.target" ]; + path = with pkgs; [ iptables bash iproute2 ]; # required by v2rayA TProxy functionality + }; }; meta.maintainers = with maintainers; [ elliot ]; |