git.iko.soy/typeable/nixpkgs
on master help sign in
wg-netmanager: init at 0.3.6 (#155149)

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>

commitcb648f080dba0fd0b953686c43b0ce05d0ed9ef2 authorgin66 <5549373+gin66@users.noreply.github.com> dateMon 7 Feb 2022, 16:46 (5 years ago) parentfa286ff
5 files changed+83
maintainers/maintainer-list.nix+6 nixos/modules/module-list.nix+1 nixos/modules/services/networking/wg-netmanager.nix+42 pkgs/tools/networking/wg-netmanager/default.nix+30 pkgs/top-level/all-packages.nix+4
maintainers/maintainer-list.nix+6
@@ -4396,6 +4396,12 @@
43964396 githubId = 27668;
43974397 name = "Tobias Pflug";
43984398 };
4399+ gin66 = {
4400+ email = "jochen@kiemes.de";
4401+ github = "gin66";
4402+ githubId = 5549373;
4403+ name = "Jochen Kiemes";
4404+ };
43994405 giogadi = {
44004406 email = "lgtorres42@gmail.com";
44014407 github = "giogadi";
nixos/modules/module-list.nix+1
@@ -914,6 +914,7 @@
914914 ./services/networking/vsftpd.nix
915915 ./services/networking/wasabibackend.nix
916916 ./services/networking/websockify.nix
917+ ./services/networking/wg-netmanager.nix
917918 ./services/networking/wg-quick.nix
918919 ./services/networking/wireguard.nix
919920 ./services/networking/wpa_supplicant.nix
nixos/modules/services/networking/wg-netmanager.nixnew file+42
@@ -0,0 +1,42 @@
1+{ config, lib, pkgs, ... }:
2+
3+with lib;
4+
5+let
6+ cfg = config.services.wg-netmanager;
7+in
8+{
9+
10+ options = {
11+ services.wg-netmanager = {
12+ enable = mkEnableOption "Wireguard network manager";
13+ };
14+ };
15+
16+ ###### implementation
17+ config = mkIf cfg.enable {
18+ # NOTE: wg-netmanager runs as root
19+ systemd.services.wg-netmanager = {
20+ description = "Wireguard network manager";
21+ wantedBy = [ "multi-user.target" ];
22+ after = [ "network.target" ];
23+ path = with pkgs; [ wireguard-tools iproute2 wireguard-go ];
24+ serviceConfig = {
25+ Type = "simple";
26+ Restart = "on-failure";
27+ ExecStart = "${pkgs.wg-netmanager}/bin/wg_netmanager";
28+ ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
29+ ExecStop = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
30+
31+ ReadWritePaths = [
32+ "/tmp" # wg-netmanager creates files in /tmp before deleting them after use
33+ ];
34+ };
35+ unitConfig = {
36+ ConditionPathExists = ["/etc/wg_netmanager/network.yaml" "/etc/wg_netmanager/peer.yaml"];
37+ };
38+ };
39+ };
40+
41+ meta.maintainers = with maintainers; [ gin66 ];
42+}
pkgs/tools/networking/wg-netmanager/default.nixnew file+30
@@ -0,0 +1,30 @@
1+{ lib, stdenv, fetchFromGitHub, rustPlatform, darwin, wireguard-go, Security }:
2+
3+rustPlatform.buildRustPackage rec {
4+ pname = "wg-netmanager";
5+ version = "0.4.1";
6+
7+ src = fetchFromGitHub {
8+ owner = "gin66";
9+ repo = "wg_netmanager";
10+ rev = "wg_netmanager-v${version}";
11+ sha256 = "AAtSSBz2zGLIEpcEMbe1mfYZikiaYEI+6KeSL5n54PE=";
12+ };
13+
14+ cargoSha256 = "17k83QkQDq5uRCRADRLD2Q7pv7yES20lpms/N/UK+BM=";
15+
16+ buildInputs = lib.optional stdenv.isDarwin Security;
17+
18+ # Test 01 tries to create a wireguard interface, which requires sudo.
19+ doCheck = true;
20+ checkFlags = "--skip device";
21+
22+ meta = with lib; {
23+ description = "Wireguard network manager";
24+ longDescription = "Wireguard network manager, written in rust, simplifies the setup of wireguard nodes, identifies short connections between nodes residing in the same subnet, identifies unreachable aka dead nodes and maintains the routes between all nodes automatically. To achieve this, wireguard network manager needs to be running on each node.";
25+ homepage = "https://github.com/gin66/wg_netmanager";
26+ license = with licenses; [ mit asl20 bsd3 mpl20 ];
27+ maintainers = with maintainers; [ gin66 ];
28+ platforms = platforms.linux;
29+ };
30+}
pkgs/top-level/all-packages.nix+4
@@ -10937,6 +10937,10 @@ with pkgs;
1093710937
1093810938 wg-friendly-peer-names = callPackage ../tools/networking/wg-friendly-peer-names { };
1093910939
10940+ wg-netmanager = callPackage ../tools/networking/wg-netmanager {
10941+ inherit (darwin.apple_sdk.frameworks) Security;
10942+ };
10943+
1094010944 woff2 = callPackage ../development/web/woff2 { };
1094110945
1094210946 woof = callPackage ../tools/misc/woof { };